Search code examples
visual-c++openglcrashdeferred-rendering

Crash at draw call in nvoglv32.dll on new video card


Some days ago I set up my computer and installed a new copy of Windows 8 because of some hardware changes. Among others I changed the video card from Radeon HD 7870 to Nvidia GTX 660.

After setting up Visual Studio 11 again, I downloaded my last OpenGL project from Github and rebuilt the whole project. I ran the application out of Visual Studio and it crashed because of nvoglv32.dll.

Unhandled exception at 0x5D9F74E3 (nvoglv32.dll) in Application.exe: 0xC0000005: Access violation reading location 0x00000000.

In the old environment the application worked as expected. I didn't changed anything of the project or source code. The only difference was the language of the Visual Studio installtion which is English now and was German before. Therefore I created a new project and adopted all settings, but the error remains.

In order to locate the crash, I noticed that all initialization (window, shaders, ...) succeeded and the error is at the draw call glDrawElements() which referrs to the gemoetry pass of my deferred renderer.

After some reseach I found out that nvoglv32.dll is from Nvidia and is about a services called Compatible OpenGL ICD. Does that somehow mean that my application runs in a compatible mode? That sounds like a mode to support older applications and I want mine to run in a regular mode! By the way I installed the lastest stable drivers for my video card.

To be honest, I have no clue how to approach fixing this crash. What could cause it and how to fix it?

Update: I found a post on Geforce Forums about my issue. Although there was no reply, the autor could fix the problem by changing the order of two OpenGL calls.

Hi all,

After poking around with my application source code for a few hours, I found that calling the functions...

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, #)
glBindVertexArray(#)

...in that order causes the crash in nvoglv64.dll. Reversing the order of these calls to...

glBindVertexArray(#)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, #)

...prevents the crash and appears to be well-behaved.

Cheers, Robert Graf

Since I do not use vertex arrays I cannot simple do this fix but there might be a similar issue. I will report my progress.

Update: I have absolutely no clue how to solve my problem. I tried different video driver versions but it makes no difference. I completely rewrote the renderer using minimal shaders and simple forward rendering. But the crash sill occurs at the first draw call.


Solution

  • Finally I came up with a solution to fix the crash.

    The SFML framework I use to create the window and more provides a function to reset the OpenGL state of the context. I called it right after window creation.

    Even though I can't explain why, removing that function call solved the crash. Maybe it is because GLEW or something else isn't yet initialized that moment.

    sf::RenderWindow window;
    window.create(VideoMode(1024, 768), "Window Title");
    window.resetGLStates(); // removing this line fixed the crash
    window.setVerticalSyncEnabled(true);