Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm porting a C++ game to Android using the NDK and there's one bottleneck that's really slowing down the code: gluScaleImage().

Does anyone know of a faster way to scale image textures?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Scaling images is computationally expensive (even when you're using heavily optimized code/functions). If you're doing this a lot during runtime, you should probably rethink your design.

If this is just about displaying images with various sizes, why not create a textured quad and scale it to the requested size? The texture could always be the same size then.

share|improve this answer
    
The design isn't mine (it's a port) but I did start replacing calls to the gluScaleImage and the performance is much better. Thanks –  Nick Gotch Mar 31 '11 at 15:48

Not familiar with the android's hardware scaling abilities, but if gluScaleImage() doesn't utilize hardware, you should find something that does. Be aware that your performance will then be hardware-dependent as well as CPU speed-dependent (try to find a friend with an older, slower android device to test). If this doesn't help you may want to cache the rotated graphics. When learning SDL I was surprised to find that the planes in this game have a long sprite sheet with ~16 rotations in an image for each of the two colors of plane.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.