2D display issue woes

Started by
5 comments, last by JTippetts 18 years, 8 months ago
I'm using the following code to draw my 2D sprites:


void Object(float width,float height,GLuint texid)				// Draw Object Using Requested Width, Height And Texture
{
     
	glBindTexture(GL_TEXTURE_2D, textures[texid].texID);		// Select The Correct Texture
	glBegin(GL_QUADS);											// Start Drawing A Quad
		glTexCoord2f(0.0f,0.0f); glVertex3f(-width,-height,0.0f);	// Bottom Left
		glTexCoord2f(1.0f,0.0f); glVertex3f( width,-height,0.0f);	// Bottom Right
		glTexCoord2f(1.0f,1.0f); glVertex3f( width, height,0.0f);	// Top Right
		glTexCoord2f(0.0f,1.0f); glVertex3f(-width, height,0.0f);	// Top Left
	glEnd();													// Done Drawing Quad
}


I'm using push/pop glmatrix before/after that. After drawing, I'm using SwapBuffers (window.hDC); The problem is that when I shoot a large sprite across the screen at a decent speed, it only looks like the new frame is half drawn, so that you get a horizontal line going across the middle. Is this a V-Sync issue? Smaller sprites going at slower speeds look fine, its really only a visible issue once the speed picks up. Also, it doesn't seem to matter where I put the delay relative to Drawing and Swapping the buffer, or what I'm forcing the FPS to be. I still see the issue. Thanks.
Advertisement
Sounds like shearing, so yes, enabling Z-sync may fix it, though it'll lock your framerate. The delay between drawing and swapping would have no effect on this; the shear occurs when a refresh hits right in the middle of the back buffer being swapped forward. The primitive has already been drawn into the back buffer.
Quote:Original post by VertexNormal
...enabling Z-sync may fix it...

Z-sync? Some sort of strange Z-buffer tomfoolery?
EDIT: Turning V-sync on by default for OpenGL in my ATI settings fixed the issue, but surely there are other ways around this? If not, like I asked, how do I force it from my program? I've found little on wglSwapInterval(); using Google or searching the GameDev.net forums. Is there a good tutorial on using it?

[Edited by - ScottNCSU on July 26, 2005 12:59:06 AM]
Yes, VX.N ment v-sync, heh

And you cant force it on, you can only request that the driver takes notice of your request, the end user can force v-sync on or off as their discression in the driver control panel and you should never try to force something on them.

And there are no tutorials on that function as its pretty damned simple, the results you turned up should explain things enuff (and if they are on gamedev then I know there is simple code for using it and I've even posted about it a few times with a link to the spec).
I apologize, I was asking the wrong question and I didn't know any better. Yes, using wglSwapInterval(); is easy, but learning how to setup OpenGL extensions is not. I was not aware that I had to have a good understanding of OpenGL extensions to use that function. After a couple hours of learning OpenGL extensions from countless tutorials, my game engine now correctly turns V-sync on/off. And I learned all about shearing/V-sync in the process. Life is good. Thanks for your help.
Mock my tyeping skilz at yuor own risk, minions. Grrr....

This topic is closed to new replies.

Advertisement