"SDL_DisplayFormat" function in SDL-2.0?

Just wondering, what happened to the “SDL_DisplayFormat” function in SDL-2.0? I can’t find a reference to it anywhere in the source and there’s not much mention of its absence on this forum. Is it no longer necessary to call this in SDL-2.0? Has it been replaced by something else?

Please advise, thanks

SDL2 is more focused on GPU-accelerated rendering, so I presume that
SDL_DisplayFormat() would be misleading and have an ambiguous result for
most renderers. You should use SDL_ConvertSurface() as a replacement if
you have a particular surface that you blit to repeatedly.

Jonny DOn Mon, Jul 8, 2013 at 1:51 PM, Greatwolf wrote:

**
Just wondering, what happened to the “SDL_DisplayFormat” function in
SDL-2.0? I can’t find a reference to it anywhere in the source and there’s
not much mention of its absence on this forum. Is it no longer necessary to
call this in SDL-2.0? Has it been replaced by something else?

Please advise, thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Also, I shouldn’t fail to point out that SDL_CreateTextureFromSurface() is
how you prepare for normal (fast) rendering to the screen.

Jonny DOn Tue, Jul 9, 2013 at 10:12 AM, Jonathan Dearborn <@Jonathan_Dearborn>wrote:

SDL2 is more focused on GPU-accelerated rendering, so I presume that
SDL_DisplayFormat() would be misleading and have an ambiguous result for
most renderers. You should use SDL_ConvertSurface() as a replacement if
you have a particular surface that you blit to repeatedly.

Jonny D

On Mon, Jul 8, 2013 at 1:51 PM, Greatwolf <libsdl-greatwolf at spamgourmet.tk wrote:

**
Just wondering, what happened to the “SDL_DisplayFormat” function in
SDL-2.0? I can’t find a reference to it anywhere in the source and there’s
not much mention of its absence on this forum. Is it no longer necessary to
call this in SDL-2.0? Has it been replaced by something else?

Please advise, thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Jonny D wrote:

Also, I shouldn’t fail to point out that SDL_CreateTextureFromSurface() is how you prepare for normal (fast) rendering to the screen.

Ok, so if I’m understanding this correctly, SDL_CreateTextureFromSurface is used only if hwacceleration is enabled since it returns a SDL_Texture*. Is there an analogous function for non-hwaccelerated SDL_Surface* or is this not applicable in SDL-2.0?On Tue, Jul 9, 2013 at 10:12 AM, Jonathan Dearborn <grimfang4 at gmail.com (grimfang4 at gmail.com)> wrote:

SDL2 is more focused on GPU-accelerated rendering, so I presume that SDL_DisplayFormat() would be misleading and have an ambiguous result for most renderers. ?You should use SDL_ConvertSurface() as a replacement if you have a particular surface that you blit to repeatedly.

Let’s say we’re migrating some older SDL-1.2 tutorial to SDL-2.0. How should the SDL_DisplayFormat be translated assuming no gpu-acceleration?

2013/7/9, Greatwolf :

Ok, so if I’m understanding this correctly, SDL_CreateTextureFromSurface
is used only if hwacceleration is enabled since it returns a SDL_Texture*.
Is there an analogous function for non-hwaccelerated SDL_Surface* or is
this not applicable in SDL-2.0?

Textures are tied to renderers, and there’s a software renderer, so
no, textures aren’t specific to hardware acceleration (but you do need
a renderer).

Sik wrote:

Textures are tied to renderers, and there’s a software renderer, so
no, textures aren’t specific to hardware acceleration (but you do need
a renderer).

Ah, I think I see now. The Hardware surfaces section in migration guide is a bit misleading. Somehow it sounded like SDL_Surface* is meant for software render and SDL_Texture* is used for hwaccerlated rendering.

Well by default you’ll get a hardware accelerated renderer, you need
to explicitly request a software one if you want otherwise. The upside
is that renderers now let you not just blit images, but also render
lines and rectangles - something you had to do on your own in the case
of SDL 1.2.

Surfaces are used to hold bitmaps, e.g. for manipulation or stuff like
that. Textures are used with the renderers instead, i.e. for images
you’re going to use to render rather than to edit (though you can
render to a texture).

2013/7/9, Greatwolf :>

Sik wrote:

Textures are tied to renderers, and there’s a software renderer, so
no, textures aren’t specific to hardware acceleration (but you do need
a renderer).

Ah, I think I see now. The Hardware surfaces section in migration guide is a
bit misleading. Somehow it sounded like SDL_Surface* is meant for software
render and SDL_Texture* is used for hwaccerlated rendering.