Page 1 of 2

Win32 and Resolution (solved)

Posted: Sat Jul 08, 2006 1:29 am
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 !!!

Posted: Sat Jul 08, 2006 8:03 am
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? :)

Posted: Sat Jul 08, 2006 8:46 am
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

Posted: Sat Jul 08, 2006 12:11 pm
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 !!!

Posted: Sun Jul 09, 2006 6:52 am
by geekworx
Oh sorry guys ... missed the part about it being in a window. :(

Sorry, can't help you there.

Posted: Sun Jul 09, 2006 1:04 pm
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

Posted: Sun Jul 09, 2006 3:18 pm
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)

Posted: Sun Jul 09, 2006 5:10 pm
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. :(

Posted: Sun Jul 09, 2006 6:27 pm
by hybrid

Posted: Sun Jul 09, 2006 7:48 pm
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 !!!

Posted: Sun Jul 09, 2006 8:51 pm
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.

Posted: Sun Jul 09, 2006 9:43 pm
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 ???

Posted: Sun Jul 09, 2006 10:37 pm
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?

Posted: Sun Jul 09, 2006 10:43 pm
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...

Posted: Mon Jul 10, 2006 12:31 am
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?