Idea: Render targets

From looking through the code, it appears that:

1.) SDL_Window IDs and SDL_Texture IDs are allocated from the
same counter.
2.) SDL_Window and SDL_Texture both have a Renderer attached.
3.) However, calling SDL_SelectRenderer on a texture ID will fail.

It would sure be nice to be able to create a render target, a special
type of texture that you can render onto like a window, but which
isn’t a window and doesn’t get displayed onscreen.

I know you can do this with surfaces, but then the surface has to
be converted to a texture (which is slow, and not something I’d
like to have to do every frame!) before it can be render-copied
onto the window.

How difficult would it be to do something like that? Back in
1.2 it was simple: just define your render targets as surfaces,
and that worked fine because the window was a surface too.
Now that windows are different, I’m having trouble getting some
of my old code to work.

It looks like this is at least in the planning stages!

Answer: not terribly hard. Maybe someone will add it. (Maybe I will add it…)On Fri, Apr 10, 2009 at 4:17 PM, Mason Wheeler wrote:

From looking through the code, it appears that:

1.) SDL_Window IDs and SDL_Texture IDs are allocated from the
same counter.
2.) SDL_Window and SDL_Texture both have a Renderer attached.
3.) However, calling SDL_SelectRenderer on a texture ID will fail.

It would sure be nice to be able to create a render target, a special
type of texture that you can render onto like a window, but which
isn’t a window and doesn’t get displayed onscreen.


http://codebad.com/

It looks like this is at least in the planning stages!

Answer: not terribly hard. Maybe someone will add it. (Maybe I will add it…)

Cool! I know D3D has built-in support for render targets, and OpenGL
does too, though it calls it something different. (Framebuffer-attached
objects or something weird like that. Why they couldn’t just call them
"render targets" is beyond me.) For other drivers that don’t have
support for it, you could probably fake it by just making them whatever
textures are made of on that driver’s system.>----- Original Message ----

From: Donny Viszneki <donny.viszneki at gmail.com>
Subject: Re: [SDL] Idea: Render targets

Cool! ?I know D3D has built-in support for render targets, and OpenGL
does too, though it calls it something different. ?(Framebuffer-attached
objects or something weird like that. Why they couldn’t just call them
"render targets" is beyond me.)

There was probably more than one competing proposal to satisfy what
you call “render targets.” Direct3D is just whatever Microsoft
dictates it to be. OpenGL has input from many sources.

?For other drivers that don’t have
support for it, you could probably fake it by just making them whatever
textures are made of on that driver’s system.

Are you certain it doesn’t already work on those video drivers?On Fri, Apr 10, 2009 at 4:31 PM, Mason Wheeler wrote:


http://codebad.com/

Uh, anyhow the approach you’re thinking of is “pixel buffer object” probably.On Fri, Apr 10, 2009 at 5:30 PM, Donny Viszneki <@Donny_Viszneki> wrote:

On Fri, Apr 10, 2009 at 4:31 PM, Mason Wheeler wrote:

Cool! ?I know D3D has built-in support for render targets, and OpenGL
does too, though it calls it something different. ?(Framebuffer-attached
objects or something weird like that. Why they couldn’t just call them
"render targets" is beyond me.)

There was probably more than one competing proposal to satisfy what
you call “render targets.” Direct3D is just whatever Microsoft
dictates it to be. OpenGL has input from many sources.


http://codebad.com/

For other drivers that don’t have
support for it, you could probably fake it by just making them whatever
textures are made of on that driver’s system.

Are you certain it doesn’t already work on those video drivers?

I’m about as certain as I can be just from reading the code that you can’t
currently render onto a texture like you can on a window on any SDL
video driver. I might have missed something, though…>----- Original Message ----

From: Donny Viszneki <donny.viszneki at gmail.com>
Subject: Re: [SDL] Idea: Render targets