PDA

View Full Version : how to stop a vertex buffer without deleting it ?



noobscratcher
04-10-2012, 03:22 PM
I'm trying to render a .obj file to the frustum but it keeps attaching itself to the current vertex buffer even when I bind the .obj data to another vertex buffer


glGenBuffers(1, &vertexbuffer);

glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);

glBufferData(GL_ARRAY_BUFFER, sizeof(points), points.data(), GL_STATIC_DRAW);

glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE,num_bytes ,points.data());

glEnableVertexAttribArray(3);



//Translation Process
GLfloat TranslationMatrix[] = {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 1.0,
0.0, 0.0, 0.0, 1.0
};

//Send Translation Matrix up to the vertex shader
glUniformMatrix4fv(translation, 1, TRUE, TranslationMatrix);


//THIS IS FINE
// glDrawElements(GL_QUADS, points.size(), GL_UNSIGNED_INT, points.data());
glDrawElements( GL_QUADS, faces.size(), GL_UNSIGNED_INT, faces.data());


Is there a way to use the current vertex buffer with .obj data without deleting the old current buffer?.