   GLSL: Depth texture
  I have this problem:I want to compute shadow maps in my shader. Everything is working, if I use FBO with texture color attachement. I save my computed distance to alpha channel in texture. But I have read, that it's faster to compute only depth. I don't know, how to create depth texture, how to write to it in my shader, how to attach it to another shader and read from it.Can someone help me? Here is my code, which I'm using now, but it's slow :( :Opengl generating FBO and texture2D:glGenTextures  ( 1, &g_DepthMapTexId );glActiveTexture( GL_TEXTURE0);glBindTexture  ( GL_TEXTURE_2D, g_DepthMapTexId );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );glTexImage2D   ( GL_TEXTURE_2D, 0, GL_RGBA16F, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );glGenRenderbuffers(1, &rid;glBindRenderbuffer(GL_RENDERBUFFER, rid);glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, textureSize, textureSize);glGenFramebuffers(1, &fid;glBindFramebuffer(GL_FRAMEBUFFER, fid);glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rid);glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_DepthMapTexId, 0);Fragment shader writing to shadow map:gl_FragColor = vec4(0.0, 0.0, 0.0, distance);Opengl (attaching texture to shader):glUniform1i(glGetUniformLocation(*shadowShader, "shadowMap"), 0);Fragment shader reading from shadow map:uniform sampler2D shadowMap;...dist = texture2D(shadowMap, texcoord).a;BTW: Sorry for my english. :(   
  I've got it working with my code, (though that's without using the color attachment). When I try to add color attachment for fullscreen rendering of the scene with shadow map applied, my shadowmap won't work anymore. Maybe you can spot some things that could help you out though:http://www.gamedev.net/community/forums/topic.asp?topic_id=570566