Ingame GUI -> smaller View

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
Bersi
Posts: 53
Joined: Tue Sep 04, 2007 8:23 pm

Ingame GUI -> smaller View

Post by Bersi »

Hi. I have a 3D Scene on the whole screen. Now I wanna add a small GUI (a HUD). If I do so, parts of the scene aren't visible. So the view area of the 3D scene is smaller. What I wanna do now is to fit the whole 3D scene to the smaller area so that the HUD isn't just in front of the scene.


This is how it looks like now:

Image


This it should looks like:

Image


The red border shows how large the size of the 3D scene is.


I tried setViewPort. The problem is, that the GUI is also drawn with thie view port, so it also will be displayed smaller and this isn't what I want.

Thank for help.
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

Well, I didn't test it. it's just a guess.

What about to render the HUD first then set the viewport and render the scene? maybe the other way around if you want to have the HUD on top of all.
Image
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Hey bersi

The reason your GUI is drawn in the viewport is cos you are drawing it there.

Take a look at this example :

Code: Select all

           setViewport(my scene size)
           draw my scene
           setViewport(fullscreen size)
           draw my GUI
This will leave your GUI alone and draw it OVER the scene as well as
having the extra sace on the side to draw it.

I cant really code it exactly for you, but here is a cpp example

Code: Select all

             device->beginscene(..);
             smgr->setViewport(0,0,widthOfViewPort,heightOfViewPort);
             smgr->drawAll();
             smgr->setViewport(0,0,screenX,screenY);
             guienv->drawAll();
Bersi
Posts: 53
Joined: Tue Sep 04, 2007 8:23 pm

Post by Bersi »

Thank you it works. I thought that the viewport should be only set once so I didn't try your solution.
Post Reply