Change device render size

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
QuantumLeap
Posts: 38
Joined: Mon Sep 25, 2006 6:31 pm
Location: San Francisco, California

Change device render size

Post by QuantumLeap »

I have 3 viewports, two of which are much smaller than the third.

The device is much bigger than the small viewports, but whenever I render them what's actually displayed is a resize of the full version render. This kills my performance and affects the placement of GUI elements!

Is there a way to change the device size (or render the viewport at less resolution) on the fly? Something like

Code: Select all

device->setSize(dimension2d<s32>(x,y)); 
would be awesome.
It's easier to curse a candle than light the darkness
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The device is much bigger than the small viewports
The 'device' is usually the size of the entire Irrlicht application window, and the 'viewport' is the current active render area. The 'viewport' is always inside the 'device' window.
whenever I render them what's actually displayed is a resize of the full version render
If you set the viewport to the bottom right corner of the device window and render the scene, you can expect to see the entire scene rendered to the bottom right corner... If you want to render something else to the 'viewport' other than the entire scene, then you should render that after you've called setViewPort(). If you want to render a different scene, it might be a good idea to create a new scene manager and render that.

I wrote a CGUIViewport class that you should be able to find by doing a search. It allows you to render a scene to a gui window. Each scene can have its scene manager and its own active camera. It can be used to greatly simplify multiple viewport usage.
affects the placement of GUI elements
If you want to render the GUI over the entire device window, you need to set the view area to the entire window before you render the gui.
Is there a way to change the device size (or render the viewport at less resolution) on the fly
That is exactly what a call to setViewPort() does. It changes the size of the render area.
QuantumLeap
Posts: 38
Joined: Mon Sep 25, 2006 6:31 pm
Location: San Francisco, California

Post by QuantumLeap »

Vitek,

First let me sincerely thank you for always finding time to answer to rookies like me. People like you, hybrid, bitplane, acki, spintz and others are the reason why so many newbies keep using Irrlicht and sometimes actually develop interesting projects. Many thanks! And let's not forget Niko.

Now, let me clarify my question, which I think was not well expressed according to your answer:

What I meant is that whenever I place GUI elements on the viewport they also appear resized. For example, I have a viewport with dimensions 200x150 and a .png image with the same dimensions (it's actually a border for the viewport) which I want to overlap there. The result is a shrunk version of the image, as if the viewport were being rendered at the full resolution of the device (which is 1000x600) and therefore the border appears as a tiny rectangle in the top left corner of the viewport. This led me to think, apparently wrongly, that the viewport is actually being rendered at full device resolution and then resized.
So, to summarize, what I really need is a way to make the scale of the GUI elements over the viewports correct
It's easier to curse a candle than light the darkness
Post Reply