Created
May 18, 2012 08:12
-
-
Save candycode/5d7e4fde9857d87b1bd1 to your computer and use it in GitHub Desktop.
Add osg_Viewport uniform to GLSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/osgUtil/SceneView.cpp | |
=================================================================== | |
--- src/osgUtil/SceneView.cpp (revision 13031) | |
+++ src/osgUtil/SceneView.cpp (working copy) | |
@@ -424,6 +424,11 @@ | |
osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_ViewMatrixInverse",osg::Uniform::FLOAT_MAT4); | |
uniform->set(osg::Matrix::inverse(getViewMatrix())); | |
} | |
+ if( _activeUniforms && getCamera() && getCamera()->getViewport() ) { | |
+ osg::Uniform* uniform = _localStateSet->getOrCreateUniform("osg_Viewport",osg::Uniform::FLOAT_VEC2); | |
+ osg::Viewport* v = getCamera()->getViewport(); | |
+ uniform->set( osg::Vec2( v->width(), v->height() ) ); | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment