Sign in to follow this  
thejelmega

glDrawElements gives me Unhandled exception when closing

Recommended Posts

thejelmega    167

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
mhagain    13430

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
thejelmega    167

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this