Sign in to follow this  

pseudo 3d graphics

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

I've just started trying to make psuedo 3d effect. It will hopefully display bitmap images on the screen where your view point would see them from and shrink them relistically to give an effect of distance. I am using SDL to do this, My problem is the shrinking of the bitmaps. I had thought that in SDL_BlitSurface(SDL_Screen, SDL_Rect, SDL_Screen, SDL_Rect) would be able to shrink the bitmaps if I was to change the second SDL_Rect to have a smaller area than the bitmap takes up. I also thought that this could enlarge and stretch an image if the rectangle was larger than the bitmap. It turns out that this does not work. Is there any way to do this without making many different bitmaps? Thanks in advance! -Ezbez

Share this post


Link to post
Share on other sites
In the SDL_gfx library there is a function called SDL_zoomSurface. This will create a surface that is sized to another dimension, which you then in turn can use with SDL_BlitSurface.

NOTE: Don't forget to free the surface after you're done with it. Took me a while to discover I couldn't use it like:
SDL_BlitSurface( SDL_zoomSurface(bitmap), NULL, screen, NULL );

Share this post


Link to post
Share on other sites
Thanks! That should help alot.

Could someone tell what to #include for SDL_gfx?? Just "#include "SDL_gfx" doesn't seem to be working. Oh, I'm using Dev-C++

Share this post


Link to post
Share on other sites
SDL_rotozoom is extremely slow. Take caution when using it. You can see what I mean if you load up my asteroids clone and make it to about level 20 [smile]. As an alternative, I'd suggest using the rotations in OpenGL, or rendering pre-rotated surfaces and saving them in memory.

Share this post


Link to post
Share on other sites

This topic is 4556 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this