Device resizing

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
anders
Posts: 4
Joined: Tue Nov 07, 2006 9:20 am

Device resizing

Post by anders »

Hi

I'm trying to get a (any) scenegraph library to work well in a control in a .NET/WinForms application. The trouble I'm having to begin with is resizing the device, how do I code to make sure that the device resolution is always the same resolution as the size of the control it renders in? That is, I don't want it stretched to fill!

When I use DirectX directly in my current implementation I just re-create the device any time a resize occurs, but I havent figured out what to tear down and re-initialize in irrlicht to achieve that.

Any suggestions or example code would be appreciated. For example, in the meshviewer application example, how would one change the code to get a (true) resizing rendering rather than a fixed resolution stretched window?

Thanks
/Anders
anders
Posts: 4
Joined: Tue Nov 07, 2006 9:20 am

Post by anders »

I also tried the same resizing thing in Axiom, and found that there was a bug there that prevented a D3D window from resizing correctly.

Interestingly, they had a patch in their patch tracking system which corrects the problem, but it isn't in the released source of Axiom.

http://sourceforge.net/tracker/index.ph ... tid=572529

Does irrlicht have a similar bug or am I missing something? I noticed that irrEdit uses an irrlichtwindow that resizes correctly, but unfortunately there is no source available for irrEdit :(
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

if you look in CCameraSceneNode.cpp, you'll see the code to get the aspect ratio from the width and height of the window (or render target in svn version). I can't remember if it's width/height or height/width, but you just need to set the aspect ratio in the same way when you resize.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
anders
Posts: 4
Joined: Tue Nov 07, 2006 9:20 am

Post by anders »

If you run the MeshViewer.exe example from the irrlicht distribution (choose d3d9) and resize the window, you can see the resize & "resetting d3d device" messages pop up in the log. Clearly it does something more than just stretch the output to fill the window. Also, you can clearly see that the the resolution seems good (the little dwarf is sharp all the time...). I assume this example exe is from the c++ version of the meshviewer.

*but*

if you choose the Example09.cs file, and compile the .NET version of the meshviewer, and then try to resize that window, you will see that the dwarf looks blurry & low-res. The aspect ratio is OK, and the window resizes alright BUT the device doesn't resize/reset.

Is it only my imagination or is resizble=true just not working the same way in the .NET version?
Post Reply