DynamicModule Loading Error!!!

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

aymen
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Apr 01, 2009 13:55

Re: DynamicModule Loading Error!!!

Postby aymen » Wed Jul 15, 2009 13:38

Hi CE,

I think it can be integrated with 0.7 as it's not soo hard to do it, I applied manually the patch (http://www.cegui.org.uk/mantis/view.php?id=113) and modified a bit and it works well and I think the idea behind the implementation is good enough to be considered.

if u think it can be useful, I can update the patch for 0.6 and send it.

I try now to browse between list items using just keyboard keys or RC, without mouse, and since the hover color doesnt work with directfb (the blending problem again), I have 2 problems now :( dono if Keith Mok answered you yet, but I think I have to try all possible combination of blending flags till I get some luck and get it work :)

Thank you CE,
Regards

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

Re: DynamicModule Loading Error!!!

Postby CrazyEddie » Thu Jul 16, 2009 09:11

Thanks for the feedback on the patch. I did not look at it yet. It can't be added for 0.7.0 since that's coming too soon and I can't add any more features for that release without pushing the release back even further. Please feel free to post an updated patch to the same ticket on mantis. I will get to it eventually (ask the guys who waited five years for coloured text!)

With regards to emailing Keith Mok, I did not do this yet :oops: I'm not sure where his email address is, I think perhaps it's archived on a backup DVD somewhere, sorry for this - I want to find it so I can see if he is interested to get the trunk / 0.7.0 version working for us.

CE.

aymen
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Apr 01, 2009 13:55

Re: DynamicModule Loading Error!!!

Postby aymen » Wed Jul 22, 2009 16:48

Hi CE,

I updated the patch to mantis, I added some other features like button hover if it get focus, fires event if get Enter hit... it was tested with DirectFB and it works well.

About Keith Mok, I will be really too thankful if you can email him and tell him about the alpha issue as it's bloking me in many ways..and I donno how to solve it. just would like to ask about something, why do we use 4 corners/colors for a quad? OpenGL and directx renderes uses Vertex to map the texture but directfb and IrrlichtRenderer use only one corner to for position and color?

Thanks a lot CE,
Aymen

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

Re: DynamicModule Loading Error!!!

Postby CrazyEddie » Wed Jul 22, 2009 19:40

Thanks for updating the patch, I'll take a look when I have some spare time :lol:

I did some more checking in the DirectFB renderer, reading the docs again, and again, and again :) I did various things including premultiplying the textures and setting some other things, but in the end I pared the changes back a fair bit and ultimately I came up with this:

Code: Select all

Index: RendererModules/directfbRenderer/directfb-renderer.cpp
===================================================================
--- RendererModules/directfbRenderer/directfb-renderer.cpp      (revision 2059)
+++ RendererModules/directfbRenderer/directfb-renderer.cpp      (working copy)
@@ -155,12 +155,10 @@
     b = static_cast<u8>(quad->colours.d_top_left.getBlue() * 255);
     a = static_cast<u8>(quad->colours.d_top_left.getAlpha() * 255);

-    texture->SetColor(texture, r, g, b, a);
-    if(r==255 && g==255 &&  b==255 && a==255) {
-        d_surface->SetBlittingFlags(d_surface, DSBLIT_BLEND_ALPHACHANNEL);
-    } else {
-        d_surface->SetBlittingFlags(d_surface, DSBLIT_BLEND_COLORALPHA);
-    }
+    d_surface->SetColor(d_surface, r, g, b, a);
+    d_surface->SetBlittingFlags(d_surface,
+        (DFBSurfaceBlittingFlags)(DSBLIT_COLORIZE|DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA));
+
     src_rect.x = static_cast<int>(quad->texPosition.d_left);
     src_rect.w = static_cast<int>(quad->texPosition.d_right - quad->texPosition.d_left);
     src_rect.y = static_cast<int>(quad->texPosition.d_top);


Hope it works for you ;)

With regards to the four colour corners, I'm not sure about Irrlicht (I thought that worked with all four colours), I guess it's due to the way these renderers were written to use a more 2D api which only provide for a single colour. I don't really know since I did not write either of those renderers in the current releases.

CE.

aymen
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Apr 01, 2009 13:55

Re: DynamicModule Loading Error!!!

Postby aymen » Thu Jul 23, 2009 17:18

Hi CE,

Really thanks a lot for all what u do and for your support! I really appreciate it :)

YES, it works!! i have the background color now..but still 1 problem, in the Demo7 sample, when I change the alpha with the scroll bar, the windows disappear completely even a minor alpha change..I think there is something wrong about how the renderer get the alpha value...do u have any idea about this issue?

Thanks again,

Regards,
Aymen

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

Re: DynamicModule Loading Error!!!

Postby CrazyEddie » Thu Jul 23, 2009 18:43

Hmmm. This is working fine for me :? I had a slightly changed version originally which only used one or other blending mode and premultiplied textures - it's not ideal, since when the alpha blend is used, the alpha in the texture is ignored in the blend, so 'transparent' things are black. If you want to give that a go instead, the patch is below (patch is from the original code, not the previous patch :P):

Code: Select all

Index: RendererModules/directfbRenderer/directfb-texture.cpp
===================================================================
--- RendererModules/directfbRenderer/directfb-texture.cpp       (revision 2059)
+++ RendererModules/directfbRenderer/directfb-texture.cpp       (working copy)
@@ -141,10 +141,10 @@
                 {
                     for (uint j = 0; j < buffWidth; ++j)
                     {
-                        uchar r = (uchar)(src[j] & 0xFF);
-                        uchar g = (uchar)((src[j] >> 8) & 0xFF);
-                        uchar b = (uchar)((src[j] >> 16)  & 0xFF);
                         uchar a = (uchar)((src[j] >> 24) & 0xFF);
+                        uchar r = (uchar)(src[j] & 0xFF) * (a / 255.0f);
+                        uchar g = (uchar)((src[j] >> 8) & 0xFF) * (a / 255.0f);
+                        uchar b = (uchar)((src[j] >> 16)  & 0xFF) * (a / 255.0f);

                         dst[j] = (((a) << 24) | ((r) << 16) | ((g) << 8)  | (b));
                     }
Index: RendererModules/directfbRenderer/directfb-renderer.cpp
===================================================================
--- RendererModules/directfbRenderer/directfb-renderer.cpp      (revision 2059)
+++ RendererModules/directfbRenderer/directfb-renderer.cpp      (working copy)
@@ -155,11 +155,11 @@
     b = static_cast<u8>(quad->colours.d_top_left.getBlue() * 255);
     a = static_cast<u8>(quad->colours.d_top_left.getAlpha() * 255);

-    texture->SetColor(texture, r, g, b, a);
+    d_surface->SetColor(d_surface, r, g, b, a);
     if(r==255 && g==255 &&  b==255 && a==255) {
-        d_surface->SetBlittingFlags(d_surface, DSBLIT_BLEND_ALPHACHANNEL);
+        d_surface->SetBlittingFlags(d_surface, (DFBSurfaceBlittingFlags)(DSBLIT_COLORIZE|DSBLIT_BLEND_ALPHACHANNEL));
     } else {
-        d_surface->SetBlittingFlags(d_surface, DSBLIT_BLEND_COLORALPHA);
+        d_surface->SetBlittingFlags(d_surface, (DFBSurfaceBlittingFlags)(DSBLIT_COLORIZE|DSBLIT_BLEND_COLORALPHA));
     }
     src_rect.x = static_cast<int>(quad->texPosition.d_left);
     src_rect.w = static_cast<int>(quad->texPosition.d_right - quad->texPosition.d_left);


CE.

aymen
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Apr 01, 2009 13:55

Re: DynamicModule Loading Error!!!

Postby aymen » Wed Aug 12, 2009 11:42

Hi CE,

sorry for late answer, I took a short break :) !! and really Thanks soo much for your help as last patch worked ! still low fps but due to Directfb drivers of my embedded system (that have problem with DSBLIT_COLORIZE|DSBLIT_BLEND_COLORALPHA flags). but once fixed, it should will be ok.

I just detected that cegui uses much of my system's cpu (80-95 %) and was same with Demo6 or Demo7... I commented doRender(&quad) and the StretchBlit(...) just to test, and still have 16% usage, so do you think it's a cache problem or something else? (and I changed DF flags so I dont all is accelerated, no software fallbacks)

Thanks a lot,
Aymen

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

Re: DynamicModule Loading Error!!!

Postby CrazyEddie » Wed Aug 12, 2009 18:20

The thing with the demos is that they will consume as much processor power as what is available (real-world apps would doubtless handle things differently), so in that respect I do not think the demos are a good indicator as to resource usage. Mostly issues with performance in CEGUI are non-cpu related, rather they are GPU related.

I have been completely unable to get performance from DirectFB that comes anywhere near what I get from the other renderers. Typically for OpenGL using 0.6.x code and Demo7 I get somewhere around 1900 FPS, using DirectFB I get about 20 FPS - IIRC even using the Mesa GL software renderer I get better than that!

CE.

aymen
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Apr 01, 2009 13:55

Re: DynamicModule Loading Error!!!

Postby aymen » Thu Aug 13, 2009 08:40

Hi CE,

DirectFB need hardware that accelerate it, and since video cards constructor, often, don't provide drivers from framebuffer, we end to run it with software fallbacks. on my device, it's accelerated and I get 200 FPS for a black screen, 100-50 when using some windows.

Concerning CPU usage, how it's possible to fix it?

>demos are not a good indicator as to resource usage
even other apps, normally they will run like demos arn't they? would you like to explain me a bit more how to avoid it consumes all cpu power availble?

Thank You
Aymen

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

Re: DynamicModule Loading Error!!!

Postby CrazyEddie » Thu Aug 13, 2009 08:55

Basically, don't call System::renderGUI so often. Yes, that's the official advice :) If calling the function 'as often as possible' consumes all the CPU resources (for whatever reason) then to free up those resources you just don't draw so often (aka frame-rate locking). So long as your logic is separate from your rendering this should have minimal overall impact since from a visual point of view the rate is physically locked to the refresh of the display.

WTF! BS you say? How come when the FPS drops to 60 things are less smooth than at 200? This effect obviously is real, but only because in those instances usually the 'logic' side of the app is also affected. The fact is that even at 3000FPS if the monitor is only physically capable of refreshing the display at say 60 or 75 FPS, then it's only smoother because the logic code is running at a higher rate - so in reality actually drawing the imagery for all those other frames is a total waste of time and computing power. Hope that makes at least some sense.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests