Jump to content

  • Log In with Google      Sign In   
  • Create Account

glDrawElements gives me Unhandled exception when closing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 thejelmega   Members   -  Reputation: 122

Like
0Likes
Like

Posted 20 April 2014 - 12:53 PM

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.
 
 


Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 8276

Like
1Likes
Like

Posted 20 April 2014 - 02:52 PM

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.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 thejelmega   Members   -  Reputation: 122

Like
0Likes
Like

Posted 20 April 2014 - 03:01 PM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS