Hello Guest

[SOLVED] Textures and glOrtho Problem

  • 2 Replies
[SOLVED] Textures and glOrtho Problem
« 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

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
« Last Edit: July 05, 2010, 06:36:57 by icyeve »

Re: Textures and glOrtho Problem
« Reply #1 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.

Re: Textures and glOrtho Problem
« Reply #2 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?
« Last Edit: July 03, 2010, 18:51:42 by icyeve »