Page 1 of 1

CEGUI In DDraw(Window's semi-transparent)

Posted: Sun Aug 23, 2009 12:31
by singbol
I've Finished the DDrawRenderer and DDrawTexture class,and I at last come to get that the alpha blend in do render is alpha from image, which I mean make the image in the imageset be transparent.
My real problem is that I set the alpha value of specified window(like FrameWindow),it doesn't make the FrameWindow Semi-Transparent.
Guys,help me!!!

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Mon Aug 24, 2009 09:21
by CrazyEddie
Why did you feel the need to basically post the same thing twice, seven hours apart? What exactly was going through your mind at the time? What did you believe would be the outcome of such an action? What was your reasoning for doing this?

I ask these questions to try and understand the mentality of people who do this, because to be quite honest, it baffles me. We are not a forum with heavy traffic - it's especially quiet over weekends - so the chances of your original post getting 'pushed down' are virtually zero. In addition it was clear to see that at the time of your second copy of the post, there had been no answers to any posts since the Thursday, doesn't this give a hint that - no your original post had not been 'missed' - we just were not around on the forum to answer anybodies posts, so posting again serves no purpose what so ever.

I have to reiterate, this kind of behaviour is just completely beyond my comprehension. It makes no sense to me at all. I'd like somebody to explain this, because I am at a loss.

CE.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Mon Aug 24, 2009 16:08
by Jamarr
:lol:

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Tue Aug 25, 2009 06:56
by singbol
I'm sorry for this stupid work.~So sorry.
:(

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Tue Aug 25, 2009 09:11
by CrazyEddie
To try to address the question: I don't think direct draw offers the functionality required to achieve this, although I can't be 100% certain - it's quite a few years since I used this API.

CE.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Thu Aug 27, 2009 09:58
by singbol
thank you for your reply, I've finished this hard work for me~I implemented the alpha blend by lines of codes, directdraw have no support for alpha channel(I think)~~~~~
I main simulated the directfbRenderer, and at last, this can be used in other ddraw application just pass the DDrawRenderer 2 parameters:IDirectDraw7* and IDirectDrawSurface7*(backsurface),but how can I use it by pass it
IDirectDraw* and IDirectDrawSurface*, I've no idea!
thanks again and sorry for my foolish action!

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Fri Aug 28, 2009 08:43
by CrazyEddie
It's good that you - I think - have something working.

but how can I use it by pass it IDirectDraw* and IDirectDrawSurface*, I've no idea!

Is that a question? If so could you rephrase it since I don't think I understand. As far as I recall there is no generic IDirectDraw*; I believe it's always suffixed by the interface number.

CE.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Fri Aug 28, 2009 09:10
by singbol
yes,there's IDirectDraw*,the 1st version.

I can't use my bad DDrawRenderer class in another app.and it corrupt when loadScheme(not enough quota).
If there's a chance, I send the DDrawRenderer and DDrawTexture to you?but maybe there's no need to you.
If you have some extra time, I'll trouble you to help me with these stuff.

and there's the CEGUI.log:

Code: Select all

28/08/2009 17:45:25 (Std)    ---- Version 0.6.2 ----
28/08/2009 17:45:25 (Std)    ---- Renderer module is: CEGUI::DirectDraw7Renderer - DDraw based renderer module for CEGUI ----
28/08/2009 17:45:25 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
28/08/2009 17:45:25 (Std)    ---- Scripting module is: None ----
28/08/2009 17:45:25 (Std)    Attempting to load Scheme from file 'TaharezLook.scheme'.
28/08/2009 17:45:25 (Std)    Attempting to create an Imageset from the information specified in file 'TaharezLook.imageset'.
28/08/2009 17:45:25 (Std)    Started creation of Imageset from XML specification:
28/08/2009 17:45:25 (Std)    ---- CEGUI Imageset name: TaharezLook
28/08/2009 17:45:25 (Std)    ---- Source texture file: TaharezLook.tga in resource group: (Default)
28/08/2009 17:45:25 (Std)    Attempting to create Font from the information specified in file 'simhei.font'.
28/08/2009 17:45:25 (Std)    Started creation of FreeType Font:
28/08/2009 17:45:25 (Std)    ---- CEGUI font name: simhei
28/08/2009 17:45:25 (Std)    ----     Source file: simhei.ttf in resource group: (Default)
28/08/2009 17:45:25 (Std)    ---- Real point size: 8
28/08/2009 17:45:26 (Std)    Succsessfully loaded 22060 glyphs
28/08/2009 17:45:26 (Std)    ===== Falagard 'root' element: look and feel parsing begins =====
28/08/2009 17:45:26 (Std)    ===== Look and feel parsing completed =====
28/08/2009 17:45:26 (Error)   CEGUI::GenericException in file ..\..\..\src\CEGUIDynamicModule.cpp(99) : DynamicModule::DynamicModule - Failed to load module 'CEGUIFalagardWRBase': Invalid access to memory location.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Fri Aug 28, 2009 10:49
by CrazyEddie
I looked at the ddraw header, apparently you can define the DIRECTDRAW_VERSION macro to some earlier version to get compatibility with the earlier releases - so that may allow you to use the IDirectDraw* instead of the IDirectDraw7*, I don't know though - I did not try this out or anything.

I've never previously seen those errors mentioned - either the "not enough quota" nor the "Invalid access to memory location." - and not just in CEGUI, I mean never, ever!

When you say you can't use your renderer "in another app", that's confusing. What app does it work in? The CEGUI Demos, perhaps?

I don't have any spare time at all(!) Though if you do send anything to me, send just the source code (no binary stuff), and I do not promise anything (for instance, I'll probably not look at it until Monday, at the earliest).

CE.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Fri Aug 28, 2009 11:49
by singbol
thank you very much~~~~

another app comes because I tried to test the DDrawRenderer by writing a Win32 App whose rendering module is ddraw,
and it performs very well! now I want to inject this CEGUI(using DDrawRenderer) to a game(not writing by myself), it didn't run.~~~

whatever, I just send you the source code~~~and wish your improvement on them!

again, My Poor English!I can't express myself clearly! :(

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Sun Aug 30, 2009 08:49
by CrazyEddie
Ok, I'll look over the files in a day or so and get back to you ;)

CE

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Mon Aug 31, 2009 01:21
by singbol
thank you and sorry for taking up your precious time~~~~~ :)

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Mon Aug 31, 2009 16:35
by CrazyEddie
I've spent a while playing about with this, and will make a few comments and observations.

* Firstly, with regard to the injecting of CEGUI into existing apps, I know nothing about this at all; it's clearly hackish (which is fine, nobody likes a good hack more than me!) so results are always going to vary wildly. I guess you should get advise from the creator of the injection system.

* I imagine the issues with the module failing to load with that 'quota' error is tied to the above (if everything worked in a separate app, it must be).

* With regards to making it work with the earliest DDraw version, I got it to compile ok, though my 'flip' function (running in windowed mode) always failed with DDERR_SURFACEBUSY.

With regards to the code itself:
* In the function "DirectDraw7Renderer::doRender(void)" you're clearing the target surface every time (and doing it the hard way, too - why not Blt with DDBLT_COLORFILL?). If you're intending that surface to have been previously drawn to, you surely do not want to be doing this. If you're 'caching' the GUI output to a separate offscreen surface, then that's a different matter.

* You may like to dispense with the 'z' coordinate and the sorting of quads. This is generally not required, unless you're employing a hack to manipulate imagery layering, so can save some cycles.

* Some of the preparation work, such as the setup of the source and dest rects and the colour value, in "DirectDraw7Renderer::doRender(RenderQuad *quad)" could be saved by storing that info precalculated in the RenderQuad structs you queue (ideally you should fill that structure with as close to the final data as possible in queueQuad, rather than recalculating it every rendering pass through the quad list). I know we're using similar techniques in the 0.6.x code, but it's totally wasteful and should have been fixed years ago.

* Ok. The BIG issue. While obviously to get the required blending, you're having to perform the blit operations manually on the processor, the issue is that I can't ever see you getting acceptable performance by doing this (I got between 10 and 11 FPS running the FirstWindow sample from CEGUI). I played about with various things here, but was unable to get any acceptable results from the accelerated functions. I don't know what to suggest as far as this goes and clearly this is the key issue (I have suggestions partly because I've forgotten most of what I ever knew about DDraw - I really struggled to get anything working at all :lol:).

CE.

Re: CEGUI In DDraw(Window's semi-transparent)

Posted: Tue Sep 01, 2009 12:07
by singbol
Thanks for your advice.
The speed of the rendering can be improved by creating the "systemmemory" surface, which performs some good.
I'll take your advice and try to modify it by myself, under your great help!
Thanks again, no more words since I can't say any more by myself.~~aha~~ :)