Jump to content
  • Advertisement
Sign in to follow this  
Grantyt3

SDL Image Rotation?

This topic is 4604 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

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.

Share this post


Link to post
Share on other sites
Advertisement
You mean like use a program to make a single image file with all the rotated images? Why would that be better?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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*

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!