Massive loop rendering client brush for TLFrameWindow

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
MattR
Just popping in
Just popping in
Posts: 1
Joined: Wed Jan 12, 2005 12:06
Contact:

Massive loop rendering client brush for TLFrameWindow

Postby MattR » Tue Nov 23, 2004 16:41

I'm currently working on a NeLRenderer for CEGUI and I've made pretty good progress. So far as I can tell I have the NeLRenderer and NeLTexture classes doing what they're supposed to do. The loadFromMem part was more difficult than it needed to be, but I also think I got that. All of the logging points to "yes." So to follow up I needed to make a demo to prove it works. Now I don't know if it's my renderer that's the problem or my reimplementation of demo7 using the new renderer but I get stuck in a massive loop at:

Code: Select all

void RenderableImage::draw_impl(const Vector3& position, const Rect& clip_rect) const


in the embedded loop at line 134 (ceguirenderableimage.cpp)

Here is the call trace:

Code: Select all

    CEGUIBase_d.dll!CEGUI::RenderableImage::draw_impl(const CEGUI::Vector3 & position={...}, const CEGUI::Rect & clip_rect={...})  Line 134 + 0xc   C++
    CEGUIBase_d.dll!CEGUI::RenderableElement::draw(const CEGUI::Vector3 & position={...}, const CEGUI::Rect & clip_rect={...})  Line 74 + 0x15   C++
    CEGUITaharezLook_d.dll!CEGUI::TLFrameWindow::drawSelf(float z=0.99900001)  Line 229 + 0x4b   C++
    CEGUIBase_d.dll!CEGUI::Window::render()  Line 1586 + 0x1c   C++
    CEGUIBase_d.dll!CEGUI::Window::render()  Line 1595   C++
    CEGUIBase_d.dll!CEGUI::System::renderGUI()  Line 386   C++


Summarized:
[list:52e2298a06]The demo does all of the loading and initialization (according to the logs this has gone fine.[/list:u:52e2298a06]
[list:52e2298a06]The demo calls System::renderGUI()[/list:u:52e2298a06]
[list:52e2298a06]System::renderGUI() gets the active sheet and calls it's render()[/list:u:52e2298a06]
[list:52e2298a06]The sheet cycles through it's children, the loop actually starts on the first child, and calls their render() methods[/list:u:52e2298a06]
[list:52e2298a06]The first child, a TLFrameWindow, calls it's drawSelf() method[/list:u:52e2298a06]
[list:52e2298a06]The drawSelf determines the rect to render to, and then calls d_clientbrush.draw()[/list:u:52e2298a06]
[list:52e2298a06]This draw() method calls it's draw_impl() method.[/list:u:52e2298a06]
[list:52e2298a06]This method (in CEGUI::RenderableImage) determines the position, scale, and so on based on some flags and the rects passed, and then goes through an embedded for loop to presumably transfer the image to be transferred to a new buffer.[/list:u:52e2298a06]

This last step is where it fails. I located the key problem, but not what causes it to be a problem:

Code: Select all

   // calculate number of times to tile image based of formatting options
   uint horzTiles = (d_horzFormat == HorzTiled) ? (uint)((d_area.getWidth() + (imgSize.d_width - 1)) / imgSize.d_width) : 1;
   uint vertTiles = (d_vertFormat == VertTiled) ? (uint)((d_area.getHeight() + (imgSize.d_height - 1)) / imgSize.d_height) : 1;


Broken out with the real values:
d_area.getWidth() = 0.48750001
d_area.getHeight() = -0.50166667
imgSize.d_width = 0.079999998
imgSize.d_height = 0.10666667

Therefore:
(d_area.getWidth() + (imgSize.d_width - 1)) / imgSize.d_width = -5.4062499941792339
And
(d_area.getHeight() + (imgSize.d_height - 1)) / imgSize.d_height = -13.078124644205682
Once casted to an unsigned int, the break out to:
horzTiles 4294967291 unsigned int
vertTiles 4294967283 unsigned int

So, I'm looping through 4294967291 columns 4294967283 times. I'll let the imagination work out how long that takes.

So first problem is the failure to check for the negative cast, this might be a good check to add to CEGUI. Second is trying to figure out why I'm getting these values and I have to admit that my knowledge of the internals of CEGUI are extremely limited. If anyone has any suggestions or can point out some common oversights, that would be helpful. I'm really floundering for a solution now and have run my options out (hence me posting to the forums.)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests