DCRC

실습 참고 자료

2016.04.25 16:55

likidas Views:1009

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 제출 방법 및 시간 likidas 2016.06.20 821
30 기말고사 기출문제 file likidas 2016.06.14 959
29 2016년 5월 30일 강의 likidas 2016.05.30 978
28 New PA3 file likidas 2016.05.25 886
27 Class 17 - Pixel Operations (Updated) file likidas 2016.05.15 866
26 PA2 제출 방법 및 검사 시간 likidas 2016.05.15 957
» 실습 참고 자료 likidas 2016.04.25 1009
24 2016 봄학기 중간고사 성적 likidas 2016.04.25 1062
23 PA #1 제출 방법 likidas 2016.04.10 1027
22 PA#1 공지 file likidas 2016.03.28 974
21 Computer Graphics 기말고사 기출문제 file likidas 2015.12.07 1804
20 Class 25-26 file likidas 2015.12.05 1211
19 Gouraud Shading Source Sample file likidas 2015.11.29 1551
18 Class 23 - 24 file likidas 2015.11.28 1536
17 Class 20 - 22 [1] file likidas 2015.11.22 1747
16 Class 19 and PA#3 file likidas 2015.11.15 1289
15 Class 18 file likidas 2015.11.07 1631
14 Class 15-16 file likidas 2015.11.01 1260
13 Class 13 - 14 [2] file likidas 2015.10.25 2260
12 Class 12 file likidas 2015.10.19 1543