Building an SDL renderer

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Building an SDL renderer

Postby CrazyEddie » Sun Jan 02, 2005 12:01

Hi,

I don't have much experience with SDL, so am not able to advise on specifics. The approach of having the renderer dependant upon a theme (or themes) is certainly possible, although you would lose a lot of flexabiliy by having such a coupling.

You may be able to use some external stretching routines, there are, I believe, such extensions already available; though I'm not 100% certain about how these integrate with things.

With regards to the forum registration issue; first try deleting your sourceforge.net cookies (especially the one named 'username') and trying the registration again. If it still does not work, email me your requested username, email address, and a temporary password, and I'll set the account up for you manually.

User avatar
pclouds
Just popping in
Just popping in
Posts: 1
Joined: Sat Feb 12, 2005 18:12

Re: Building an SDL renderer

Postby pclouds » Sat Feb 12, 2005 18:15

How's it going? Is there any source to try with SDL renderer?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Building an SDL renderer

Postby CrazyEddie » Sat Feb 12, 2005 20:42

Not specifically, as I have not seen an SDL renderer to test ;)

The important parts of the demos are renderer and OS neutral, so should be fairly simple to translate to another renderer...

The only bits that change are app initialisation and closedown, and the method used to feed inputs into the system. Once the required renderer object and CEGUI::System objects are created, everything else CEGUI related is the same for all renderers.

CE.

User avatar
Valcar
Just popping in
Just popping in
Posts: 2
Joined: Sat Apr 23, 2005 15:54

Re: Building an SDL renderer

Postby Valcar » Sat Apr 23, 2005 16:01

I've spent the past few hours building an SDL renderer to use with CEGUI.


I spent the last two days trying to do the same thing...

After initial issues with getting coordinates as uv 0..1 range I have a basic system working, although I do get a few glitches.


Yep, having this difficulty myself.

There seems to be a lack of a good GUI library for SDL (I know, I spent a week searching for one)


Me too, I was about to give up when someone suggested ceGUI. So I took a look at ceGUI and it appears to be able to do exactly what I wanted. Although there is a severe lack of documentation regarding implementation for a '2d renderer'.

Has anyone already solved these problems whilst writing a renderer for some 2d API and would care to share their notes?


I was hoping that I could get my hands on what you've come up with for the sdl renderer, either submit it or post a link somewhere. I'm sure there are a lot of people interested in this.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Building an SDL renderer

Postby lindquist » Wed Apr 27, 2005 16:39

Hi all.
I thought this sounded like a fun challenge, so I've working on 2D SDL renderer too.

It works pretty well now.

I have two issues that I need solved before this is really useable:

1. the windowslook titlebar does something weird with the right frame image. (my CEGUI has a patch I wrote to fix some scaling issues applied. did I create this bug?)

a screenshot:
Image

but if I move the window so that just 1 pixel or more from the left side is clipped, its fine:
Image



2. theres no support for any colouring. all text is white and all images match the tga's.


Have any of you guys solved any of these issues? as this would push my renderer very much closer to completion

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Building an SDL renderer

Postby lindquist » Wed Apr 27, 2005 16:43

for those interested, here's my renderQuad function:

Code: Select all

// render a quad directly
void SDLRenderer::renderQuad(QuadInfo* quadinfo)
{   
   // is stretching needed?
   if (quadinfo->src.w!=quadinfo->dst.w || quadinfo->src.h!=quadinfo->dst.h)
   {
      SDL_SoftStretch(quadinfo->image,&quadinfo->src, d_shadow,&quadinfo->dst);
      SDL_BlitSurface(d_shadow,&quadinfo->dst,d_screen,&quadinfo->dst);
      return;
   }
   
   // not stretching
   SDL_BlitSurface(quadinfo->image,&quadinfo->src,d_screen,&quadinfo->dst);
}


d_shadow is a sw-surface with the same pixelformat and dimension as the screen.

It's ALOT faster this way. and no alpha-blending-stretch issues :)

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Building an SDL renderer

Postby lindquist » Wed Apr 27, 2005 23:53

ok. I made a gradient filler that also does the multiplicative blending needed for colouring the windows.

It's in fixed point math, but it's slow as hell anyway.
currently a fullscreen (640x480) WindowsLook framewindow drops the framerate to <15 :(

I'm not really sure how improve this. My current gui renderer only supports 0xAARRGGBB pixel formats and writing these gradient fillers, stretchers etc. for all pixelformats seems like way too much work.

especially when you have to resort to asm coding to get the performance bareable.

And even MMX optimization would probably not do any good, since CEGUI imagesets (sub-images) could easily defy mem-alignments.


hmm... does anyone have the solution ??? :roll:

User avatar
florian
Just popping in
Just popping in
Posts: 2
Joined: Tue May 03, 2005 21:23

Re: Building an SDL renderer

Postby florian » Tue May 03, 2005 21:30

This seems to be the best place to ask this question: Are there any usable SDL renderers for CeGUI currently available?

I am currently trying to write a renderer for the CeGUI# port, unfortunately I have zero experience with 3D engines and thus have real problems converting the coordinates, that get passed to the AddQuad function to something usable on a 2D surface.

I was thinking, that maybe looking at the sourcecode of an existing SDL renderer for the original CeGUI could help. Is there such a thing yet? If yes, can anyone point me to a download location?

Thanks in advance,
Florian

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Building an SDL renderer

Postby lindquist » Thu May 05, 2005 12:24

unfortunately. no 2D SDL renderer is working at the moment.
And I actually doubt that there ever will be.

But if you want, you can have my 80% finished renderer.
I won't do anything to it - at least not until I get some feedback here.

There's a little demo app in the zip.
Do whatever you want with the code. I don't care!

User avatar
florian
Just popping in
Just popping in
Posts: 2
Joined: Tue May 03, 2005 21:23

Re: Building an SDL renderer

Postby florian » Sat Jun 18, 2005 07:28

Thanks for posting your code.

Jendave over at cs-sdl.sourceforge.net rewrote my non-functioning version of the renderer for the C#-Version. Seems there were some things that needed to be added to the SDLDotNet Api to get it working. Perhaps he could tell you how he got his version to work.

Flo

User avatar
jendave
Just popping in
Just popping in
Posts: 1
Joined: Wed Jun 22, 2005 07:45

Re: Building an SDL renderer

Postby jendave » Wed Jun 22, 2005 07:53

I took a look at lindquist's version and ported that to C# to get the latest screenshot of CEGUI SDL.NET renderer. The main thing was to create a Stretch method for the Surface. That made things look a lot better. I just got svn access to RealmForge and will be checking in my work so far. I wil l be taking over CEGUI/C# development to some extent over at RealmForge.

jeff2050
Just popping in
Just popping in
Posts: 3
Joined: Tue May 08, 2007 15:28

Re: Building an SDL renderer

Postby jeff2050 » Mon May 21, 2007 13:57

lindquist wrote:unfortunately. no 2D SDL renderer is working at the moment.
And I actually doubt that there ever will be.

But if you want, you can have my 80% finished renderer.
I won't do anything to it - at least not until I get some feedback here.

There's a little demo app in the zip.
Do whatever you want with the code. I don't care!


Where can I get the zip package?

User avatar
fiammy
Just popping in
Just popping in
Posts: 6
Joined: Tue Nov 15, 2005 13:47
Location: Leuven, Belgium
Contact:

Postby fiammy » Tue May 29, 2007 09:46

I would be interested to have a look at the 80% finished renderer, as a template to try to work on an Allegro renderer.
I did some efforts in the past, but I was unsuccesfull. Hence, having a look at a renderer for a similar library might be interesting.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests