OpenGL: glGetError() returns invalid enum after call to glewInit()

Posted by malymato on Game Development See other posts from Game Development or by malymato
Published on 2012-06-01T21:04:16Z Indexed on 2012/06/01 22:51 UTC
Read the original article Hit count: 319

Filed under:
|
|

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.

© Game Development or respective owner

Related posts about c++

Related posts about opengl