Small parameter changes.

This commit is contained in:
Faerbit 2015-01-27 11:14:00 +01:00
parent 377372d1c6
commit 114632b015
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"); printf("Framebuffer incomplete, unknown error occured during shadow generation!\n");
} }
if (saveDepthBufferBool && i_face == 3) { if (saveDepthBufferBool && i_face == 3) {
printf("Doing stuff...\n"); saveDepthBufferToDisk(3, "face.png");
saveDepthBufferToDisk(framebuffer_cube, "face2.png");
saveDepthBufferBool = false; saveDepthBufferBool = false;
} }
} }
@ -248,12 +247,12 @@ float Graphics::getFarPlane() {
return farPlane; 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"); printf("Starting saving of depth buffer...\n");
float *depthbuffer = new float[1024*1024]; float *depthbuffer = new float[1024*1024];
std::vector<unsigned char> image (1024 * 1024 * 4); 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++) { for (unsigned int i = 0; i<1024*1024; i++) {
image[i * 4 + 0] = depthbuffer[i] * 255; image[i * 4 + 0] = depthbuffer[i] * 255;
image[i * 4 + 1] = depthbuffer[i] * 255; image[i * 4 + 1] = depthbuffer[i] * 255;

View File

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