HI Peterakos,

I'm guessing the errors are GLSL errors, and would suggest that the
depth_texture type is inappropriate.  You don't include the whole GLSL
shader so we can't comment further than this.

Robert.

On 20 December 2012 21:18, Peterakos <[email protected]> wrote:

> Hello.
>
> I have a camera which renders to osg::Camera::DEPTH_BUFFER using
> camera->attach(osg::Camera::DEPTH_BUFFER, texture);
>
> Here is how i create the texture:
>     texture->setInternalFormat(GL_DEPTH_COMPONENT);
>     texture->setSourceFormat(GL_DEPTH_COMPONENT);
>     texture->setSourceType(GL_UNSIGNED_BYTE);
>     texture->setShadowComparison(false);
>
>
> My Model draws to this texture in fragment shader using : gl_FragDepth
> = gl_FragCoord.z;
>
> After that i render this texture to a quad in fragment shader using
>     uniform sampler2D depth_texture;
>     void main(){
>           float depth = texture2D(depth_texture, gl_TexCoord[0]).r;
>           gl_FragColor = vec4(depth, depth, depth , 1.0);
>     }
>
>
> The problem is that i get the 2 following errors and i cant figure out
> where the problem is caused.
> error1: 'texture2D' : no matching overloaded function found (using
> implicit conversion)
> error2: 'r' : field selection requires structure , vector or matrix on
> left hand side.
>
> What do i do wrong ?
>
> Any help would much appreciated.
> Thank you for your time.
> _______________________________________________
> 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