Show
Ignore:
Timestamp:
04/19/11 15:32:25 (4 years ago)
Author:
robert
Message:

From Paul Martz, "To summarize the fix: OpenGL eye coords are negative outside Cartesian quadrant 1. As a result, the center of projection is eye coord (0,0), which (when used as st tex coords) looks up the lower left corner of the texture. However, in projective texturing, you usually want eye coord (0,0) to look up the center of the texture. Accomplishing this mapping requires not just a lookat and perspective transform, but also a translate and scale."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgspotlight/osgspotlight.cpp

    r6941 r12295  
    122122    texgen->setMode(osg::TexGen::EYE_LINEAR); 
    123123    texgen->setPlanesFromMatrix(osg::Matrixd::lookAt(position, position+direction, up)* 
    124                                 osg::Matrixd::perspective(angle,1.0,0.1,100)); 
     124                                osg::Matrixd::perspective(angle,1.0,0.1,100)* 
     125                                osg::Matrixd::translate(1.0,1.0,1.0)* 
     126                                osg::Matrixd::scale(0.5,0.5,0.5)); 
    125127 
    126128