Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Pfhorseti

OpenGL OpenGL texture size and texture resource image size

This topic is 5861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I just read that OpenGL can only take 2^n sized textures. Do the width and height of the texture has to be equal too? I have my texture image (resource files on HD) sizes not restricted to 2^n. It's not restricted in anyway, but since OpenGL accepts only 2^n sized textures, should I convert (at run time) to 512x512, 1024x1024, etc, and then pass it to OpenGL to create an OpenGL texture from the original image? If so, what's the best way to do this? My texture image each contains, say several sprites for an animation sequence. And because of the way my texture image is templated, I can't make it 2^n sized. Oh, and I'm using OpenGL for a 2D game. Thanks for the help [edited by - pfhorseti on June 6, 2002 1:54:01 PM]

Share this post


Link to post
Share on other sites
Advertisement
Never mind about converting the image size to 2^n.
Actually I can do this easily, after I read in the image, but before passing it to OpenGL.
After all, do I even need to use OpenGL textures for purpose of storing sprites in memory? Am I supposed to use an off-screen OpenGL context or something?
Kind of confused.

Share this post


Link to post
Share on other sites
The height and width of the textures can be different, as long as they are a power of two. I would also stick to this requirement to avoid future problems.

Regards,
Mathematix.

Share this post


Link to post
Share on other sites
NVidia has an ext that lets you use any size texture... Not sure about ATI...

But if you want to be compatible with more cards, the texture size must be powers of 2. The only problem is if you need to put many sprites or you have to little sprites you will have alot of watsed image space or you can try to retemplate your sprite data differently and optimize it for OGL textures. Or cut down the amount of frames per animations etc...

Share this post


Link to post
Share on other sites
quote:

My texture image each contains, say several sprites for an animation sequence. And because of the way my texture image is templated, I can''t make it 2^n sized. Oh, and I''m using OpenGL for a 2D game.



I really don''t see the reason behind why you can''t use powers of 2
textures. You use texture coordinates to reference the animation cells
from the texture. This means you can put them anywhere on the texture.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!