Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Buffer Objects causes run-time AV

  1. #1
    Intern Newbie
    Join Date
    May 2008
    Posts
    36

    Buffer Objects causes run-time AV

    hi,

    I 've strange issue, any call to buffer objects (e.g. glIsBuffer, glGenBuffers ) causes the access violation. I've glut 3.7.6 and glew -1.5.8 properly installed and required files are placed in the folder ( same as glut folder procedure for glew files ). One more weird thing is ctrl+space invokes the code completion and I can iterate through buffer functions glIsBuffer, glGenBuffers, glBindBuffer, etc... (is that a proof that glew loaded properly?) but codeinsight doesn't give a hint about its arguments after putting the paranthesis "glGenBuffers( ". Seems that I'm refering to unallocated/unitialized objects, but couldn't figured out what and where?

    #
    Code :
    include <GL/glew.h>
    #include <GL/wglew.h>
    #include <GL/glut.h>
     
    #define VERTICES 0
    #define INDICES 1
    #define NUM_BUFFERS 2
    GLuint buffers[NUM_BUFFERS];
     
    void init(void)
    {
    glGenBuffers(NUM_BUFFERS, buffers); // debugger fires AV 
     
    // code omitted here 
    }

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    965

    Re: Buffer Objects causes run-time AV

    Did you remember to call glewInit? And if so, is it after you've created your context?

  3. #3
    Intern Newbie
    Join Date
    May 2008
    Posts
    36

    Re: Buffer Objects causes run-time AV

    No, even if add it, still the same error.
    I played around with putting glewInit on possible places for a while w/o success.

    I'm not literate about glut functionality where it initializes PFD, rendering context etcc.. but I've even tried to put it in "display" function where it should be the last place, still the same error.


    Code is :
    #include <GL/glew.h>
    #include <GL/wglew.h>
    #include <GL/glut.h>

    #define VERTICES 0
    #define INDICES 1
    #define NUM_BUFFERS 2
    GLuint buffers[NUM_BUFFERS];

    void display(void)
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glColor3f(0,0,1);
    glutSolidTeapot(0.5);

    glutSwapBuffers();
    }


    void init(void)
    {
    glewInit();
    glGenBuffers(NUM_BUFFERS, buffers); // debugger fires AV

    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHTING);

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_COLOR_MATERIAL);

    /* Setup the view of the cube. */
    glMatrixMode(GL_PROJECTION);
    gluPerspective( /* field of view in degree */ 40.0,
    /* aspect ratio */ 1.0,
    /* Z near */ 1.0, /* Z far */ 10.0);
    glMatrixMode(GL_MODELVIEW);
    gluLookAt(0.0, 0.0, 5.0, /* eye is at (0,0,5) */
    0.0, 0.0, 0.0, /* center is at (0,0,0) */
    0.0, 1.0, 0.); /* up is in positive Y direction */
    }

    int main(int argc, char **argv)
    {
    glutInit(&amp;argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutCreateWindow("red 3D lighted cube");
    glutInitWindowPosition(300,300);
    glutInitWindowSize(500,500);
    glutDisplayFunc(display);
    init();
    glutMainLoop();
    return 0;
    }

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Buffer Objects causes run-time AV

    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    965

    Re: Buffer Objects causes run-time AV

    Yeah, this. You generally can't just assume that functionality is available on all hardware; you need to check for and confirm it first.

    So at the very least add something like this to your init function:
    Code :
    if (!GLEW_ARB_vertex_buffer_object)
       throwBigScaryErrorFunction ();

  6. #6
    Intern Newbie
    Join Date
    May 2008
    Posts
    36

    Re: Buffer Objects causes run-time AV

    So at the very least add something like this to your init function:

    Code :
    Code:if (!GLEW_ARB_vertex_buffer_object)
       throwBigScaryErrorFunction ();
    It always enters that "throwBigScaryErrorFunction ()", so that means I don't have vertex buffer support in my hardware ?

  7. #7
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,726

    Re: Buffer Objects causes run-time AV

    It always enters that "throwBigScaryErrorFunction ()", so that means I don't have vertex buffer support in my hardware ?
    Now, to be fair, ARB_vertex_buffer_object is not really an extension that needs to be exposed. The functionality has been core since about GL version 1.4 or at least 2.0. It's possible (though not likely) that the core feature should be available.

    That being said, according to the OpenGL extension viewer's database, pretty much everything supports ARB_vertex_buffer_object. Intel chipsets, GeForce 2's, cards that haven't been produced for near on a decade, everything. So more than likely, you're not getting an accelerated rendering context.

    You seem to have needlessly ignored the sage advice V-man gave you in finding out what OpenGL version you're getting. You should find out.

  8. #8
    Intern Newbie
    Join Date
    May 2008
    Posts
    36

    Re: Buffer Objects causes run-time AV

    Thanks in advance,

    version = "1.4.0 - Build 7.14.10.4926"
    vendor = "Intel" (945/m chipset) AFAIR

    I thought that I 've the latest driver installed and latest openGl version.

  9. #9
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: Buffer Objects causes run-time AV

    ARB_Vertex_Buffer_Objects was made core in version 1.5
    I see your GL version is 1.4, so there is a good chance that VBOs are not suppoorted by the h/w.
    Have you actually queries the list of supported extensions by the GL context your self, or have you just relied upon some 3rd party?

  10. #10
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    466

    Re: Buffer Objects causes run-time AV

    I would trust glew here, but if you still have a doubt, check extensions this way (like BionicBytes said):

    Code :
    glGetString(GL_EXTENSIONS);

    If you cannot see GL_ARB_vertex_buffer_object, then definately, it is not supported (at least with this driver).

Posting Permissions

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