Newbie
Newbie

Reputation: 1613

Should i always use GL_ARGB format for all textures in OpenGL?

This has been bothering me a while... and it's really hard to really see any difference in performance, so i ask here:

If my images doesnt use alpha channel, should i use 'GL_RGB' for saving them in GFX card memory, or 'GL_ARGB' as if that would be faster in processing since its full 32 bit block?

Or does GFX cards automatically convert 24 bit images into 32 bit images to boost their rendering times?

Edit: I have no performance issues, but i just want to do it the best way! I also want to ensure that the program renders good on old graphics cards that doesnt necessary optimize things as good as new cards.

Upvotes: 3

Views: 2157

Answers (2)

greyfade
greyfade

Reputation: 25657

Choose the formats appropriate for your texture data, and let the video card driver worry about the details. Don't try to outsmart it. OpenGL implementations are quite well-optimized and will make all of the necessary decisions for you for the best performance, whether that means converting all textures to 32bpp or some other internal format.

If you find that you're having performance issues, use a tool like gDEBugger to work out your performance bottlenecks. It's highly unlikely that your texture format is such a bottleneck.

Edit: If the problem is simply memory pressure, then you have too many textures that are too large. Simple as that. Use compression, use lower-quality (fewer bits per channel) textures, or use smaller textures.

Upvotes: 2

Malte Clasen
Malte Clasen

Reputation: 5637

If memory usage is your concern, try texture compression:

It's hard to give general advice which one to use. Try those which are applicable to your texture format (RGB textures don't work with RG compression) and have a good look at the resulting visual quality.

Upvotes: 2

Related Questions