I have a question about 2D Texturing.
I wrote some objects to manage texturing in the context of a 2D game.
I mostly use glTexImage2D() routine.
Then on newsgroups I just discovered that many programmers heavily use
gluBuild2DMipMaps() as this routine
could indeed resize images which dims are not power of 2.
Actually I already wrote some piece of code to handle textures not
po2, but I suddenly doubt of its efficiency.
Basically I check if the HW does sup****t texture not PO2 using GLEW
lib.
If it does not, I create a texture with size PO2:
example: 284x284 become 512x512.
But I don't rescale my image when I call
I create a 2d Texture with the scaled sizes:
glTexImage2D(..., NULL); // with NULL as image pointer
Then I pass the original image pointer using
glTexSubImage2D(..., image->pixels);
And I store in my tex object the width and height scale factor.
width_factor = image_width / tex_with;
....
When displaying my textured quads, width and height factors arte
applied to tex coordinates.
I indeed never thought about resizing my texture images...I might be
wrong though.
the texture images I'm using are commonly my sprite sheets and I have
several 1280x1024 textures
that's why I experience this NPO2 issue on some machines.
Do you have any suggestion about the way I handle the problem ? Is it
efficient enough ?
Should I use gluBuild2DMiMaps instead ? But in my 2D game I will not
use different level of details for my textures...
Thanks.
Zyend