Win32 and Resolution (solved)

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.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Win32 and Resolution (solved)

Post by Acki »

Hi,
if you start the Win32 demo, the resolution used by Irrlicht is always the desktop resolution !!!

I tried to change the WindowSize creation parameter, but this has no affect when creating Irrlicht with a Win32 device !?!?!

I mean if the window is 100*100 sized and the desktop is 1024*768 the Irrlicht resolution don't have to be 1024*768, too !!!
Also this causes a wrong aspect ratio !!!
A resolution of 100*100 would fit 1:1 !!!
Last edited by Acki on Sun Jul 09, 2006 3:19 pm, edited 1 time in total.
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geekworx
Posts: 15
Joined: Sat Jul 01, 2006 12:10 pm
Location: Pretoria, South Africa
Contact:

Post by geekworx »

So change the code ...

... the line that says something like this:
Irrlicht* device = createDevice(EDT_OPENGL, dimension2d<s32>(1280, 1024), 32, true, false, false,\0);

...change the dimension<s32>(1280, 1024) to you required dimensions (i.e. 200, 200) etc.

Simple hey? :)
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

I´m stupid, or you don´t really understood, what aki wanted... I got the same problems, and would be happy, to find out, how to worj around...
TGM
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

@geekworx: I would be glad if it works this way, but it doesn't... :shock:
Also you can't create Irrlicht in a W32 window this way...

For learning whar I mean, just open the tutorial #14-Win32Window and try different resolutions for the device...
Then draw a 2d line on the screen half the length your screen is wide...

Let's say your desktop is 1024 wide.
You create a W32 window 500 wide.
Then create Irrlicht in the window.
If you draw a line from (0,x) to (500,x), where does it end on the screen ???

Because the Irr screen is 500 and the line is 500, the line should go over the whole Irrlicht screen.
But it ends at the center of the Irr screen, because the intern resolution is 1024 !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geekworx
Posts: 15
Joined: Sat Jul 01, 2006 12:10 pm
Location: Pretoria, South Africa
Contact:

Post by geekworx »

Oh sorry guys ... missed the part about it being in a window. :(

Sorry, can't help you there.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

No problem, it seems nobody can help with this...

Well, I think I'll have to investigate the Irrlicht source for this... ;)

thx
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Just solved the problem !!! 8)

But I had to edit the Irrlicht source for this...
The changes are now also included to my IrrExtensions !!! 8)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
geekworx
Posts: 15
Joined: Sat Jul 01, 2006 12:10 pm
Location: Pretoria, South Africa
Contact:

Post by geekworx »

Can you share the fix in the Code Snippets forum with us.

I am probably going to run into the same thing when I build my map editor for my game. :(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Yes, this is the code section I also changed !!!
But the code in this post doesn't really solve the problem...
Right, with this changes Irrlicht doesn't use the desktop resolution, but the resolution of the window...
Now what if I whant to use another resolution ???
The resolution from the creation parameter still has no affect on the device creation !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Create a child window which is just as large as you need it!
BTW: If you change to GetClientRect note that you have to change the rect dimension values, too, because the client rect stores width and height directly, not the two corners as with getWindowRect.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

This is not my goal !!!
What if the window is resizable !?!?!
No, I want to define the resolution on my own !!!
If I create a window I know it's dimensions and can use this for creating the device, so why should Irrlicht choose what dimensions to use ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The external window creation is thought to use an external handle and skip everything else from the window creation part of Irrlicht. That's why Irrlicht takes the value of the window Irrlicht's going to be embedded into. What would happen if your window is just 300x400 pixels large, but you want 800x600?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

The same as now ?!?!?
I have a desktop of 1024*768 and the win32 window is just 100*100...
Now the Irrlicht creates a device with 1024*768 and scales it down to the 100*100 to fit the window...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, I'd say that a device of 800x600 gives you 800x600 pixels, not internal resolution. So you have to offer Irrlicht the required space for that. You may later on reduce the resolution, but taking it as default might not be a good decision. You cannot change the resolution, either. But maybe it could be a good thing to make two dimensions, something like internal and external, or window size and resolution. I guess that's what is meant?
Post Reply