hi all, i'm rendering my scene and then using glCopyTexSubImage to read back the framebuffer's depth info into a texture i created (with format DEPTH_COMPONENT) it dosn't seem to be working, its just all white... i've searched google with not much luck. its my understanding that the depth value should be clamped to 0-1, this is correct? any help would be greatly appreciated Cheers -Danu my code:
// init code
glGenTextures(1, &this->apiName );
glBindTexture( GL_TEXTURE_2D, this->apiName );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL );
// rendering code
device->flush();
// copy zbuffer into the depth texture
glBindTexture(GL_TEXTURE_2D, this->apiName);
glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, this->width, this->height);
// also tried this, but no cigar:
// glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, this->width, this->height, 0);


