Hi all, I am following the shadow course in the latest SDK for windows emulation which I want to use later on, on android and ios.
First of all, is this tutorial just the code or is there some theory text accompanying it?
I understand like 80% of it and have most of the stuff coded up its just that my entire scene ends up being in shadow.
In another book it says that we must use specific border settigns like this:
GLfloat Border[] = {1.0f, 0.0f, 0.0f, 0.0f};
glGenTextures(1, &ZONE_DEPTH);
glBindTexture(GL_TEXTURE_2D, ZONE_DEPTH);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, ZoneShadowmapSizeX, ZoneShadowmapSizeY, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, Border);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LESS);
The author says that this is absolutely necessary otherwise the whole scene will end up in shadow. I am just wondering how does the sample actually account for this and make everything work?
Also can we use linear depth texture values when doing the final comparison?