[SDL] "layering" surfaces

Scott Harper lareon at comcast.net
Wed Feb 14 20:28:56 PST 2007


> At work, some of our coders use an OpenGL library to "layer"  
> surfaces, and it's easy to use, eg:
>
> surface.setDepth(value)  - zero being at the front
> surface.setVisible(boolean) - guess ;-)
>
> So, with these simple commands (not to mention scaling, rotation,  
> positioning, etc) we can easily display or hide surfaces.

As was already mentioned, you can easily use OpenGL from within SDL.

While nothing exactly like what you're describing exists within SDL,  
I'm sure you could EASILY create a nice structure (containing perhaps  
an SDL surface) which contains information like depth, size,  
rotation, scale, position, etc...  And a simple function which draws  
these surfaces (updating the GL texture associated with each surface  
structure, apply the proper GL transformations, draw using the GL  
commands, etc...).

One could even abstract further drawing commands to use the surfaces  
as arguments rather than drawing to the SDL surfaces within.

Of course, this is all if you want that sort of thing.  I highly  
recommend using OpenGL, however, in all cases.  I'm sure what you  
need wouldn't be very difficult to come up with.

-- Scott


More information about the SDL mailing list