Dear forum
Im tring to write a very simple programm using Vertex Buff Obj VBO, using Eclipse & Mingw.
Many other think work already (vertex array, displayList ecc), but for VBO i need extension.
So, I download the glext, include all necessary,link to the lib and so. At end the compilation dont give errors.
But, my sw dont work. So, i dont know if problem comes from my sw or from glex.
Part of my code is here (just draw a triangle) …maybe looking only at this partial code is possible to see some error:
I just included the more important part in main() & render() function.
GLfloat VertexArray[]= {0,0,10,0,0,10,} ;
GLuint BufferOBJ[1];
int main(int argc, char * argv[])
{
…
…
// generate a new VBO and get the associated ID
glGenBuffers(1,BufferOBJ);
// bind VBO in order to use
glBindBuffer(GL_ARRAY_BUFFER, BufferOBJ [ VertexInd ] );
// upload data to VBO
glBufferData(GL_ARRAY_BUFFER, 6, VertexArray, GL_STATIC_DRAW);
glEnableClientState(GL_VERTEX_ARRAY); // activate vertex coords array
glutMainLoop();
return 0;
}
void render(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,1);
glEnableClientState(GL_VERTEX_ARRAY); // activate vertex coords array
glBindBuffer(GL_ARRAY_BUFFER, BufferOBJ [ VertexInd ] );
glVertexPointer(2, GL_FLOAT, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, 6);
glFlush();
return;
}
Thanks for help.
Roberto