DCRC

실습 참고 자료

2016.04.25 16:55

likidas Views:1779

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 제출 방법 및 시간 [11] likidas 2016.06.20 1635
30 기말고사 기출문제 [10] file likidas 2016.06.14 1872
29 2016년 5월 30일 강의 [9] likidas 2016.05.30 1747
28 New PA3 [9] file likidas 2016.05.25 1700
27 Class 17 - Pixel Operations (Updated) [9] file likidas 2016.05.15 1697
26 PA2 제출 방법 및 검사 시간 [8] likidas 2016.05.15 1725
» 실습 참고 자료 [9] likidas 2016.04.25 1779
24 2016 봄학기 중간고사 성적 [12] likidas 2016.04.25 1880
23 PA #1 제출 방법 [13] likidas 2016.04.10 1859
22 PA#1 공지 [10] file likidas 2016.03.28 1808
21 Computer Graphics 기말고사 기출문제 [9] file likidas 2015.12.07 2644
20 Class 25-26 [8] file likidas 2015.12.05 1940
19 Gouraud Shading Source Sample [8] file likidas 2015.11.29 2442
18 Class 23 - 24 [9] file likidas 2015.11.28 2443
17 Class 20 - 22 [1] [8] file likidas 2015.11.22 2845
16 Class 19 and PA#3 [7] file likidas 2015.11.15 2091
15 Class 18 [8] file likidas 2015.11.07 2442
14 Class 15-16 [9] file likidas 2015.11.01 1997
13 Class 13 - 14 [2] [15] file likidas 2015.10.25 4681
12 Class 12 [10] file likidas 2015.10.19 2387