Device in fullscreen 16:9

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Device in fullscreen 16:9

Post by Gendo Ikari »

How to make Irrlicht working with 16:9 output?
Steel Style
Posts: 168
Joined: Sun Feb 04, 2007 3:30 pm
Location: France

Post by Steel Style »

It's will work without any modification but if I'm right you're talkin about ratio. So it's simple : camera->setAspectRatio(16.0f/9.0f);
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Post by Gendo Ikari »

When I create device with a different resolution in fullscreen, irrlicht crash.

Code: Select all

dimension2d<s32> tmpRes;
tmpRes.Width=1024;
tmpRes.Height= floor(tmpRes.Width/16*9);
device = createDevice(tmpDriver,tmpRes,tmpBits, true,true,true,&events);
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

just my 2 cent:

Code: Select all

tmpRes.Height= floor(tmpRes.Width/16*9); 
might be equal to:

Code: Select all

tmpRes.Height= floor(tmpRes.Width/ (16*9) );
try

Code: Select all

tmpRes.Height= floor((tmpRes.Width/16)*9); 
or better

Code: Select all

tmpRes.Height= floor((tmpRes.Width*9)/16);
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Post by Gendo Ikari »

All lines have the same meaning. X*Y/Z = (X*Y)/Z = X*(Y/Z) = X*Y*(1/Z).
However thank you, i've tried but same error :D
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Try it with fixed number.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
DeM0nFiRe
Posts: 117
Joined: Thu Oct 16, 2008 11:59 pm

Post by DeM0nFiRe »

Gendo Ikari wrote:All lines have the same meaning. X*Y/Z = (X*Y)/Z = X*(Y/Z) = X*Y*(1/Z).
However thank you, i've tried but same error :D
There is a difference, however, between

X/(Y*Z) and (X/Y)*Z. You want to multiply the width by 9 and then divide it by 16. Because the ration is Width/Height = 16/9. Solve for wight and you get (9 * Width)/16 = Height. I think the order of operations in this case may have made it work out, but it's worth a try, anyway.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I suppose you can only use resolutions which are actually offered by the system. So probably the resolution you try does not exist.

Still it shouldn't crash imho... that sounds wrong. But I can reproduce it on Linux - or well, due to the difficulty of debugging fullscreen I'm not even sure what exactly happens as all I get is a messed up screen and the only way to get rid of it was restarting X *sigh*. Can't do more tests right now due to missing time.

On which system did you test?
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
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

I agree with CuteAlien. You should not try to set a fullscreen resolution that you graphics card does not support. You could either

- use a fixed value (e.g. 640x480) or
- use IrrlichtDevice::getVideoModeList to find out which fullscreen resolutions your graphics card supports

I use the second method and a lot of modes that my notebook supports are unsupported by my desktop.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Post by Gendo Ikari »

Thank you very much, i think this: IrrlichtDevice::getVideoModeList, its foundamental!
I'll test.
My development environment its a WinXp SP3 with Ati 4850, compiled with CodeGear Rad Studio 2009.

EDIT:
But getVideoModeList is a method of IrrlichDevice. So do i need to create device with a standard resolution, than check video mode, and than destroy and create again device?
mk.1
Posts: 76
Joined: Wed Oct 10, 2007 7:37 pm

Post by mk.1 »

There is a "null device"
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Post by Gendo Ikari »

Is a null-device expensive regard memory and cpu?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Gendo Ikari wrote:Is a null-device expensive regard memory and cpu?
It doesn't matter. You just create a null device instance so that you can get the video mode list without creating an Irrlicht window. Once you've got the video mode list, you can destroy the null device and create a D3D or OpenGL device.

Travis
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

@Gendo Ikari: I don't use the NULL device in that place. Before starting my game the user gets a window where he can choose the resolution (and the options for device creation) that is always started with the Software Renderer.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Gendo Ikari
Posts: 19
Joined: Mon Apr 13, 2009 5:42 pm

Post by Gendo Ikari »

Yeah, i've resolved the problem doing this. Now the user can change resolution, and all goes well. Thank you very much.

EDIT:

why this error happen if I drop the null device?


Assertion failed: !(ReferenceCounter <= 0), file (...)\irrlicht-1.5\include\IReferenceCounted.h, line 119
Post Reply