Program Freezes with Double Buffering

Started by
6 comments, last by Neutrinohunter 16 years, 1 month ago
I hope this is the right forum for this type of question. Here's my problem: when I use the SwapBuffers() function, my program completely stops responding the moment I press any key on the keyboard, even though I'm not doing any keyboard input handling of any kind yet. If I use glFinish() instead of SwapBuffers() and remove the PFD_DOUBLEBUFFER flag then it works fine, but I'll want double buffering when I start animating. Can anyone think of what might be causing this problem? If there is a specific section of my code that would be helpful for me to post here just let me know. thanks, jjoelson
Advertisement
You should use glFlush when you use single buffering.

I don't know what your code looks like so the best advice I can give is to try other peoples code, like nehe.gamedev.net
If those demoes don't work, then we know your computer has a problem. Maybe you will need to update drivers then.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Good call, I tried out the nehe lesson one code and had the exact same problem. But unfortunately I have absolutely no idea about where I might start in trying to fix this problem.

I'm using dev-C++ with Windows Vista and a NVIDIA GeForce Go7300. Anyone hear about possible compatibility issues with Vista?
There are a lot of compatibility issues with Vista and I'm not just talking about GL. Actually, it's not always Vista's fault but I don't want to get into that.

Start by calling glGetString(GL_VENDOR), GL_RENDERER, GL_VERSION.
VENDOR should be nVidia
RENDERER should be your video card
VERSION should be 2.1
Then see if you can get new drivers from whoever makes your laptop.

I am running Vista with a Gf 8600 laptop. It's ok.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Well I tried the program in Visual C++ 2008 and the problem disappeared. I guess it was something to do with the compiler?

It seems to work fine in this IDE, so I really don't need to find out exactly what the problem was.

Thanks for the help,
jjoelson
It wouldn't be the g++/gcc compiler that you were using would it?

Neutrinohunter
Seems like that was the problem. I don't know what I could do about that though apart from switching to a different compiler (which I did).
Of late, I've had lots of broken pointers and undefined behaviour which can only be attributed to bad compiling, change of compiler to a Visual C++ one is generally the solution or a industrial compiler such as the Intel one.

This topic is closed to new replies.

Advertisement