• Advertisement
Sign in to follow this  

glDrawElements gives me Unhandled exception when closing

This topic is 1373 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody,

 

I have an annoying problem, every time I want to quit my application I get an: Unhandled exception at 0x696F9CCA (nvoglv32.dll) in TJGS Engine.exe: 0xC0000005: Access violation reading location 0x00000000.

 

My OS is windows 8.1, I'm using a nvidia geforce gt650m + I use sfml 2.1 and glew 1.10.0

 

my render code is:

 

void Game::render(sf::Time& time)
{
glClear(GL_COLOR_BUFFER_BIT);
 
glUniform1f(twistLoc, twist);
 
glBindVertexArray(vaoID);
 
glDrawElements(GL_TRIANGLES, 48, GL_UNSIGNED_BYTE, (GLvoid*)0);
 
glBindVertexArray(0);
}
 
 
and my set up code for my vbo and such:
 
glGenVertexArrays(1, &vaoID);
glBindVertexArray(vaoID);
 
glGenBuffers(1, &iboID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iboID);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
 
glGenBuffers(1, &vboID);
glBindBuffer(GL_ARRAY_BUFFER, vboID);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
 
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, vertexSize, 0);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, vertexSize, (void*)rgbaOffset);
glBindVertexArray(0);
 
 
P.S.: sorry if I put my code wrong, I don't know how to do that, I just joined.
 
 

Share this post


Link to post
Share on other sites
Advertisement

That looks as though you're trying to make a draw call after your GL context has been destroyed.  If you put a breakpoint on your glDrawElements call and run it in the debugger you should find what's triggering it pretty quick.

Share this post


Link to post
Share on other sites

Thank you, that was it. It looks like I'm going to make a separate function after I rendered to check if the window should close because it would be annoying if my update is after my render

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement