View Full Version : BAD texture mapping troubles! (with "on-screen" sprite render)

09-13-2005, 08:21 AM
I have some big (for me) trouble! Belive or not - it is a question of life and death for me! :(

How can I render a quad with texture with accurate smoothing (may be totally without smoothing... :) ...with 100% scale...)???
That it has as a result turned out also as after glDrawPixels... I need exactly this result, but without this function... I know that is possible! But how?

Anyone hears about GLScene??? It's a visual components lib for working with OpenGL in Delphi... This library have TGLHUDSprite and TGLHUDText components... And TGLHUDText renders texture without smoothing!!! (in 100% scale)

Please! PLEASE!!! PP-LL-EE-AA-SS-EE!!!!
HELP ME!!!! If you can...

09-13-2005, 11:27 PM
Use orthographic projection and draw a quad in the correct size. To make that easier, make the view frustum size match your window resolution. Then you can specify your quad size/position in pixels.

glOrtho(0, width, 0, height, -1, 1);

glTexCoord2i(0, 1)
glVertex2i(0, 0);

glTexCoord2i(1, 1);
glVertex2i(tex_width, 0);

glTexCoord2i(1, 0);
glVertex2i(tex_width, tex_height);

glTexCoord2i(0, 0);
glVertex2i(0, tex_height);

09-13-2005, 11:36 PM
And switch texture filtering to GL_NEAREST for min and mag filter to get the same result as a glDrawPixels.

09-23-2005, 04:06 AM
Yeah... Yeah... glOrtho... Correct size... I know this... But problem was not here! :)

I load a non power of two textures and use gluScaleImage function... And it was wrong! As a result there was a smoothing! It was my own oversight. :rolleyes:

Now I use my own function and enlarge size of texture with adding transparent borders (not scaling). And with that - all forks fine...

Many thanx to everyone who has answered me. :D