Jump to content
  • Advertisement
Sign in to follow this  
Tick

OpenGL Graphics glitch on 2nd PC [ortho 2D] [SOLVED]

This topic is 3998 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

Greetings all, I've just tried my little 2D game on the PC of a friend. And there it happened - the graphics don't look like they should! Here is a comparison screenshot: Here At first I thought that it could be that the projection is somehow screwed up. But both PCs create exactly the same Projection Matrix!
        public void SetupProjectionOrtho2D( float width, float height )
        {
            Gl.glMatrixMode( Gl.GL_PROJECTION );
            Gl.glLoadIdentity();

            Gl.glOrtho( 0.0f, width, height, 0.0f, 0.0f, 1.0 );
        }

// used like this:
renderSystem.SetupProjectionOrtho2D( form.ClientSize.Width, form.ClientSize.Height );





Do you have any idea what could happen there? Please say so if you need more code. Oh, and I am using C# with Tao.OpenGL. Thanks alot, Tick [Edited by - Tick on July 14, 2007 11:46:17 AM]

Share this post


Link to post
Share on other sites
Advertisement
From looking at those screenshots, my guess is that it seems to be a texture loading/filtering problem. Could we see some that code? Try messing around with some of the filtering options, ie: set to GL_NEAREST instead of GL_LINEAR or try setting GL_CLAMP_TO_EDGE.

It appears as though all your little textures is stores in one large texture? And then you just alter the coords to display which image you want, right? If this is the case, setting GL_NEAREST will fix that, or using slightly different tex coords.

Hope that helps
~Chris

Share this post


Link to post
Share on other sites
Quote:

It appears as though all your little textures is stores in one large texture? And then you just alter the coords to display which image you want, right?

Exactly. One big texture that contains many little individual sprites, to extract a sprite I use the texture coordinates.


Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR );
Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR );

Gl.glTexImage2D( this.GLTextureType, 0, this.HasAlpha ? 4 : 3,
this.Width, this.Height, 0,
this.GLPixelFormat, Gl.GL_UNSIGNED_BYTE, data );



I'm going to toy around with the min/mag settings and then report back.
So far I got it to work without problems on 2 ATI PCs, not working right on 1 nVidia PC.

Thanks for your help. :)


Share this post


Link to post
Share on other sites
Sorry for the dopple post.

It now works great on both nVidia and ATI GCs using the following settings:

Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST );
Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST );
Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE );
Gl.glTexParameteri( this.GLTextureType, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE );



zix99.rating++; Thanks alot!

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!