X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fenvironmentmap.cpp;h=8a1dfe399acfae7260c79aa33022a2662337f7b9;hb=619aae12e01f25e79626a94c973927e5599e99a5;hp=09a9b468277f7fad0c8f030e69ff820157aa70a4;hpb=131bec9b254f5ba50dcaf7e6192baab9e9ccba6f;p=libs%2Fgl.git diff --git a/source/environmentmap.cpp b/source/environmentmap.cpp index 09a9b468..8a1dfe39 100644 --- a/source/environmentmap.cpp +++ b/source/environmentmap.cpp @@ -20,10 +20,11 @@ EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e): { fbo[i].attach(COLOR_ATTACHMENT0, env_tex, TextureCube::enumerate_faces(i), 0); fbo[i].attach(DEPTH_ATTACHMENT, depth_buf); + fbo[i].require_complete(); } // XXX Make the depth range configurable - camera.set_field_of_view(M_PI/2); + camera.set_field_of_view(Geometry::Angle::right()); camera.set_aspect(1); camera.set_depth_clip(0.1, 100); @@ -45,7 +46,7 @@ void EnvironmentMap::setup_frame() const for(unsigned i=0; i<6; ++i) { TextureCubeFace face = TextureCube::enumerate_faces(i); - Bind _bind_fbo(fbo[i]); + fbo[i].bind(); fbo[i].clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT); camera.set_look_direction(env_tex.get_face_direction(face)); camera.set_up_direction(env_tex.get_t_direction(face)); @@ -53,6 +54,7 @@ void EnvironmentMap::setup_frame() const env_renderer.exclude(renderable); env_renderer.render(environment); } + Framebuffer::unbind(); } void EnvironmentMap::finish_frame() const