summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2011-01-21 21:43:27 -0800
committerKenneth Graunke <kenneth@whitecape.org>2011-01-21 21:43:53 -0800
commit7bdeef247fc6b73674c3708509573f424b4bf8ef (patch)
tree3c4617a0d199b9b26dd5aa4d43e36d4d3c793124
parent00e8475b1ee245b3f479cea144ed4429fec30552 (diff)
Fix the lack of a depth buffer.sobel
-rwxr-xr-xsrc/scene.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/scene.cpp b/src/scene.cpp
index 03b7110..5f1b3c5 100755
--- a/src/scene.cpp
+++ b/src/scene.cpp
@@ -380,6 +380,12 @@ Init()
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo_tex, 0);
+ GLuint rb;
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, fbo_width, fbo_height);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb);
+
gluPerspective4f(&projection_matrix, 55.0f * M_PI / 180.0f,
fbo_width / fbo_height, 5.0f, 56.0f);