guiFont as customSceneNode appears behind other objects

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

guiFont as customSceneNode appears behind other objects

Post 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?
Tomi
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

did you happen to put the gui rendering before sceneManager->drawAll()?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post 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:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
CuteAlien
Admin
Posts: 9693
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Post 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.
Tomi
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post 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).
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post 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
Image
Image
Post Reply