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 3 of 3

Thread: help: problem with glGenVertexArrays()

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Jan 2008
    Location
    phobos, mars
    Posts
    75

    help: problem with glGenVertexArrays()

    I just installed a new video card (GTX 680) in my computer (64-bit ubuntu linux v12.04) and installed the latest nvidia driver (v310.19) and updated my GLEW files to v190. I updated my GL and GLX include files from the nvidia driver, and updated my GLEW include and source files from the new GLEW files.

    Now my 3D engine doesn't work. BTW, it did run on the new graphics card before I updated the drivers and GLEW (I'm about 99% sure of that).

    The problem is, the OpenGL function glGenVertexArrays(1, &vaoid) always returns a value of zero no matter how many times I call the function, and no matter how many VAO identifiers I ask the function to generate.

    Does anyone know what this problem is... or might be?

    I cut and paste the section of code where the problem occurs. Note that I just added all those glGetError() calls to debug what's happening. Note that ALL of the glGetError() calls return zero, indicating no errors. However, it seems to me that glGetVertexArrays() returning a value of zero IS an error (at least on its part).

    Note that it does return valid identifiers for the IBO and VBO (values == 1 and 2).

    Note that this error is happening the first time glGetVertexArrays() is being called after my program starts up. Also note that the same problem happens whether I compile the program into a 32-bit executable or a 64-bit executable (both of which ran before).

    My current code is OpenGL v3.20 level. I upgraded my GPU to update my engine to OpenGL and GLSL v4.30 level.

    Hmmmm. During startup I print out a whole pile of xwindows, GLX and GL values, and I notice the following string prints out for glGetString(GL_VERSION):

    2.1.2 NVIDIA 313.09

    What is the 2.1.2 supposed to be? The version of OpenGL? If so, that appears to be a version before the VAO was supported. If so, is there some new call that's now required to specify what version of OpenGL my program intends to access... and maybe it defaults to v2.12 if nothing is specified? (Of course, I don't think there ever was a version 2.12 of OpenGL).

    Also, what is the 313.09 supposed to be? The driver was supposed to be 310.19 on the nvidia website (and that is still the version on their website today, so I don't think v313.09 even exists yet).


    Code :
      u32 vaoie = 0;
      u32 vaoif[4];
      vaoif[0] = 0;
      vaoif[1] = 0;
      vaoif[2] = 0;
      vaoif[3] = 0;
     
      error = glGetError();
      error = glGetError();
      glGenBuffers (1, (GLuint*)&iboid);                 // OpenGL - create IBO identifier
      error = glGetError();
      glGenBuffers (1, (GLuint*)&vboid);                 // OpenGL - create VBO identifier
      error = glGetError();
      glGenVertexArrays (1, (GLuint*)&vaoid);            // OpenGL - create VAO identifier
      error = glGetError();
      glGenVertexArrays (1, (GLuint*)&vaoie);
      error = glGetError();
      glGenVertexArrays (4, (GLuint*)&vaoif[0]);
      error = glGetError();
      if (iboid <= 0) { return (CORE_ERROR_INTERNAL); }  // error - invalid IBO identifier
      if (vboid <= 0) { return (CORE_ERROR_INTERNAL); }  // error - invalid VBO identifier
      if (vaoid <= 0) { return (CORE_ERROR_INTERNAL); }  // error - invalid VAO identifier


    ------------------------------------------------------------------------------
    Last edited by bootstrap; 12-27-2012 at 01:39 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,220
    Quote Originally Posted by bootstrap View Post
    The problem is, the OpenGL function glGenVertexArrays(1, &vaoid) always returns a value of zero no matter how many times I call the function, and no matter how many VAO identifiers I ask the function to generate.
    Sounds like you don't have a valid context or something else is wrong before this call.

    First, you aren't checking for GL errors properly. You're querying for them, but then not doing anything with them. Replace all of your statements calling glGetError with a call to this function (for starters):

    Code cpp:
    void CheckGLErrors()
    {
      GLenum err ;
     
      while ( (err = glGetError()) != GL_NO_ERROR )
        fprintf( stderr, "OpenGL Error: %s\n", gluErrorString ( err ) );
    }

  3. #3
    Intern Contributor
    Join Date
    Jan 2008
    Location
    phobos, mars
    Posts
    75
    I'm almost certain you are correct (the problem is getting OpenGL v4.30 context, not default OpenGL v2.10 context). Therefore, to keep forum messages consistent with their titles, I will start a new thread. Please join me there. Thanks.

Posting Permissions

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