Jump to content
  • Advertisement
Sign in to follow this  
ScottNCSU

2D display issue woes

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by VertexNormal
...enabling Z-sync may fix it...

Z-sync? Some sort of strange Z-buffer tomfoolery?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!