   Render Scene To Texture
  i am just starting on the development of shaders because i want to simulate a depth of field effect in a games engine. currently i am using "rendermonkey" for that.i read that solving this problem is possible by using a temporary texture which contains the whole scene (render scene to texture). i already did that in hlsl which worked just fine. but now i started to get this running in glsl. but it isnt working. here is the code (with hlsl-code) - i am just trying to display the renderable texture which contains the scene in using a screen-align quad://vertexuniform float fInverseViewportWidth;uniform float fInverseViewportHeight;void main(void){//HLSL//Out.Pos = float4(Pos.xy, 0, 1);gl_Position = vec4(gl_Position.xy, 0, 1);//HLSL//Out.texCoord.x = 0.5 * (1 + Pos.x - viewport_inv_width);//Out.texCoord.y = 0.5 * (1 - Pos.y - viewport_inv_height);gl_TexCoord[0].s = 0.5 * (1.0 + gl_Position.x - fInverseViewportWidth);gl_TexCoord[0].t = 0.5 * (1.0 + gl_Position.y - fInverseViewportHeight);}//fragmentuniform sampler2D temptex;void main(void){    //HLSL    //return tex2D(Texture0,  texCoord);    gl_FragColor = texture2D(temptex, vec2(gl_TexCoord[0]));    }thanks for you help in advance.   
  Sorry, I haven't really thought about what you're trying to do, but if this is your vertex shader, then something's wrong. void main(void){  gl_Position = vec4(gl_Position.xy, 0, 1);// You're setting gl_Position to something that depends on gl_Position which is not yet // set to anything. Do you mean gl_Vertex?   gl_TexCoord[0].s = 0.5 * (1.0 + gl_Position.x - fInverseViewportWidth);  gl_TexCoord[0].t = 0.5 * (1.0 + gl_Position.y - fInverseViewportHeight);};  you were right.i changed it:uniform float fInverseViewportWidth;uniform float fInverseViewportHeight;void main(void){   gl_Position = gl_Vertex;   vec4 v = vec4(gl_Vertex.xy, 0.0, 1.0);    gl_TexCoord[0].s = 0.5*(1.0 + v.x - fInverseViewportWidth);   gl_TexCoord[0].t = 0.5*(1.0 - v.y - fInverseViewportHeight);}but i still can't see the whole scene... there still must be something missing. but i dunno what it is.. is it an opengl thing?!;  here is a screenshot which shows my actual problem:http://www.cs.uni-magdeburg.de/~kreinema/scenetexture.jpgas you can see there are black bars on top and on the right side of the screen. therefore the teapot is distorted...i just changed this section:   gl_Position = gl_Vertex;   vec4 v = vec4(gl_Vertex.xy, 0.0, 1.0);    gl_TexCoord[0].s = 0.5*(1.0 + v.x - fInverseViewportWidth);   gl_TexCoord[0].t = 0.5*(1.0 + v.y - fInverseViewportHeight);i dont know where i can find the mistake.. maybe it is my graphics card (ati 9600)?!i would be very pleased if anyone out there could help me. thx.   ;  I hope that i understand your problem right.Look at the screenspace examples in Rendermonkey. The screen aligned quads are calculated with this lines in vertex shader:vec2 Pos = sign(gl_Vertex.xy);gl_Position = vec4(Pos.xy, 0.0, 1.0);gl_TexCoord[0].xy = Pos * 0.5 + 0.5;In the fragment shader you call the texture as you usually do.;  i have just tried that. but no luck. it still looks the same.but i tried to manipulate some parameters in rendermonkey, e.g. the rendertarget itself... there you can change the viewport dimensions so that it is fullscreen but still distorted. dunno why?!does that matter if i wanna put the future shader in a game engine like delta 3d anyway? any experience on that? ;  Strange, that its not functioning.Look at the "OldTV" screen space example and especially vertex shader. If the examples works for you, than your code is wrong. I have no Problem on my 9800 and you shoudn't have it too on 9600.   