I don't know if any experienced man have encounter this problem. But it's really a big one!
When resizing the window, the graphics will be resizing,too!! looks fater or taller.
window's display ratio incorrect when resizing !
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
If any of the experienced users would know he would have posted it to your other thread on the same topic! And they already did So why don't you stop cross posting? If you realized that posting in offtopic has not been the best idea you should've asked the mods to move your thread instead of starting a new one. Or do you think that all those who already answered you will add their posts in here again?
So please contact the forum mods and ask to remove this thread and move the other one (maybe all three you posted in offtopic) to this forum or maybe the beginner's one.
Doh
So please contact the forum mods and ask to remove this thread and move the other one (maybe all three you posted in offtopic) to this forum or maybe the beginner's one.
Doh
-
- Posts: 230
- Joined: Mon Oct 10, 2005 2:24 am
resize constraints
codeguru has alot of good code
here is on on resizing
http://www.codeguru.com/cpp/w-d/dislog/ ... php/c4983/
here is on on resizing
http://www.codeguru.com/cpp/w-d/dislog/ ... php/c4983/
Aspect Ratio
If you set the aspect ratio for your camera with setAspectRatio, use height/width insetad of width/height. I'm not sure why anybody would calculate aspect ratio like that, but it's probably a feature
Michael
Michael
Re: window's display ratio incorrect when resizing !
Here's how I did it:michael520 wrote:I don't know if any experienced man have encounter this problem. But it's really a big one!
When resizing the window, the graphics will be resizing,too!! looks fater or taller.
Code: Select all
void CSceneManager::UpdateViewportAspect(UINT sx, UINT sy)
{
if ( m_pCamera )
{
//. When the viewport is 440 pixels tall, we want a FOV of 70 degrees
const float kfBaseFOVdeg = 70.0f;
const float kfBaseHeight = 440.0f;
const float kfBaseFOV = irr::core::PI * 360.0f / kfBaseFOVdeg;
float fBaseRatio = fabs( tan( kfBaseFOV ) / kfBaseHeight );
float aspect = (float)sx / sy;
float fov = atan( fBaseRatio * sy ) * 2.0f;
m_pCamera->setAspectRatio( aspect );
m_pCamera->setFOV( fov );
}
}
Oops, nearly forgot, for this to work, you'll need the projection matrix fix, described here:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=12426
[edit: matrix fix]
Harvey Gilpin, code monkey