DCRC

실습 참고 자료

2016.04.25 16:55

likidas Views:961

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 783
30 기말고사 기출문제 file likidas 2016.06.14 890
29 2016년 5월 30일 강의 likidas 2016.05.30 810
28 New PA3 file likidas 2016.05.25 852
27 Class 17 - Pixel Operations (Updated) file likidas 2016.05.15 795
26 PA2 제출 방법 및 검사 시간 likidas 2016.05.15 915
» 실습 참고 자료 likidas 2016.04.25 961
24 2016 봄학기 중간고사 성적 likidas 2016.04.25 971
23 PA #1 제출 방법 likidas 2016.04.10 981
22 PA#1 공지 file likidas 2016.03.28 930
21 Computer Graphics 기말고사 기출문제 file likidas 2015.12.07 1542
20 Class 25-26 file likidas 2015.12.05 1168
19 Gouraud Shading Source Sample file likidas 2015.11.29 1473
18 Class 23 - 24 file likidas 2015.11.28 1218
17 Class 20 - 22 [1] file likidas 2015.11.22 1646
16 Class 19 and PA#3 file likidas 2015.11.15 1235
15 Class 18 file likidas 2015.11.07 1303
14 Class 15-16 file likidas 2015.11.01 1226
13 Class 13 - 14 [2] file likidas 2015.10.25 1852
12 Class 12 file likidas 2015.10.19 1490