SDL Image Rotation?

Started by
6 comments, last by mindrot 17 years, 11 months ago
Is there a way to rotate an image using SDL? I need to rotate an image at certain degrees and store it in an array for later use.
Advertisement
SDL_gfx will do that, although if it's appropiate for you it would be preferable to manually rotate it in an image editing app and just store it.
You mean like use a program to make a single image file with all the rotated images? Why would that be better?
Quote:Original post by Grantyt3
You mean like use a program to make a single image file with all the rotated images? Why would that be better?



because rotating in real time its not a fast task. its better to create an image with all rotated frames, its MORE faster then rotating it with sdl_gfx
Another option would be to use a wrapper for the OpenGL 2d graphics functionality such as Joel Longanecker's hxRender utility to rotate your images in realtime instead of storing them. This method is fast plus saves memory on a 3d capable graphics accelerator.
No, what I was going to do was rotate them when the game first loads and store the images in an array. I would then access the right image from the array when needed later, so I wouldn't be rotating real time.
Quote:Original post by Grantyt3
No, what I was going to do was rotate them when the game first loads and store the images in an array. I would then access the right image from the array when needed later, so I wouldn't be rotating real time.


Sounds like a good idea, however if you are going to store them at loading time anyway why don't you rotate time before hand and save the rotated images on disk? It will save loading time, save coding, and i think the outcome will be better (prettier). If you do need lots of rotating, blending and what not, I would consider switching to SDL with OpenGL or hxrender or something, there it's almost free.
deadX,
although i agree with you for the most part, there would be times you would want to do this real-time. one example that comes into my mind is modifiable textures, avatars, or any player created content. would be a bummer if you impliment a drawing program that allows you to create your own neat hat, and then then it doesnt rotate along with your avatar.

*sorry, thinking old SNES graphics*

This topic is closed to new replies.

Advertisement