Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > gluBuild2DMipMa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 4836 of 5017
Post > Topic >>

gluBuild2DMipMaps() and Non PO2 Textures

by zyend <karim.atiki@[EMAIL PROTECTED] > Jul 15, 2008 at 12:51 AM

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
 




 6 Posts in Topic:
gluBuild2DMipMaps() and Non PO2 Textures
zyend <karim.atiki@[EM  2008-07-15 00:51:50 
Re: gluBuild2DMipMaps() and Non PO2 Textures
fungus <openglMYSOCKS@  2008-07-15 04:46:25 
Re: gluBuild2DMipMaps() and Non PO2 Textures
zyend <karim.atiki@[EM  2008-07-15 05:04:49 
Re: gluBuild2DMipMaps() and Non PO2 Textures
fungus <openglMYSOCKS@  2008-07-15 08:00:30 
Re: gluBuild2DMipMaps() and Non PO2 Textures
zyend <karim.atiki@[EM  2008-07-15 08:43:53 
Re: gluBuild2DMipMaps() and Non PO2 Textures
fungus <openglMYSOCKS@  2008-07-15 11:22:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 5:45:46 CST 2008.