DCRC

실습 참고 자료

2016.04.25 16:55

likidas Views:1641

GLfloat vtxBufferData[] =  {

        -0.1f,-0.1f,-0.1f, 1.0, 0.0, 0.0, // triangle 1 : begin

        -0.1f,-0.1f, 0.1f, 1.0, 0.0, 0.0,

        -0.1f, 0.1f, 0.1f, 1.0, 0.0, 0.0, // triangle 1 : end

        -0.1f,-0.1f,-0.1f, 1.0, 0.0, 0.0,

        -0.1f, 0.1f, 0.1f, 1.0, 0.0, 0.0,

        -0.1f, 0.1f,-0.1f, 1.0, 0.0, 0.0,

        

        0.1f, 0.1f,-0.1f, 0.0, 1.0, 0.0, // triangle 3 : begin

        -0.1f,-0.1f,-0.1f, 0.0, 1.0, 0.0,

        -0.1f, 0.1f,-0.1f, 0.0, 1.0, 0.0,  // triangle 3 : end

        0.1f, 0.1f,-0.1f, 0.0, 1.0, 0.0,

        0.1f,-0.1f,-0.1f, 0.0, 1.0, 0.0,

        -0.1f,-0.1f,-0.1f, 0.0, 1.0, 0.0,

        

        0.1f,-0.1f, 0.1f, 0.0, 0.0, 1.0,

        -0.1f,-0.1f,-0.1f, 0.0, 0.0, 1.0,

        0.1f,-0.1f,-0.1f, 0.0, 0.0, 1.0,

        0.1f,-0.1f, 0.1f, 0.0, 0.0, 1.0,

        -0.1f,-0.1f, 0.1f, 0.0, 0.0, 1.0,

        -0.1f,-0.1f,-0.1f, 0.0, 0.0, 1.0,

        

        -0.1f, 0.1f, 0.1f, 1.0, 1.0, 0.0,

        -0.1f,-0.1f, 0.1f, 1.0, 1.0, 0.0,

        0.1f,-0.1f, 0.1f, 1.0, 1.0, 0.0,

        0.1f, 0.1f, 0.1f, 1.0, 1.0, 0.0,

        -0.1f, 0.1f, 0.1f, 1.0, 1.0, 0.0,

        0.1f,-0.1f, 0.1f, 1.0, 1.0, 0.0,

        

        0.1f, 0.1f, 0.1f, 1.0, 0.0, 1.0,

        0.1f,-0.1f,-0.1f, 1.0, 0.0, 1.0,

        0.1f, 0.1f,-0.1f, 1.0, 0.0, 1.0,

        0.1f,-0.1f,-0.1f, 1.0, 0.0, 1.0,

        0.1f, 0.1f, 0.1f, 1.0, 0.0, 1.0,

        0.1f,-0.1f, 0.1f, 1.0, 0.0, 1.0,

        

        0.1f, 0.1f, 0.1f, 0.0, 1.0, 1.0,

        0.1f, 0.1f,-0.1f, 0.0, 1.0, 1.0,

        -0.1f, 0.1f,-0.1f, 0.0, 1.0, 1.0,

        0.1f, 0.1f, 0.1f, 0.0, 1.0, 1.0,

        -0.1f, 0.1f,-0.1f, 0.0, 1.0, 1.0,

        -0.1f, 0.1f, 0.1f, 0.0, 1.0, 1.0

    };

 //1.

    //Generate VAO

    GLuint VertexArrayID;

    glGenVertexArrays(1, &VertexArrayID);


    GLuint VBOs[2];

    glGenBuffers(2, VBOs);

    


 

    glBindVertexArray(VertexArrayID);


    glBindBuffer(GL_ARRAY_BUFFER, vboID);

    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*36*6, vtxBufferData, GL_STATIC_DRAW);

    


    GLuint posID = glGetAttribLocation(programID, "a_Pos");

    glVertexAttribPointer(posID, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*6, ((GLvoid*)(0)));

    glEnableVertexAttribArray(posID);

    

    GLuint colID = glGetAttribLocation(programID, "a_Col");

    glVertexAttribPointer(colID, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*6, ((GLvoid*)(sizeof(GLfloat)*3)));

    glEnableVertexAttribArray(colID);


No. Subject Author Date Views
31 PA3 제출 방법 및 시간 [10] likidas 2016.06.20 1482
30 기말고사 기출문제 [9] file likidas 2016.06.14 1726
29 2016년 5월 30일 강의 [8] likidas 2016.05.30 1603
28 New PA3 [8] file likidas 2016.05.25 1556
27 Class 17 - Pixel Operations (Updated) [8] file likidas 2016.05.15 1560
26 PA2 제출 방법 및 검사 시간 [7] likidas 2016.05.15 1586
» 실습 참고 자료 [8] likidas 2016.04.25 1641
24 2016 봄학기 중간고사 성적 [11] likidas 2016.04.25 1732
23 PA #1 제출 방법 [12] likidas 2016.04.10 1705
22 PA#1 공지 [9] file likidas 2016.03.28 1671
21 Computer Graphics 기말고사 기출문제 [8] file likidas 2015.12.07 2493
20 Class 25-26 [7] file likidas 2015.12.05 1817
19 Gouraud Shading Source Sample [7] file likidas 2015.11.29 2291
18 Class 23 - 24 [8] file likidas 2015.11.28 2306
17 Class 20 - 22 [1] [7] file likidas 2015.11.22 2688
16 Class 19 and PA#3 [6] file likidas 2015.11.15 1975
15 Class 18 [7] file likidas 2015.11.07 2296
14 Class 15-16 [8] file likidas 2015.11.01 1867
13 Class 13 - 14 [2] [14] file likidas 2015.10.25 4369
12 Class 12 [9] file likidas 2015.10.19 2228