Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I use GLEW and freeglut. For some reason, after a call to glewInit(), glGetError() returns error code 1280. Reinstalling the drivers didn't help. I tried to disable glewExperimental, it had no effect. Code worked before, but I am not aware of any changes I could possibly make.

Here's my code:

int main(int argc, char* argv[])
{
    GLenum GlewInitResult, res;

    InitWindow(argc, argv);

    res = glGetError(); // res = 0

    glewExperimental = GL_TRUE;
    GlewInitResult = glewInit();    

    res = glGetError(); // res = 1280

    glutMainLoop();

    exit(EXIT_SUCCESS);
}

void InitWindow(int argc, char* argv[])
{
    glutInit(&argc, argv);

    glutInitContextVersion(4, 0);
    glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
    glutInitContextProfile(GLUT_CORE_PROFILE);

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,
    GLUT_ACTION_GLUTMAINLOOP_RETURNS);

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(CurrentWidth, CurrentHeight);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);

    WindowHandle = glutCreateWindow(WINDOW_TITLE);

    GLenum errorCheckValue = glGetError();

    if (WindowHandle < 1)
    {
        fprintf(stderr, "ERROR: Could not create new rendering window.\n");
        exit(EXIT_FAILURE);
    }

    glutReshapeFunc(ResizeFunction);
    glutDisplayFunc(RenderFunction);
    glutIdleFunc(IdleFunction);
    glutTimerFunc(0, TimerFunction, 0);
    glutCloseFunc(Cleanup);
    glutKeyboardFunc(KeyboardFunction);
}

Could someone tell me what I am doing wrong? Thanks.

share|improve this question
    
is GLEW returning an error? –  Avi Jun 1 '12 at 21:33
add comment

2 Answers

up vote 1 down vote accepted

Try disabling the glewExperimental support, as that may be attempting to call something in OpenGL that isn't supported by your particular driver. That actual error is GL_INVALID_ENUM​ which, unfortunately, can be raised from pretty much anywhere.

Also, what OpenGL driver are you using and in what environment? Some drivers may allow you to enable a debug log or the like. Unfortunately, GLEW itself is not written in a way that makes it easy to add in generic glGetError() checks after every extension query or the like, but you might be able to narrow it down by adding it in at strategic locations.

share|improve this answer
    
I tried to disable glewExperimental, it had no effect. I use Windows 7 64bit, latest AMD drivers. –  malymato Jun 1 '12 at 21:29
    
Whoops, I had error in my vertex shader. GL_INVALID_ENUM wasn't really the problem. Thanks –  malymato Jun 1 '12 at 21:50
add comment

The error code given, 1280, corresponds with GL error 0x0500

GL_INVALID_ENUM​, 0x0500: Given when an enumeration parameter is not a legal enumeration for that function. This is given only for local problems; if the spec allows the enumeration in certain circumstances, and other parameters or state dictate those circumstances, then GL_INVALID_OPERATION​ is the result instead.

http://www.opengl.org/wiki/GL_Error_Codes

Apparently one of the enums you are passing into OpenGL is bad. I've never used GLUT so I have no idea what the possible enum error could be.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.