Search code examples
c++openglvisual-studio-2015opengl-3

OpenGL glBufferStorage crashes


Whenever I call glBufferStorage(...) the subsequent glBindBuffer(..) always crashes. Ex:

    glBindBuffer(GL_SHADER_STORAGE_BUFFER, 1);
    glBufferStorage(GL_SHADER_STORAGE_BUFFER, sizeof(unsigned int) * 100, NULL, GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT | GL_MAP_READ_BIT );

    glBindBuffer(GL_SHADER_STORAGE_BUFFER, 2); //  <- CRASH HERE!

If I remove the glBufferStorage(...) call, the subsequent glBindBuffer calls dont crashes!

This code was working normally in my Desktop under a GTX650 Ti and PhenonII x6, with openGl installed via NugeT on VS2015 ( nupengl.core package ). Then I pasted the entire project folder to my Notebook ( GeForce 740M / i7 ), removed the openGl nuget package and reinstalled it.

How can I proceed to investigate what is wrong? Is this logical error or maybe gpu driver error?


Solution

  • I could make it.

    As stated, I moved my project from Desktop to Laptop. My laptop have newer OpenGL support than Desktop, but my Laptop was using the CPU graphics ( Intel HD Graphics ) instead of dedicated GPU GeForce 740M.

    This way, my OpenGL program was executing on a device that not supports some newer OpenGL features, like the GL_SHADER_STORAGE_BUFFER target, and that's why it crashes.