[osg-users] [Depth Buffer rendering]
Wojciech Lewandowski
lewandowski at ai.com.pl
Fri Jun 13 09:10:39 PDT 2008
Hi Mathieu,
Good ;-).
Regarding your question, I am no sure what can be an issue now. Maybe if I saw your shader it could be simpler ;-)
I will try to guess then.
If you use vertex shader then you need to replicate texgen computations. Once again I recommend "Emulating OpenGL functionality" from OpenGL Shading Language book. This is an excerpt replicating texgen in vertex shader:
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[i].s = dot(ecPosition, gl_EyePlaneS[i]);
gl_TexCoord[i].t = dot(ecPosition, gl_EyePlaneT[i]);
gl_TexCoord[i].p = dot(ecPosition, gl_EyePlaneR[i]);
gl_TexCoord[i].q = dot(ecPosition, gl_EyePlaneQ[i]);
But if you only use fragment shader then maybe the reason is that you use uniform texture2D function but need to use projective texturing ie texture2DProj:
vec4 tex = texture2DProj( depthTexture, gl_TexCoord[i] );
I am leaving for one week. I hope it helps. If not maybe others on this forum will offer some assistance.
Cheers,
Wojtek
----- Original Message -----
From: Mathieu Schoutteten
To: OpenSceneGraph Users
Sent: Friday, June 13, 2008 5:42 PM
Subject: Re: [osg-users] [Depth Buffer rendering]
In fact i've got a new problem (perhaps it's normal), the transformations applied with texgen are not take into account when i use my shader. Do you have any idea of how to proceed ? I attach a screen capture of my problem.
Thanks
On Fri, Jun 13, 2008 at 4:53 PM, Mathieu Schoutteten <matcheu at gmail.com> wrote:
Hi Wojtek,
it works ! thanks a lot for your precious answear.
For those who will be interrested, i'll post later the complete source code with corrections.
------------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080613/f4e26c77/attachment.htm>
More information about the osg-users
mailing list