Note that there are some explanatory texts on larger screens.

plurals
  1. POGL_INVALID_ENUM right after context initialization
    primarykey
    data
    text
    <p>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:</p> <pre><code> 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); } </code></pre> <p>And this is the render loop for glDrawArrays():</p> <pre><code> void Draw(){ _material-&gt;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-&gt;PostDraw(); //deactivate shader program } </code></pre> <p>As I said , all the buffers and shader programs are initialized ok. UPDATE: Ok , I found <a href="https://stackoverflow.com/questions/10857335/opengl-glgeterror-returns-invalid-enum-after-call-to-glewinit?rq=1">the answer</a> for the first issue :</p> <p>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...</p> <h2>UPDATE1:</h2> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload