Jump to content
  • Advertisement
Sign in to follow this  
LordMyth

glOrtho, textures upside down, on some drivers not? (NOT SOLVED)

This topic is 4943 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 had some code displaying textured quads in glOrtho. I re-did my computer, and now, they showed upside down! So I turned them all so they displayed OK. Problem no is: I sent an example to my friend, and there the textures are displayed correctly, upside-down. (I hope everybody can follow me...) So is it a driver problem or does someone know another solution? [Edited by - LordMyth on January 3, 2005 1:24:00 PM]

Share this post


Link to post
Share on other sites
Advertisement
That is quite odd - I see what you are saying: They appeared upside down to you - so you flip them - but when you give to friends - they are upside down. I do not know why that would be the case. Maybe you should upgrade your drivers. Give that a try first.

Share this post


Link to post
Share on other sites
that's in fact what I don't want...I downloaded older drivers to use instead of the new drivers from nvidia, because those are very bad, especially when you only have an old FX 5200 and an old computer (OK, 700 Mhz Athlon is not that bad but if you play Rome: Total War it is. And in fact RTW crashes with the newest drivers, but not with the old ones). Wait, I'll try quake, I'll see if it displays the textures OK.
edit: yep, they still display OK.

[Edited by - LordMyth on January 2, 2005 4:09:39 AM]

Share this post


Link to post
Share on other sites
ild say its a problem in your code and not the drivers, textures that got flipped somehow from one driver version to the next is a very obvious error that would of gotten picked up (if not we would of heard 20million posts about it before)
check your
texture loading code
how your setting up the ortho frustum
also see if u havent got a scale(1,-1,1) in there somewhere as well

Share this post


Link to post
Share on other sites
I'm not sure how well this applies to OpenGL, but it's recommended for D3D that you don't rely on any default state in the API. If you expect a default state then you should explicitly set it on application startup. It used to be the case that many drivers forgot to initialise certain values when the API was initialised, so you could get varying results depending on the order of doing things and suchlike.

As I say, not sure how that compares to GL drivers, but it's worth keeping in mind sometimes.

Share this post


Link to post
Share on other sites
This is how I set my ortho-mode, before I had it like this: gluOrtho2D(0, WindowWidth, 0, WindowHeight); and with a Scale(1,-1,1);. Textures are loaded with DevIL and I don't think problems could be there.

GLvoid Set2D ( GLvoid ) {
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, WindowWidth, WindowHeight, 0);
glMatrixMode(GL_MODELVIEW);
glFrontFace( GL_CW );
}




[EDIT]What about having the choice to flip the texture matrix?
[EDIT2] This is my window setup code

GLvoid InitWindow( GLuint _width, GLuint _height ) {
WindowWidth = _width; WindowHeight = _height;
//Sets the OpenGL settings
if( SDL_Init(SDL_INIT_VIDEO) <0 ){
Quit();
}
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 32 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 32 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if( SDL_SetVideoMode( _width,_height,32,SDL_OPENGL/*|SDL_FULLSCREEN*/) == 0 ) {
Quit();
}
GLfloat ratio = (GLfloat) _width / (GLfloat) _height;
glShadeModel( GL_SMOOTH );
glEnable(GL_BLEND);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glCullFace( GL_BACK );
glFrontFace( GL_CCW );
glEnable( GL_CULL_FACE );
glClearColor( 0, 0, 0, 0 );
glViewport( 0, 0, _width, _height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
gluPerspective( 60.0, ratio, 1.0, 1024.0 );
}



[Edited by - LordMyth on January 4, 2005 2:35:30 AM]

Share this post


Link to post
Share on other sites
hi
try this
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
before you draw the texture
i hope its work
bye!

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!