OSX 4.1 Core Profile Draw Issue

Hello,

Having a issue with OpenGL drawing on OSX (10.9 xcode 5) Core 4.1 profile. Calls to glDrawElements are returning gl_invalid_operation, I believe I have everything configured in the OpenGL state correctly.

This is the first frame of my OpenGL callback up to the place where glDrawElements is called and corruptes the state (glError returns gl_invalid_operation).
(Can’t post links yet)

My VAOs:

My VBO:

Both shaders (Vertex/Fragment) compile and attach to the program (Program has validated status of GL_FALSE however).

The glDrawElements call looks like:
glDrawElements(mesh->getPrimitiveType(), nbIndexes, GL_UNSIGNED_INT, 0);
Resolved it looks like
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0);

Any input is appreciated.

Is that the complete trace? It doesn’t show any calls to glGenBuffers, so all of your glBindBuffer calls (i.e. the element array, uniform buffer) should be invalid (because core profile doesn’t allow you to bind un-gen’d objects.)

Your trace also doesn’t show any glBufferData calls, so your element array was never allocated, so your glDrawElements call can’t possibly work.

It looks like you’re capturing the trace with OpenGL Profiler. I suggest using the “break on error” checkbox, instead of manually calling glGetError over and over.

If glValidateProgram is failing, you should look at the validation log. It will tell you why it fails.
Also, in the trace it looks like you’re calling glDeleteProgram when you meant to call glDetachShader & glDeleteShader.

Hello,

Thank you for the feedback.
212.18.224.37/opengl-call.txt is a complete trace where I believe it shows the glGenBuffer and glBufferData calls.
I will trim out the majority of the glGetError calls after I’m done with this intense debugging!

I do call glDeleteShader during deconstruction that appears to be converting into glDeleteProgram when viewed with Profiler (header version mismatch?)

Problem appears to be with my program, reading thru the call trace I noticed I was validating the program and checking glGetError, checking the validation status returned the error in the program. (

Validation Failed: Sampler error:
Samplers of different types use the same texture image unit.

  • or -
    A sampler’s texture unit is out of range (greater than max allowed or negative).