Hi,
it sounds like you’re trying to debug graphics, hoping to figure out what’s going on by stepping through your code and look at the output in your window. However, this is not how things work. Your code runs on the CPU and all draw commands are collected and then sent to the GPU. If you step through your code, your window remains blank. You can force the GPU to render by calling gl::flush()
and swapping the front and back buffers manually (I don’t know by heart how to do that) between each draw call, but this is not the right way to do things.
If you’re debugging graphics on an NVIDIA GPU, I would recommend using Nvidia Nsight, NVIDIA Nsight Graphics | NVIDIA Developer . Choose the stand-alone version, not the one for Visual Studio. Build your application’s Release target, then run it from within Nsight. You’ll be able to step through the frame you’re debugging and see precisely what is drawn, in what order, what the state of OpenGL is, etc. There is a little learning curve, but once you get comfortable with it, it will save you countless hours of time.
An alternative to Nsight is Crytek’s
CRYENGINE | RenderDoc , which is also a free debugging tool.
You can add markers to your code that will make it easier to see what’s what. Here’s a Gist with a Marker
class that you can use like this:
void YourApp::draw()
{
tools::ScopedMarker m("Draw");
// do your drawing
}
or
void YourApp::draw()
{
tools::Marker::push("Draw");
// do your drawing
tools::Marker::pop();
}
~Paul