Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL

Started by athos_musketeer Dec 17, 2002 at 9:51 PM 9 replies 300+ views
Original Post
athos_musketeer
athos_musketeer
is it possible to make an image loaded into an SDL_Surface to rotate, let''s say 30 degrees.. or something like that?
Xanth
Xanth
You mean roatating a bitmap? I haven''t run across anything for rotating bitmaps (I''ve only seen key-frame rotations, with a different bitmap for each stage of the animation). One thought I had, would be to just create a rectangular polygon (two triangles) and then rotate/texture it.

Though, this is coming from limited experience.
"I thought Genius lived in bottles..." - Patrick Star
athos_musketeer
athos_musketeer
i want to rotate a bmp stored in a SL_Surface, using just the SDL api. i don''t want to have the image already rotated in a bmp.
Diodor
Diodor
There isn't any SDL function that can do that out of the box. You can try some libraries (and tell us how they work - I didn't try them):
SDL_rotozoom : http://www.ferzkopp.net/Software/SDL_rotozoom/
SDL_gfx: http://www.ferzkopp.net/Software/SDL_gfx-2.0/

And you can use OpenGL with SDL. I wonder, can standard SDL functions like SDL_BlitSurface work together with OpenGL calls?



Test my game.

[edited by - Diodor on December 17, 2002 11:45:00 PM]
athos_musketeer
athos_musketeer
i was looking for the library you told me (diodor) and There''s one function SDL_Rotozoom() that just does what i want.. but there''s one catch (like always) it take three parameters: the degrees to rotate an scalar to zoom the image an a pointer to an SDL_Surface.. but the function returns other SDL_SUrface with the changes you wanted, plus it makes the surface an 32 bits depth with RGBA..
now i ask one more question .. isn''t that going to be killing for performance?
Diodor
Diodor
Depends. If you use their library to rotate some surface and you store the resulting rotated surfaces and change them into a format you need, you only use their function once, and use regular bits the rest of the time.

But yes, I imagine it would degrade performance a lot if you did this. You can still try and tell us how bad the performance hit is.
athos_musketeer
athos_musketeer
i think i`ll better learn opengl..

i''m still in 2d graphics.. i think it would be a good step doing something i 2d but in opengl
Ronin Magus
Ronin Magus
quote:
Original post by Diodor

And you can use OpenGL with SDL. I wonder, can standard SDL functions like SDL_BlitSurface work together with OpenGL calls?



In a word, No. From my experience, SDL can only be used as a windowing manager when it comes to OpenGL. SDL functions can''t draw to the OpenGL''s rendering context.


"aut viam inveniam aut faciam" - I will either find a way or make one.
Ronin Magus
Ronin Magus
Well, I didn''t know that, and stand corrected!! Thanks.

But, in the SDL documentation for SDL_SetVideoMode, beside SDL_OPENGLBLIT it has this note:

quote:

NOTE: This option is kept for compatibility only, and is not recommended for new code.



But, Bah, we''d all be in the stone age if we did what was recommended


"aut viam inveniam aut faciam" - I will either find a way or make one.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.