Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How should this code (works in "lenient" 3.3/4.2 profiles) be done in "strict" core?

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Oct 2012
    Posts
    1

    Unhappy How should this code (works in "lenient" 3.3/4.2 profiles) be done in "strict" core?

    OK, this is a cross-post from StackOverflow... but probably is better suited for this forum, hence!

    Back story, I had some 3D code that I noticed wouldn't render in a strict core profile but fine in a "normal" (not explicitly requested-as-core-only) profile context. To isolate the issue, I have written the smallest simplest possible OpenGL program drawing just a triangle and a rectangle:



    I have posted that OpenGL program as a Gist here.

    With the useStrictCoreProfile variable set to false, the program outputs no error messages to the console and draws a quad and a triangle as per the above screenshot, both on an Intel HD OpenGL 3.3 and on a GeForce with OpenGL 4.2.

    However, with useStrictCoreProfile set to true, it clears the background color but does not draw the tri & quad, console output is this:

    Code :
    GLCONN: OpenGL 3.2.0 @ NVIDIA Corporation GeForce GT 640M LE/PCIe/SSE2 (GLSL: 1.50 NVIDIA via Cg compiler)
    LASTERR: OpenGL error at step 'render.VertexAttribPointer()': GL_INVALID_OPERATION
    LASTERR: OpenGL error at step 'render.DrawArrays()': GL_INVALID_OPERATION
    LASTERR: OpenGL error at step 'render.VertexAttribPointer()': GL_INVALID_OPERATION
    LASTERR: OpenGL error at step 'render.DrawArrays()': GL_INVALID_OPERATION
    LASTERR: OpenGL error at step '(post loop)': GL_INVALID_OPERATION
    EXIT

    ... if a 4.2 strict core profile is requested instead of 3.2, same issue. Applies to 3 different nvidia GPUs so I assume I'm not conforming to the strict core profile properly.

    Note, you won't find a glEnableVertexAttribArray call in the above Gist, as it's inside the glutil package I'm importing -- but this does get called as the last step in the gist's compileShaders() func.

    What was I doing wrong, and how can I fix this?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    210
    You must always create and bind a VAO in the core profile, there's no default VAO as it exists in the compatibility profile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •