I am trying to switch my OpenGL application from the old fixed function system to using Vertex Buffer Objects. However, with my current setup nothing is displaying on the screen. I’m sure I’m making some simple error, but I can’t see it.
model and index hold the IDs for my vbo and ibo respectively. The buffer objects are set up in the GLTest::makeModel method. The struct i’m using to store vertex data has 3 floats for the position, followed by 4 unsigned chars for the color.
It creates three vertices arranged in a triangle, and the buffer object simply contains the numbers 0,1,and 2. I call the method with a QRgb object containing the color blue, so with this setup, I would expect to see a blue triangle displayed on screen. Instead, nothing is displayed.
A full Qt project which shows the error is available here. You will need GLEW installed.
I never programmed with the fixed-pipeline versions of OpenGL, but I’ve been doing lots of work in v3.0+, so take my advice carefully!
You seem to be mixing old and new together, for example you don’t have a vertex or fragment shader loaded. Your
glEnableClientState(),glMatrixMode(),glLoadIdentity(),glVertexPointer(),glColorPointer()are depreciated in modern OpenGL; having been replaced by shader functionality.Also whenever I get stuck with this sort thing, I litter my gl calls with glGetError(), you only have one.