sdl@lists.libsdl.org
[Top] [All Lists]

[SDL] Trying to grasp new rendering model

Subject: [SDL] Trying to grasp new rendering model
From: Stefan Klug
Date: Tue, 10 Feb 2009 12:19:45 +0100
Hi,

I'm currently trying to get into the details of the new rendering model. I haven't found any documentation of the details except the code. If there is some documentation please redirect me and I'll try to solve the questions myself.

Here is a summery of how I understand SDL 1.3 right now:
1. layer: The video driver.
- Allows you to handle windows (create/move/delete them, also create fullscreen ones) - Allows to create textures in a desired pixel format which are possibly managed by hardware under the hood

2. layer: The Renderer, manages the hardware abstraction. In the Win32 case, currently GDI and D3D are available.


I'm trying to adopt the GAPI code to this new model, and the following questions came up:
- In SDL_compat I found the following code:

/* Create a texture for the screen surface */
SDL_VideoTexture = SDL_CreateTexture(desired_format, SDL_TEXTUREACCESS_STREAMING, width, height);

How do you know that this returns the the ScreenSurface? Isn't a texture an arbitrary image, handled by the renderer, but not necessarily connected to the Screen (analog to a open gl texture)?

- There are the renderers GL/GLES/SW which are not directly connected with a video driver. How are they used? Can I create a Win32 video driver utilizing the GL renderer?

- As GAPI basically only gives access to video memory, I am looking for a way to use existing software rendering code paths. So all boils down to the question, how to create a renderer which uses the texture handling of SDL_renderer_sw, and provides a single texture which maps to the Screens video memory?

I think my biggest problem is, that I don't see the connection between a SDL_texture and the pixel buffer of the Screen/Window. I also don't understand the difference between a SDL_Texture and a SDL_Surface. Is a texture just a potentially hw accelerated surface?

I would be really happy if someone could shed some light on this.

Thanks a lot
Stefan



_______________________________________________
SDL mailing list
SDL@xxxxxxxxxxxxxxxx
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

<Prev in Thread] Current Thread [Next in Thread>