PDA

View Full Version : gl_error 1282 when setting glVertexAttribPointer



awright2009
01-17-2011, 02:21 PM
Hello, my opengl 3.1 forward compatible context use to work, but no longer does. (crashes on glDrawElementsBaseVertex)

It still works fine in opengl 3.1 compatibility mode.

I've noticed that it throws gl_error 1282 on glVertexAttribPointer. I'm using 5 attribs, my card supports 16 and all the parameters are correct.

I'm setting glVertexAttribPointer right before drawing as it was the only way I could get it to work back when opengl 3.0 first came out. (I'd rather set it on initialization or when creating my vertex buffer objects, but again that doesnt seem to work.)

I just looked a little into vertex array objects as I'm still using vertex buffers and index buffers seperately, but right now I'm compatible with d3d9 and changing over would require some fiddling as my d3d9 wrapper expects vertex buffer and index buffers to be created and selected separately.

Do I have to use vao's? Or is it possible to continue using glVertexAttribPointer with vertex and index buffers? If so where should I set my glVertexAttribPointer so it doesnt throw gl_error 1282?

skynet
01-17-2011, 02:28 PM
Setting a VAO is required by GL3.0+
Put this somewhere at the start of your code and it should be ok.


GLuint vao=0;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);