Re: [osg-users] projective texturing

2009-07-02 Thread Großer Martin
Hello, I have the answer of my question. My mistake was that the lines... gl_TexCoord[1].s = gl_TexCoord[1].s / gl_TexCoord[1].q / 2 + 0.5; gl_TexCoord[1].t = gl_TexCoord[1].t / gl_TexCoord[1].q / 2 + 0.5; ...musst into the fragment shader. Cheers, Martin Am Donnerstag, den 02.07.2009, 15:19

[osg-users] projective texturing

2009-07-02 Thread Großer Martin
Hello, I try "projective texturing" and I didn't use the TexGen. Also I use a shader. And in the vertex shader I do this: gl_TexCoord[1] = ( projMat * viewMat * gl_Vertex ); gl_TexCoord[1].s = gl_TexCoord[1].s / gl_TexCoord[1].q / 2 + 0.5; gl_TexCoord[1].t = gl_TexCoord[1].t / gl_TexCoord[1].q /

Re: [osg-users] Projective Texturing does not work when using shaders

2009-05-31 Thread Johannes Schüth
Hi Ulrich, thank you very much. You gave me the right hint to solve my problem. I just added the texture matrix and everything worked as expected: Code: /* set Texture matrix*/ osg::TexMat* texMat = new osg::TexMat; osg::Matrix mat; osg::Vec3 projectorPos = osg::Vec3(0.0f,

Re: [osg-users] Projective Texturing does not work when using shaders

2009-05-31 Thread Ulrich Hertlein
Hi Johannes, On 30/5/09 7:59 PM, Johannes Schüth wrote: when i'm using shaders instead of fixed functionality to create projective textures the resulting texture mapping is a tiny spot in the center of the terrain model. If i disable the shaders by removing the follwing line i get a correct p

[osg-users] Projective Texturing does not work when using shaders

2009-05-30 Thread Johannes Schüth
Hi, when i'm using shaders instead of fixed functionality to create projective textures the resulting texture mapping is a tiny spot in the center of the terrain model. [Image: http://www.jotschi.de/download/osg/projection_shader.jpg ] If i disable the shaders by removing the follwing line i g

Re: [osg-users] Projective Texturing in GLSL shader

2008-04-14 Thread Paul Pocock
Managed to achieve Projective Texturing in shader - just changed the gl_TexCoord[0].q = 1.0 to dot( ecPosition,gl_EyePlaneQ[0]; so: gl_TexCoord[0].s = dot(ecPosition, gl_EyePlaneS[0]) ; gl_TexCoord[0].t = dot(ecPosition, gl_EyePlaneT[0]) ; gl_TexCoord[0].p = dot(ec

Re: [osg-users] Projective Texturing in GLSL shader

2008-04-14 Thread Paul Pocock
Thanks for your help Sebastian, I'm using texgen->setPlanesFromMatrix to set up eye-planes. I assume that's correct (looking at osgspotlight and other examples..) Regards On Mon, 2008-04-14 at 08:37 +0200, Sebastian Messerschmidt wrote: > Hi Paul, > > In the vertex shader try this > vec4 e

Re: [osg-users] Projective Texturing in GLSL shader

2008-04-13 Thread Sebastian Messerschmidt
Hi Paul, In the vertex shader try this vec4 ecPosition = gl_Vertex * gl_ModelViewMatrix; gl_TexCoord[0].s = dot(ecPosition, gl_EyePlaneS[0]) ; gl_TexCoord[0].t = dot(ecPosition, gl_EyePlaneT[0]) ; gl_TexCoord[0].p = dot(ecPosition, gl_EyePlaneR[0]); gl_TexCoord[0].q = 1.0;

[osg-users] Projective Texturing in GLSL shader

2008-04-13 Thread Paul Pocock
Hi, I need some advice on projective texturing. I can get it going in Fixed Functionality - however not on the GPU. I've set up a texGenNode and passing the matrix as a uniform to the shader. I'm also passing the ViewMatrix but sufficed to say I'm not getting the desired effect. Any advice wo