PDA

View Full Version : why depth texture dosen't working



glsl09
09-15-2010, 11:38 AM
hello

i want to use depth texture for shadow mapping.first pass I render scene from point of light view then copy depth result to depth texture. the second pass i render depth texture onto full screen quad to see wheter everything is working or not. but i get wrong result if i add the folowing line in texture objetct creation

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);

if i remove the above line in the texture object creation. i get correct depth texture expected. how can i fix problem.

thanks in advance

DmitryM
09-15-2010, 12:00 PM
GL_TEXTURE_COMPARE_MODE is used for the shadow map sampling, when you want GPU to perform comparison for you and get the binary result (not the depth value).

If you just need to fetch the depth from the depth texture, set GL_TEXTURE_COMPARE_MODE = GL_NONE.

Edit: this is *not* a right forum for you. Post in the beginners section, please.

glsl09
09-15-2010, 12:14 PM
thank you dmitrrym for your quick reply. i apologize to post wrong forum.

i didn't make shadow calculating yet. before calculating shadow comprasion. i want to see depth texture onto full screen quad wheter everything is working. but i get only white quad. isn't this shows there is a problem.

Dark Photon
09-15-2010, 04:14 PM
...but i get wrong result if i add the folowing line in texture objetct creation

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);

if i remove the above line in the texture object creation. i get correct depth texture expected. how can i fix problem.
Simple. Don't do that ;)

DmitryM answered your question.

Perhaps you should state why it is you are adding the above line and what precisely you expect it to do for you. I think you have a misunderstanding here.