tearing in opengl

My OpenGL application tears. I have no idea how to fix this, I have tried a lot of stuff.
http://www.cplusplus.com/forum/general/38218/ - a thread I put up earlier on the same topic.
Post some code, please.

Single or double buffer?
Do you use GLUT?
How are you calling to the display function?

A timer would work where it calls the draw function 60 times a second, but how do you do that?
maybe use the glutTimerFunc callback
Last edited on
A timer wouldn't really work. Only way to consistently prevent tearing is to VSync.

How to VSync depends on what other interface you're using, as ne555 suggested. Is this GLUT? Or some other windowing lib like SFML/wx/etc?
I'm using the Win32 ways of doing things. this is my render function:
1
2
3
4
5
6
7
8
9
10
inline void render(void) {
	glClear(GL_COLOR_BUFFER_BIT);
	glClearColor(1.0, 1.0, 1.0, 1.0);

	drawCube(0, 0, 0, 4, 0xFF, 0x00, 0x00); // draws a cube (defined earlier)

	gluLookAt(0, 0, -30, 0, 0, 0, 0, 1, 0);

	SwapBuffers(g_HDC);
}
Topic archived. No new replies allowed.