Sign in to follow this  

SDL doubts

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

Hiho Guys!

 

I'm now start to program in SDL. 
And i got a new doubt
Some people use sdL_Surface to handle images in window, and others uses sdl_textures..
What's the diference between the two?
And the diference between renderer and surface to create the background of the window?
 
Thanks Everyone! biggrin.png

Share this post


Link to post
Share on other sites
An SDL_Surface is more like a bitmap in system memory, whereas a SDL_Texture is a handle to an image on the GPU. The renderer in SDL serves to abstract the rendering such that hardware acceleration can be done in OpenGL or DirectX, if available, otherwise it falls back to the software renderer.

At least, that's as far as I know.

Share this post


Link to post
Share on other sites
Yes, you will generally want to use the SDL_Renderer API and SDL_Textures for games these days. SDL_Surfaces are used for loading images from disk, generating images to create textures from, and such. Other than that, there's little reason to use them outside of a few special cases. For example, if I ever felt the desire to work on an old-style raycaster or a custom software 3D renderer, I would likely use the SDL_Surface API.

Share this post


Link to post
Share on other sites

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