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

Thread: Buffer Objects causes run-time AV

  1. #1
    Member 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
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    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
    Member 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
    V-man
    Guest

    Re: Buffer Objects causes run-time AV


  5. #5
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    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
    Member 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 Lord
    Join Date
    Mar 2015
    Posts
    6,674

    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
    Member 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,161

    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
    Senior Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    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).

Page 1 of 2 12 LastLast

Similar Threads

  1. Drawing 2 different objects at the same time...
    By adpward in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-29-2015, 01:07 PM
  2. Objects disappear after intermittent time
    By Talan77 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-11-2014, 04:39 AM
  3. Having 2 objects being controlled and moved at the same time
    By zemprof in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-01-2013, 06:51 AM
  4. Pixel Buffer Objects woes continue, ATI this time.
    By Andrew Cross in forum OpenGL: Windows
    Replies: 2
    Last Post: 10-11-2008, 06:08 PM
  5. depth buffer: far objects bleed through closer objects
    By geohoffman49431 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-15-2004, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean