Confused on how to write Depth Texture


i just can´t find the right way to write my depth texture for shadow mapping.

What i do:

  1. create a FBO with a depth attechment:
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, this->ShadowMapSize_W, this->ShadowMapSize_H, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);

  2. i render the szene to FBO and use shadow-texture to draw shoadows -> works fine so far

  3. NEW: i grap the data from the shadow depth texture like this ans blur it:

glGetTexImage(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, GL_FLOAT, buffer);         

     for(int y = 0; y < textureWidth * textureHeight; y++)
      { ......

Getting data and bluring it works fine- tested by commandline output - it just 1 float per pixel .

  1. NEW: i try to write the data back to the texture - THAT FAILS - no error no output any more on screen …
        glBindTexture( GL_TEXTURE_2D , SzeneOne->m_uiShadowMapTexture );
        BlurTexture( SzeneOne->ShadowMapSize_W , SzeneOne->ShadowMapSize_H, 6 , &shadowTmpBuffer );
        glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SzeneOne->ShadowMapSize_W, SzeneOne->ShadowMapSize_H, 0, GL_DEPTH_COMPONENT, GL_FLOAT,  &shadowTmpBuffer );

by commenting out, i know its about the glTexImage2D() line…
can you tell me what i´m doing wrong here ?


Any GL errors?


thats the strange part … no opengl errors …