Login  Register

Re: need help understanding glVertexAttribPointer and GL_INVALID_OPERATION

Posted by Xerxes Rånby on Jan 09, 2013; 12:37am
URL: https://forum.jogamp.org/need-help-understanding-glVertexAttribPointer-and-GL-INVALID-OPERATION-tp4027730p4027750.html

jmaasing wrote
Yeah, I understand that I recompile the shaders a bit more than is needed :-) Thanks for the tip.
Sadly, rearranging the lines didn't help. Still get the same error. Tried it on a linux+nVidia with the same result.
Try bind the attribute explicit using  glBindAttribLocation before the program.link step.
http://www.opengl.org/sdk/docs/man/xhtml/glBindAttribLocation.xml

The index number that is set to 1 below is then picked by you.
Any index number below GL_MAX_VERTEX_ATTRIBS will do,
Most GPU cards got 16 Vertex attribute slots, unless the driver is broken then 0 attrib slots might be available.
http://www.kludx.com/capability.php?capability=737

...
                program.add(vertexShader);
                program.add(fragmentShader);
                gl.glBindAttribLocation(program.program(), 1 /* user picked index */ , "attribute_Position"); // <- here
                program.link(gl, System.out);
...

I will try test the code if i get my hands on some GL3 hardware.
Cheers and have a great day!
Xerxes