Am 11.10.2013 08:39, schrieb michael kapelko:
Hi.
Thanks for the info. I'm now using shaders to process depth:
1) vertex: http://goo.gl/G9ehmB
2) fragment: http://goo.gl/bAutb1
As you see, I'm trying to output depth texture in world space using 'vmi' (view matrix inverse) which I apply later in the 2nd pass.
vmi setup: http://goo.gl/n3A84N
However, when I start the program, it prints 2 errors:
1) Cannot assign between Uniform types dmat4 or mat4 and int
at: uniform->set(osg::Matrix::inverse(pass1LightDepthSRTTCamera->getViewMatrix())); call
The types are not matching. I'm usually doing the same call. Basically you cannot auto pass double matrix to float matrix uniforms.
Try to call it like this:
osg::Matrix MVPT = ( ... );
mStateSet->getOrCreateUniform("vmi", osg::Uniform::FLOAT_MAT4)->set(MVPT);

Also you are setting the matrix only once here. It should be updated in a callback if your light position changes.



2) Warning: detected OpenGL error 'invalid operation' at After Renderer::compile
    at: mat4 modelMatrix = vmi * gl_ModelViewMatrix;

I took the uniform setup code from osgUtil::SceneView: http://goo.gl/6OvdLr
So I really don't understand what I'm doing wrong. Any help?

Thanks.



2013/10/10 Marcel Pursche <[email protected] <mailto:[email protected]>>

    Hi,

    your other buffers use the rectangle format. This texture format
    can be accesed with unormalized coordinates [0, texturesize].
    Regular 2D textures need to be accessed with normalized texture
    coordinates [0, 1].

    Thank you!

    Cheers,
    Marcel

    ------------------
    Read this topic online here:
    http://forum.openscenegraph.org/viewtopic.php?p=56731#56731





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




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

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

Reply via email to