Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8926657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:01:28+00:00 2026-06-15T08:01:28+00:00

I am getting GL_INVALID_ENUM code when calling glGetError right after glew init has finished

  • 0

I am getting GL_INVALID_ENUM code when calling glGetError right after glew init has finished and before any other gl command was called.I am setting OpenGL 4.2 CORE ,forward compatible.Using GLFW for window/input and GLEW for gl context all this running on Windows 7 64bit.My graphic card is GeForce 550GT which has the latest drivers with OpenGL 4.2.Another strange thing is that I was using glDrawElements() which worked fine.But then I tried glDrawArrays(), which I needed for some specific task, and it didn’t work at all.I double rechecked all the gl syntax ,buffer creations shaders etc.Nothing.I do get GL_INVALID_OPERATION when calling glDrawArrays() and I have no Idea why.All this work is a mini render engine but currently the pipeline is really simple so I can’t understand what can be the problem.Here is how I initialize the context and window:

 void Engine::InitWithGLFW(){


    if(!glfwInit()){
        exit(EXIT_FAILURE);
    }
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
    glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindowHint(GLFW_FSAA_SAMPLES,0);
    glfwDisable( GLFW_AUTO_POLL_EVENTS );

 #ifdef DEBUG
    glfwOpenWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
 #endif

    if(!glfwOpenWindow(_width,_height,8, 8, 8, 8, 24, 8,GLFW_WINDOW)){
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    glfwSetWindowTitle("XDEngine V-1.0");
    InitGlew();



}

void  Engine::InitGlew(){
    glewExperimental=GL_TRUE;
    GLenum err = glewInit(); 

    if (GLEW_OK != err)
    {
        /* Problem: glewInit failed, something is seriously wrong. */
        fprintf(stderr, "Error: %s\n", glewGetErrorString(err));

    }

    fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

    glEnable(GL_MULTISAMPLE);
    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_DEPTH_TEST);
    glDepthMask(true);
    glDepthFunc(GL_LEQUAL);
    glDepthRange(0.0f, 1.0f);
    glEnable(GL_DEPTH_CLAMP);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glfwSetWindowSizeCallback(Reshape);
}

And this is the render loop for glDrawArrays():

     void Draw(){
            _material->Draw();///activate shader program
            glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(GL_TRIANGLES, 0, 3);

    glDisableVertexAttribArray(0);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
            _material->PostDraw();  //deactivate shader program

   }

As I said , all the buffers and shader programs are initialized ok.
UPDATE:
Ok , I found the answer for the first issue :

Seems like GL_INVALID_ENUM may happen after GlewInit and it is not supposed to screw the rendering.So I am left with the second problem…

UPDATE1:

I found the workaround for GL_INVALID_ENUM when calling glDrawArrays() with VBO.If I pack the VBO into VAO The error disappears and I get the rendering working.Does it mean that in forward compatible core profile we can’t draw using VBO directly?Never seen anything related to it in the official docs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:01:29+00:00Added an answer on June 15, 2026 at 8:01 am

    Vertex array objects are not optional in the core profile. The GL_INVALID_ENUM error is probably coming from somewhere else; you should be getting GL_INVALID_OPERATION. Remember: OpenGL errors are buffered, so you have to keep fetching GL errors until you come back with GL_NO_ERROR.

    glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);

    Please stop doing this. Forward compatibility is virtually meaningless in a core profile.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not getting any anti-aliasing when using drawing GL_TRIANGLE_FANs with this code: glDisable(GL_DEPTH_TEST); //
I am getting this error, and am wondering if anyone has any idea how
Getting ERR_CONNECTION_RESET after more or less 2 minutes of uploading a rather big file
Getting 'Dispatcher has no subscribers' error while trying to post message to a channel
I'm working on getting a simple lighting right on my OpenGL ES iPhone scene.
I am getting into FBOs (Framebuffer Objects) in openGL. Right now, I'm simply trying
I'm currently calling Trace (method below) from a game loop. Right now all I'm
I'm getting a crash in the following code: -(void)EAGLViewNeedsRedraw:(EAGLView *)EAGLView { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
I'm working with some OpenGL code for scientific visualization and I'm having issues getting
I am getting GL function in my code using wglGetProcAddress. The author of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.