Page 1 of 1

guiFont as customSceneNode appears behind other objects

Posted: Fri Jul 23, 2010 8:26 pm
by bonsalty
I find it quite annoying, that gui font is not a node. Why that?
So I registered it as a customscenenode, so at each rendering

Code: Select all

text->draw(L"bla bla",  core::rect<s32>(x1,y1,x2,y2),
                                        video::SColor(255,255,255,255));


is called. The text disappears behind other 3D objects which are rendered earlier. How do can I bring the sceneNode to front?

Posted: Fri Jul 23, 2010 9:04 pm
by Virion
did you happen to put the gui rendering before sceneManager->drawAll()?

Posted: Fri Jul 23, 2010 11:57 pm
by Acki
bonsalty wrote:I find it quite annoying, that gui font is not a node. Why that?
because it's a gui-draw-function and not a scene element ??? :lol:

why don't you just use a static text !?!?! :shock:

Posted: Sat Jul 24, 2010 9:51 am
by CuteAlien
Try to put 3d-nodes which you want to render after other 3d-nodes in an own scenemanager (ISceneManager::createNewSceneManager). Then clear the z-buffer after rendering the first scenemanager and render the second scenemanager afterwards.

Posted: Sat Jul 24, 2010 12:49 pm
by bonsalty
I solved the problem during the night, I had no time to experiment with irrlicht since I had to finish the work before morning.
StaticText is good, but no resize option -> so BAD
I know that guiFont is not a scene element, just wondering why not.
Why a problem?To make a program adjustable for any drawing option (not predefined), the rendering should do the call for any created objects, so I never put any trash into the rendering loop.

I found an easy alternative solution. Since Im using windows, the best way is to make a HDC and using the texout call of GDI.
Since there are hundreds of fonts in Windows already, no shitty font bitmaps are needed. Then I call the image from memory and make the background color transparent. Thats the best way. Now I can resize, rotate, underline,adjust any fonts etc, without loading and saving those crap bitmapfonts.

Posted: Sat Jul 24, 2010 4:00 pm
by greenya
bonsalty wrote:
StaticText is good, but no resize option -> so BAD
Yes,
but as i remember, there are still couple of options you can choose from:
- recreate static text control
- create with big dimensions (for example all the window resolution), and if you do not use border and background of static text, you set text alignment to top-left and it will draw text all ok
- create normal static text control, but disable clipping, so it will not clip the text when it do not fits the box (but of cause, this option Ok only if you do not use border and background for static text, otherwise result will be bad).

Posted: Sat Jul 24, 2010 4:38 pm
by B@z
bonsalty wrote: Why a problem?To make a program adjustable for any drawing option (not predefined), the rendering should do the call for any created objects, so I never put any trash into the rendering loop.
Isn't calling GDI, and putting out windows text in every loop is putting "trash" into ur rendering loop? x3

and so, be sure u call the font->draw after smgr->drawAll and guienv->drawAll, and it won't go behind the scene. im using it for making user interface in my game too