Login  Register

Re: need help understanding glVertexAttribPointer and GL_INVALID_OPERATION

Posted by jmaasing on Jan 08, 2013; 11:32pm
URL: https://forum.jogamp.org/need-help-understanding-glVertexAttribPointer-and-GL-INVALID-OPERATION-tp4027730p4027749.html

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.

I'm pretty new to the shader based pipeline so I must be getting the GL state wrong for some fundamental reason.

Things I've tried also is to allocate VBOs, VAs and all that jazz like so

gl.glGenVertexArrays(1, vertexArrays, 0);
gl.glBindVertexArray(this.vertexArrays[0]);
gl.glGenBuffers(1, vertexBuffers, 0);
gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, this.vertexBuffers[0]);
FloatBuffer fbVertices = Buffers.newDirectFloatBuffer(vertices);
gl.glBufferData(GL3.GL_ARRAY_BUFFER, vertices.length * Float.SIZE / 8, fbVertices, GL3.GL_STATIC_DRAW);

gl.glEnableVertexAttribArray(vertexArrays[0]);
gl.glVertexAttribPointer(positionAttribute, 3, GL3.GL_FLOAT, false, 0, 0);

gl.glBindVertexArray(this.vertexArrays[0]);
gl.glDrawArrays(GL3.GL_TRIANGLES, 0, 3);

Which gave me an GL_INVALID_OPERATION on the draw call, I don't know if that is progress or just another noob error in not understanding the fundamentals

I'll struggle on, thanks for your time.