From 377372d1c65ccaa4199a8e2cd7b485f06e8ff3ac Mon Sep 17 00:00:00 2001 From: Faerbit Date: Mon, 26 Jan 2015 23:11:04 +0100 Subject: [PATCH] Fixed saving of depthbuffer. --- Levels/ObjectSetups/Compositions.xml | 2 +- .../BroadphaseCollision/btQuantizedBvh.h | 2 +- graphics.cc | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Levels/ObjectSetups/Compositions.xml b/Levels/ObjectSetups/Compositions.xml index 015900a..8df8ad9 100644 --- a/Levels/ObjectSetups/Compositions.xml +++ b/Levels/ObjectSetups/Compositions.xml @@ -66,7 +66,7 @@ 0.0 - 3 + 2 0.0 1.0 1.0 diff --git a/extern/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/extern/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h index 78382da..5f8007d 100644 --- a/extern/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +++ b/extern/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h @@ -354,7 +354,7 @@ public: btAssert(m_useQuantization); - btAssert(point.getX() <= m_bvhAabbMax.getX()); + //btAssert(point.getX() <= m_bvhAabbMax.getX()); btAssert(point.getY() <= m_bvhAabbMax.getY()); btAssert(point.getZ() <= m_bvhAabbMax.getZ()); diff --git a/graphics.cc b/graphics.cc index 68a1b20..c4fc5a2 100644 --- a/graphics.cc +++ b/graphics.cc @@ -117,7 +117,7 @@ void Graphics::render(double time) if (!framebuffer_cube->isFrameBufferObjectComplete()) { printf("Framebuffer incomplete, unknown error occured during shadow generation!\n"); } - if (saveDepthBufferBool && i_face == 2) { + if (saveDepthBufferBool && i_face == 3) { printf("Doing stuff...\n"); saveDepthBufferToDisk(framebuffer_cube, "face2.png"); saveDepthBufferBool = false; @@ -250,17 +250,17 @@ float Graphics::getFarPlane() { void Graphics::saveDepthBufferToDisk(SharedFrameBufferObject fbo, std::string filename) { printf("Starting saving of depth buffer...\n"); - float *depthbuffer = new float[windowSize.x * windowSize.y]; - std::vector image (windowSize.x * windowSize.y * 4); + float *depthbuffer = new float[1024*1024]; + std::vector image (1024 * 1024 * 4); - glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_DEPTH_COMPONENT, GL_FLOAT, depthbuffer); - for (unsigned int i = 0; i