Small parameter changes.

This commit is contained in:
Faerbit 2015-01-27 11:14:00 +01:00
parent a38f251a3e
commit 9154095d4d
2 changed files with 4 additions and 5 deletions

View File

@ -118,8 +118,7 @@ void Graphics::render(double time)
printf("Framebuffer incomplete, unknown error occured during shadow generation!\n");
}
if (saveDepthBufferBool && i_face == 3) {
printf("Doing stuff...\n");
saveDepthBufferToDisk(framebuffer_cube, "face2.png");
saveDepthBufferToDisk(3, "face.png");
saveDepthBufferBool = false;
}
}
@ -248,12 +247,12 @@ float Graphics::getFarPlane() {
return farPlane;
}
void Graphics::saveDepthBufferToDisk(SharedFrameBufferObject fbo, std::string filename) {
void Graphics::saveDepthBufferToDisk(int face, std::string filename) {
printf("Starting saving of depth buffer...\n");
float *depthbuffer = new float[1024*1024];
std::vector<unsigned char> image (1024 * 1024 * 4);
glGetTexImage(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_DEPTH_COMPONENT, GL_FLOAT, depthbuffer);
glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, GL_DEPTH_COMPONENT, GL_FLOAT, depthbuffer);
for (unsigned int i = 0; i<1024*1024; i++) {
image[i * 4 + 0] = depthbuffer[i] * 255;
image[i * 4 + 1] = depthbuffer[i] * 255;

View File

@ -22,7 +22,7 @@ class Graphics {
private:
bool saveDepthBufferBool;
void updateLights();
void saveDepthBufferToDisk(ACGL::OpenGL::SharedFrameBufferObject fbo, std::string);
void saveDepthBufferToDisk(int face, std::string);
double lastUpdate;
glm::uvec2 windowSize;
float nearPlane;