LWJGL Forum

Programming => OpenGL => Topic started by: icyeve on July 03, 2010, 16:12:45

Title: [SOLVED] Textures and glOrtho Problem
Post by: icyeve on July 03, 2010, 16:12:45
Hi there,

I have a little problem with textures and GL11.glOrtho(). As soon as I use GL11.glOrtho the textures are not correct drawn.
Without using GL11.glOrtho it works fine.

What I use:
 * TextureLoader.java and Texture.java from: http://www.cokeandcode.com/node/10
 * More or less the Code from http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicopengl
 * A .png file as Image (tried jpg and gif already, no difference)
 * LWJGL 2.4.2
 * Linux (Ubuntu 9.10)
 * Tested on a Intel onboard Chip and a nVidia GTS 8800

Pictures:
With glOrtho: http://img713.imageshack.us/img713/1097/with.png
Without glOrtho: http://img15.imageshack.us/img15/1708/without.png

Didn't find anything about it with Google BUT I don't even know for what i Have to search...

I hope my English was not too bad :)

EDIT: src as attachment
Title: Re: Textures and glOrtho Problem
Post by: Ciardhubh on July 03, 2010, 18:38:53
There are a few issues:
1) tex coordinates scale from 0 to 1.0 (not pixel size, i.e. 128 as tex coord is wrong) (this is why it's not showing)
2) Getting modes with a frequency of 60 does not work on all platforms (e.g. Linux, see http://lwjgl.org/forum/index.php/topic,3389.0.html)
3) Keep in mind that OpenGL's coord system has its origin bottom left. Using top left can in some cases lead to issues because your polygon winding is now clockwise instead of the default counter-clockwise (e.g. culling). Sure, you can make it work but it's extra work you have to do.
Title: Re: Textures and glOrtho Problem
Post by: icyeve on July 03, 2010, 18:46:19
Ok it works now, thanks for that

And thanks for letting me know about the other two things ;)
Now I find this thread: http://lwjgl.org/forum/index.php/topic,3347.0.html

Oh and do I have to set the Thread to Solved or something like that?