chunk.cpp
void Chunk::sendVAO() {
    
    // Give our vertices and UVs to OpenGL.
    glBufferData(GL_ARRAY_BUFFER, buffer_data.size() * sizeof(GLfloat), buffer_data.data(), GL_STATIC_DRAW);

    // Set the variable 'vert' in vertex shader 
    // Equals to the vertices for the block
    GLuint gVert = glGetAttribLocation(shaders, "vert");
    glEnableVertexAttribArray(gVert);
    glVertexAttribPointer(
        0,                  // attribute 0
        3,                  // size
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        8*sizeof(GLfloat),  // stride
        (void*)0            // array buffer offset
    );

    // Set the variable 'vertTexCoord' in vertex shader 
    // Equals to the UV values for corresponding vertices to the block
    GLuint gVertTexCoord = glGetAttribLocation(shaders, "vertTexCoord");
    glEnableVertexAttribArray(gVertTexCoord);
    glVertexAttribPointer(
        1,                  // attribute 1
        2,                  // size
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        8*sizeof(GLfloat),  // stride
        (const GLvoid*)(3 * sizeof(GLfloat))    // array buffer offset
    );

    // Equals to the normal values for corresponding vertices to the block
    GLuint gVertNormal = glGetAttribLocation(shaders, "vertNormal");
    glEnableVertexAttribArray(gVertNormal);
    glVertexAttribPointer(
        2,                  // attribute 1
        3,                  // size
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        8*sizeof(GLfloat),  // stride
        (const GLvoid*)(5 * sizeof(GLfloat))    // array buffer offset
    );

    // unbind VAO and VBO 
    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}
// sends data in VAO to openGL shaders
sends data in VAO to openGL shaders
sends data in VAO to openGL shaders
void Chunk::sendVAO() {
    glBufferData(GL_ARRAY_BUFFER, buffer_data.size() * sizeof(GLfloat), buffer_data.data(), GL_STATIC_DRAW);
    GLuint gVert = glGetAttribLocation(shaders, "vert");
    glEnableVertexAttribArray(gVert);
    glVertexAttribPointer(
        0,                  
        3,                  
        GL_FLOAT,           
        GL_FALSE,           
        8*sizeof(GLfloat),  
        (void*)0            
    );
    GLuint gVertTexCoord = glGetAttribLocation(shaders, "vertTexCoord");
    glEnableVertexAttribArray(gVertTexCoord);
    glVertexAttribPointer(
        1,                  
        2,                  
        GL_FLOAT,           
        GL_FALSE,           
        8*sizeof(GLfloat),  
        (const GLvoid*)(3 * sizeof(GLfloat))    
    );
    GLuint gVertNormal = glGetAttribLocation(shaders, "vertNormal");
    glEnableVertexAttribArray(gVertNormal);
    glVertexAttribPointer(
        2,                  
        3,                  
        GL_FLOAT,           
        GL_FALSE,           
        8*sizeof(GLfloat),  
        (const GLvoid*)(5 * sizeof(GLfloat))    
    );
    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void Chunk :: sendVAO ( ) { glBufferData ( GL_ARRAY_BUFFER , buffer_data . size ( ) * sizeof ( GLfloat ) , buffer_data . data ( ) , GL_STATIC_DRAW ) ; GLuint gVert = glGetAttribLocation ( shaders , " " ) ; glEnableVertexAttribArray ( gVert ) ; glVertexAttribPointer ( 0 , 3 , GL_FLOAT , GL_FALSE , 8 * sizeof ( GLfloat ) , ( void * ) 0 ) ; GLuint gVertTexCoord = glGetAttribLocation ( shaders , " " ) ; glEnableVertexAttribArray ( gVertTexCoord ) ; glVertexAttribPointer ( 1 , 2 , GL_FLOAT , GL_FALSE , 8 * sizeof ( GLfloat ) , ( const GLvoid * ) ( 3 * sizeof ( GLfloat ) ) ) ; GLuint gVertNormal = glGetAttribLocation ( shaders , " " ) ; glEnableVertexAttribArray ( gVertNormal ) ; glVertexAttribPointer ( 2 , 3 , GL_FLOAT , GL_FALSE , 8 * sizeof ( GLfloat ) , ( const GLvoid * ) ( 5 * sizeof ( GLfloat ) ) ) ; glBindVertexArray ( 0 ) ; glBindBuffer ( GL_ARRAY_BUFFER , 0 ) ; }
sends data in VAO to openGL shaders
sends data in VAO to openGL shaders
// Give our vertices and UVs to OpenGL. // Set the variable 'vert' in vertex shader  // Equals to the vertices for the block // attribute 0 // size // type // normalized? // stride // array buffer offset // Set the variable 'vertTexCoord' in vertex shader  // Equals to the UV values for corresponding vertices to the block // attribute 1 // size // type // normalized? // stride // array buffer offset // Equals to the normal values for corresponding vertices to the block // attribute 1 // size // type // normalized? // stride // array buffer offset // unbind VAO and VBO 