I dont want to use any shaders just pure opengl ; )
The code might be handy:
But i don't know what type of texture use:
should it be? unsigned int Texture; or something else?
i use something like this to initalize:
glEnabled(GL_TEXUTRE_2D); glGenTextures(1, &shadowMapTexture); glBindTexture(GL_TEXTURE_2D, shadowMapTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 512, 512, 0, GL_DEPTH_COMPONENT24, GL_UNSIGNED_BYTE, 0); glDisable(GL_TEXTURE_2D);
then i call:
glEnable(GL_TEXTURE_2D); //Read the depth buffer into the shadow map texture glBindTexture(GL_TEXTURE_2D, shadowMapTexture); // glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowMapSize, shadowMapSize); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 0, 0, shadowMapSize, shadowMapSize, 0); glDisable(GL_TEXTURE_2D);
and i try to draw it but i see blank white texture (NOTE: i am using 24 bit depth buffer)]
Maybe i shouldn't see anything but how i am supposed to see if my shadowmap is working when i can't see it even on on blank quad (i expected to see a white texture with black (shadow ;P)
like i said working code would come handy without explenations






