UnknownError1337
UnknownError1337

Reputation: 1222

Weird GL_INVALID_OPERATION error in OpenGL

glClearColor( 1.0f, 1.0f, 1.0f, 1.0f );

AttachVertexShader( shader, "szescian_vs.glsl" );
AttachFragmentShader( shader, "szescian_fs.glsl" );
LinkProgram( shader );

glBindVertexArray( vertexVAO );

glGenBuffers( 1, &positionBuffer );

glGenBuffers( 1, &positionBuffer );
glBindBuffer( GL_ARRAY_BUFFER, positionBuffer );
glBufferData( GL_ARRAY_BUFFER, sizeof( position ), position, GL_STATIC_DRAW );
positionLoc = glGetAttribLocation( shader, "inPosition" );
glEnableVertexAttribArray ( positionLoc );
glVertexAttribPointer ( positionLoc, 3, GL_FLOAT, GL_FALSE, 0, ( void* ) 0 ); //here gDEBugger GL breaks on OpenGL Error

It's part of my init function, and I really don't know why gDEBugger breaks on it, can anybody explain it for me?

Break Reason OpenGL Error Breaked-on glVertexAttribPointer(0 , 3 , GL_FLOAT , FALSE , 0 , 0x00000000) Error-Code
GL_INVALID_OPERATION Error-Description The specified operation is not allowed in the current state. The offending function is ignored, having no side effect other than to set the error flag. * Stopped before function execution

This is break information.

Upvotes: 3

Views: 8308

Answers (1)

Sergey K.
Sergey K.

Reputation: 25386

The possible GL_INVALID_OPERATION errors generated by glVertexAttribPointer():

  1. GL_INVALID_OPERATION is generated if size is GL_BGRA and type is not GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV.

  2. GL_INVALID_OPERATION is generated if type is GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV and size is not 4 or GL_BGRA.

  3. GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_INT_10F_11F_11F_REV and size is not 3.

  4. GL_INVALID_OPERATION is generated by glVertexAttribPointer if size is GL_BGRA and noramlized is GL_FALSE.

  5. GL_INVALID_OPERATION is generated if zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.

http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttribPointer.xml

Upvotes: 8

Related Questions