Derelict-GL3 Error

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 9 20:34:24 PST 2017


On Tuesday, 10 January 2017 at 01:43:50 UTC, Kevin wrote:
> Using Archlinux, Derelict-gl3 1.0.18
> check format (GLuint, Glenum, Glint*)
>
> // this does not work
> glGetShaderiv(program, GL_LINK_STATUS, &success);
> writeln("GL_ERROR: ", glGetError());
>
> Give me error 1282
>
> // this one works fine.
> glGetShaderiv(shader, GL_COMPILE_STATUS, &success);

This has nothing to do with Derelict. It's an error in your use 
of OpenGL, so you need to look up the OpenGL error code 1282 and 
figure out what it means.

Since I'm here, I'll save you some time. 1282 is 
GL_INVALID_OPERATION. However, just because you called it 
immediately after glGetShaderiv *does not mean* that function 
caused the error. The error code may have been set any time 
before that, by any of the functions you called. Then, when you 
call glGetError, the error code is reset to 0, so your next call 
to glGetError shows no error.

Here's some psuedocode to illustrate:

// OpenGL's internal error code
errCode = 0;

// In your code:
glSomething(); // no error
glSomethingElse(); // no error
glAnotherThing();  // Oops! An error - errCode now is set to 1282
glThisThing();  // No error, but the state is now messed up
glThatThing();  // No error
err = glGetError();  // This returns 1282, as set by 
glAnotherThing above


What you need to do is debug your OpenGL code. The simplest way 
to do that is to insert glGetError at different points, 
recompile, and run it again. This will help you narrow things 
down to the function that actually caused the error.

And for future reference, please go to opengl.org or the OpenGL 
forums at gamedev.net for help with OpenGL.


More information about the Digitalmars-d mailing list