I've encountered the same problem, and setting the
context->getState()->setUseModelViewAndProjectionUniforms(true);
for each context didn't work in any case (with a multi-pass offscreen
rendering).
So the simple solution for me was to use the #version 150 compatibility
profile, which let's you access the gl_ matrices the old fashioned way.
Hi,
I'm implementing shaders in GLSL 140+ (i.e. no built-in uniforms), and I've had
reasonably good success thus far. However, it's quite obvious that passing the
vertices in using osg_Vertex doesn't include any transformations which may have
been inherited (or directly applied).
This exact question was asked a few months ago here:
http://forum.openscenegraph.org/viewtopic.php?t=8350&highlight=vertex+transform+shader
In the last post, the user indicates they solved the problem as follows:
"Basically what I've had to do is manually append the view matrix onto each light's
model transformation each frame and that gives the expected transformation."
I'm not sure what he meant, esp. since it made the difference from seeing
nothing to seeing anything at all for him. In my case, I have basic lighting
running perfectly in GLSL 140+ (using uniforms / attributes instead of
built-in's), but if I were to transform the model, the transformation never
shows up in the vertex shader.
It seems apparent that I need to multiply the osg_Vertex vector in my vertex
shader with the model matrix for that geometry (via a uniform updated every
frame, or at least whenever the geometry is transformed). The only function
that I've found that may get the model matrix is getModelMatrix() in the
IntersectionVisitor class.
Any thoughts?
Joel
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43125#43125
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org