Skip to main content
GameDev.net gamedev.net
🔒 Locked

OpenGL texture sizes

Started by gowron67 Jun 17, 2002 at 9:09 AM 8 replies 550+ views
Original Post
gowron67
gowron67
Hi everyone...is there any way at all to get around the OpenGL restriction of having to use texture sizes that are a power of 2 ?? I think it has to be possible but I can''t find any information on it anywhere. It can''t be a hardware limitation because you can do it in DirectX. thanks. Gowron67
gowron67
gowron67
I tried that....am I doing the right thing ? Instead of using glEnable(GL_TEXTURE_2D)
I''m using
glEnable(GL_TEXTURE_RECTANGLE_NV)
but all I get is a strange purple colour where the texture should be....what am I doing wrong ?
SporadicFire
SporadicFire
it wont work on non-NVidia cards....its an NVidia extension...
gowron67
gowron67
I do have an NVidia card...........
anyway...is there any other way to get around this problem in OpenGL ? It can''t be impossible other than NVidia extensions surely ???
JuNC
JuNC
The standard answer will be not to worry about it and just pad all your textures out to a power of two (e.g. with black or something). Is there something specific you are trying to do with odd shaped textures? I would say in general it *is* a hardware restriction since it is probably much quicker for textures to be both aligned and sized to powers of 2, DirectX is probably just padding out the textures in the same way.
gowron67
gowron67
yes, what I''m trying to do is take a screenshot.....save it in a texture...split up that texture into lots of quads..and then distort the texture coordinates so i can get a cool swimming warping effect....the problem is when you try to split up an 800*600 screen into smaller sections, you are going to end up with textures that are not powers of 2. I know this must be possible to do because I''ve seen demos of it.
JuNC
JuNC
The easiest way is still to pad the 800x600 image up to the next powers of 2, if you prefer, split the image up first (say into 256x256 blocks) and just pad the textures at the edges.
jasonf
jasonf
i read somehwhere that you can use gl2DTexSubImage to rebuild an odd sized texture into one that is compatible with opengl''s requirements.

you might want to check into that.

it would be usefull if you had a piece of software that allowed people to add their own pictures. that way, they wouldn''t have to know or worry about opengl''s requirements.

Jason FeserCode Geek / Visuals Guyelasticmediaproductionshttp://www.elasticvisuals.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.