Results 1 to 10 of 10

Thread: glGenVertexArrays Access violation Error

  1. #1
    Member Newbie
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    44

    glGenVertexArrays Access violation Error

    Hi guys,
    I've created an application with SFML, GLEW and OpenGL. With SFML I manage the window and I've created an OpenGL 3.2 context. With GLEW I simplify the management of extension, I only call the glewInit() function.
    In my code, when glGenVertexArrays() is called, I obtain an Access violation Error.
    Can someone help me?
    Thanks!

  2. #2
    Member Newbie
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    44

    Re: glGenVertexArrays Access violation Error

    I've added this code:
    Code :
    if(!GLEW_ARB_vertex_array_object)
    	std::cout << "ARB_vertex_array_object not available." << std::endl;
    he told me that the extension is not available, but if I run the programs included with GLEW (glewinfo, visualinfo), I obtain:
    Code :
    GL_ARB_vertex_array_object:                                    OK 
    ---------------------------
      glBindVertexArray:                                           OK
      glDeleteVertexArrays:                                        OK
      glGenVertexArrays:                                           OK
      glIsVertexArray:                                             OK
    I'm a bit confused, where is the problem?
    Thanks.

  3. #3
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: glGenVertexArrays Access violation Error

    Quote Originally Posted by enigmagame
    Hi guys,
    I've created an application with SFML, GLEW and OpenGL. With SFML I manage the window and I've created an OpenGL 3.2 context. With GLEW I simplify the management of extension, I only call the glewInit() function.
    In my code, when glGenVertexArrays() is called, I obtain an Access violation Error.
    Can someone help me?
    Thanks!
    Did you checked that glewInit is called after the opengl rendering context creation? Show us the window and extension setup please.

  4. #4
    Member Newbie
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    44

    Re: glGenVertexArrays Access violation Error

    Quote Originally Posted by dletozeun
    Did you checked that glewInit is called after the opengl rendering context creation? Show us the window and extension setup please.
    Yes, I try to explain my code. This is a simplified version of main function:
    Code :
    int _tmain(int argc, _TCHAR* argv[])
    {
    	sf::ContextSettings contextSettings; 
    	sf::Window app;
    	CGLRenderer* glRenderer = new CGLRenderer();
     
    	contextSettings.MajorVersion = 3;
    	contextSettings.MinorVersion = 2;
     
    	app.Create(sf::VideoMode(800, 600, 32), "", sf::Style::Titlebar, contextSettings);
     
    	glRenderer->init();
     
    	while(app.IsOpened())
    	{
    		glRenderer->draw();
    		app.Display();
    	}
     
    	return 0;
    }
    and the CGLRenderer class:
    Code :
    void CGLRenderer::init()
    {
    	glewInit();
     
    	if(!GLEW_ARB_vertex_array_object)
    		std::cout << "ARB_vertex_array_object not available." << std::endl; 
    }
     
    void CGLRenderer::draw()
    {
    	//Some code...
     
    	glGenVertexArrays(1, &amp;vao);
     
    	//Some code...
    }

  5. #5
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: glGenVertexArrays Access violation Error

    That's look weird indeed. I advise you to look for ARB_vertex_array_object in the gl extension string: glGetString( GL_EXTENSIONS ); See if it still not available. If not, you hardware may simply not support it or you need to update your driver.

    BTW, if your are using the extension, shouldn't it be glGenVertexArraysARB instead of glGenVertexArrays. Are your sure that your gl 3.2 RC is setup correctly? Because I may be wrong since I am not very well experienced with the latest gl specs but, vertex array objects should be part of the core if I am correct. So no need for extensions.

  6. #6
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,673

    Re: glGenVertexArrays Access violation Error

    BTW, if your are using the extension, shouldn't it be glGenVertexArraysARB instead of glGenVertexArrays.
    No. ARB_vertex_array_object is a core ARB extension. As such, its entrypoints and enums do not have an extension suffix. This allows the same code that is written against the extension or the core to work regardless of which is available. GL 2.1 code written against core extensions will magically work with 3.x implementations.

    There are several other core extensions in GL 3.0.

  7. #7
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: glGenVertexArrays Access violation Error

    Quote Originally Posted by Alfonse Reinheart
    ARB_vertex_array_object is a core ARB extension. As such, its entrypoints and enums do not have an extension suffix
    Ok thank you for that clarification, I should just have taken a look the ARB_vertex_array_object specification.

  8. #8
    Member Newbie
    Join Date
    Apr 2008
    Location
    Italy
    Posts
    44

    Re: glGenVertexArrays Access violation Error

    Using this code (on main function):
    Code :
    contextSettings.MajorVersion = 3;
    contextSettings.MinorVersion = 1;
    does not appear any error. I've got a black screen.
    But I'm confused, this function is supported in OpenGL 3.1?
    However, tomorrow, I try with other test.

  9. #9
    Junior Member Newbie
    Join Date
    Oct 2011
    Posts
    1

    Re: glGenVertexArrays Access violation Error

    I had a very similar problem (same symptoms). I'm using GLEW too. The "OpenGL Extensions Viewer" (useful app on the Mac App Store) told me that the extension GL_APPLE_vertex_array_object was available in the compatibility profile, but not in the core profile.. Not sure what to make of that :S

    Anyway, I managed to solve the issue by using the function glGenVertexArraysAPPLE instead (it was defined in GLEW).

    Did you have the same issue for glBindVertexArray?

  10. #10
    V-man
    Guest

    Re: glGenVertexArrays Access violation Error


Similar Threads

  1. glGenVertexArrays access violation
    By 64humans in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-24-2019, 04:29 PM
  2. Access violation error and type error.
    By hsunteik in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-13-2017, 07:16 AM
  3. glutKeyboardFunc() causing Access Violation error
    By weggo in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-17-2010, 09:15 AM
  4. Access violation error, when select an item of menu
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-11-2004, 05:26 PM
  5. Access violation error w/ Red Book code
    By MentalRotation in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-09-2003, 05:02 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