when I resize the window, the graphics ratio will be changed,too. Objects become longer or taller, which I don't want!
I try to drop and recreate the device, than the ratio would be correct.
But recreating device costs too much time and the window would twinkle a lot!
I wonder if there's any way to solve this problem?
resizing irr's window, graphic's ratio will be changed!
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
I tried to account for this by using variables when stating the size of the window and irrlicht device. Although i was putting Irrlicht inside a win32 window to do so.
That was working fine as far as changing the window size and everything looking ok, however, it *really* screwed up the fps camera - you lost control of the camera and it would just move it self upward.
Here's a thread i started in the bug reports section that has a bit of code for the window resizing:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10742
Feel free to try it out and see what happens for you. It won't work correctly, but maybe it can get you on your way (or maybe you can figure out the camera bug!)
That was working fine as far as changing the window size and everything looking ok, however, it *really* screwed up the fps camera - you lost control of the camera and it would just move it self upward.
Here's a thread i started in the bug reports section that has a bit of code for the window resizing:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10742
Feel free to try it out and see what happens for you. It won't work correctly, but maybe it can get you on your way (or maybe you can figure out the camera bug!)
Join us in the Irrlicht chatroom:
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
I find one way:
after resizing the window, just do the following:
this will tell the driver to set the new window's size correctly!!GetClientRect(&rect);
driver->OnResize(irr::core::dimension2d<irr::s32>(rect.right, rect.bottom));
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
This is what I have in my OnSize() function:
As you see, besides calling OnResize(), you must also call setAspectRatio() on the camera node...
Code: Select all
void wxIrrlicht::OnSize(wxSizeEvent& event)
{
s32 w;
s32 h;
GetClientSize(&w, &h);
dimension2d<s32> size(w, h);
m_pDriver->OnResize(size);
if (m_pCameraNode)
m_pCameraNode->setAspectRatio((float)h / (float)w);
}
-
- Posts: 175
- Joined: Wed Dec 20, 2006 12:04 pm
If I am only using GUI provided by irrlicht, not using wxWidget, MFC or other similar stuff, how can I capture this OnSize or OnResize event, so that I can set my camera setting?
Thank you,
Thank you,
mandrav wrote:This is what I have in my OnSize() function:
As you see, besides calling OnResize(), you must also call setAspectRatio() on the camera node...Code: Select all
void wxIrrlicht::OnSize(wxSizeEvent& event) { s32 w; s32 h; GetClientSize(&w, &h); dimension2d<s32> size(w, h); m_pDriver->OnResize(size); if (m_pCameraNode) m_pCameraNode->setAspectRatio((float)h / (float)w); }