see
 
http://www.openscenegraph.org/projects/osg/wiki/MailingLists/Submissions
Protocol
 
 

Gordon

__________________________________________________________
Gordon Tomlinson

Product Manager 3D
Email  : gtomlinson @ overwatch.textron.com
__________________________________________________________
(C): (+1) 571-265-2612
(W): (+1) 703-437-7651

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
- Master Tambo Tetsura

 
 

________________________________

From: [email protected]
[mailto:[email protected]] On Behalf Of Cory
Riddell
Sent: Wednesday, February 11, 2009 4:22 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] forcing a square aspect ratio


Nevermind, I found the problem. I was setting the projection matrix on
the camera I added as a slave. Instead, I did this:

  // Realize the Viewer
  _viewer->realize();

  // correct aspect ratio
  double fovy,aspectRatio,z1,z2;
 
_viewer->getCamera()->getProjectionMatrixAsPerspective(fovy,aspectRatio,
z1,z2);
  aspectRatio=double(traits->width)/double(traits->height);
 
_viewer->getCamera()->setProjectionMatrixAsPerspective(fovy,aspectRatio,
z1,z2);

I'd like to update the osgviewerMFC sample app. How would I go about
doing this?

Cory



Cory Riddell wrote: 

        Moji the Great-
        
        I added the code you suggest to my code (and to osgviewerMFC)
and it doesn't do anything.
        
        Is there something you have to do after setting the new aspect
ratio to have it take effect? I was playing around and it didn't seem to
matter what number I plugged in for the aspect ratio, my view always
looked the same.
        
        Cory
        
        
        Mojtaba Fathi wrote: 


Hi
I had the same problem, and I found a solution (but can't remember where
I found it). It's like this:

    // Realize the Viewer
    _viewer->realize();

    // correct aspect ratio
    double fovy,aspectRatio,z1,z2;
    camera->getProjectionMatrixAsPerspective(fovy,aspectRatio,z1,z2);
    aspectRatio=double(traits->width)/double(traits->height);
    camera->setProjectionMatrixAsPerspective(fovy,aspectRatio,z1,z2);

Regards
Moji the Great

--- On Wed, 2/11/09, Cory Riddell <[email protected]>
<mailto:[email protected]>  wrote:


        From: Cory Riddell <[email protected]>
<mailto:[email protected]> 
        Subject: Re: [osg-users] forcing a square aspect ratio
        To: "OpenSceneGraph Users" <[email protected]>
<mailto:[email protected]> 
        Date: Wednesday, February 11, 2009, 12:18 AM
        
        
        FWIW, I've attached a screen shot of what should be a square.
The Drawable code was taken from the quickstart guide and the vertices
are:
            v->push_back(osg::Vec3(-1.f, 0.f, -1.f));
            v->push_back(osg::Vec3(1.f, 0.f, -1.f));
            v->push_back(osg::Vec3(1.f, 0.f, 1.f));
            v->push_back(osg::Vec3(-1.f, 0.f, 1.f));
        Any ideas?
        
         
        
        
        Cory Riddell wrote: 

                I've been playing with osgviewerMFC and I've noticed
that when I open an
                osg file (like cow.osg), the rendering is "stretched" to
fit the aspect
                ratio of the containing window. For example, if I resize
the app to be
                wide then open the cow, I get a very long cow. If I make
the window
                short and tall then open the cow, I get a very
compressed cow. Resizing
                the window does resize the cow, but the aspect ratio
doesn't change.
                
                osgviewerQT doesn't have this problem but I don't see
what's different.
                
                What controls the aspect ratio of the rendering?
                
                BTW, my cow.osg is from 2.6. Has the osg file format
changed?
                
                Cory
                _______________________________________________
                osg-users mailing list
                [email protected]
                
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
                
                  

        _______________________________________________
        osg-users mailing list
        [email protected]
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
                  


                
________________________________


                _______________________________________________
                osg-users mailing list
                [email protected]
                
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
                  

        
________________________________


        _______________________________________________
        osg-users mailing list
        [email protected]
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
          

<<ATT1151188.jpg>>

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to