X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fenvironmentmap.cpp;h=f4000c768cd2f3c77e8462e37655d4f10b3ed066;hb=42293e1bd6f3d6297a1d0207ca69e7864a7d76e8;hp=1cc589143e78da5cc1d47cf456f2f6360613d2ac;hpb=9319f1c8ed99866966f20fbab952da673af2257e;p=libs%2Fgl.git diff --git a/source/environmentmap.cpp b/source/environmentmap.cpp index 1cc58914..f4000c76 100644 --- a/source/environmentmap.cpp +++ b/source/environmentmap.cpp @@ -17,10 +17,11 @@ EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e): update_interval(1), update_delay(0) { - env_tex.storage(RGB, size, 1); - env_tex.set_wrap(CLAMP_TO_EDGE); - env_tex.set_min_filter(LINEAR); - depth_buf.storage(DEPTH_COMPONENT, size, size); + env_tex.storage(RGB8, size, 1); + Sampler &env_samp = env_tex.get_default_sampler(); + env_samp.set_wrap(CLAMP_TO_EDGE); + env_samp.set_min_filter(LINEAR); + depth_buf.storage(DEPTH_COMPONENT32F, size, size); for(unsigned i=0; i<6; ++i) { fbo[i].attach(COLOR_ATTACHMENT0, env_tex, TextureCube::enumerate_faces(i), 0); @@ -31,7 +32,6 @@ EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e): camera.set_field_of_view(Geometry::Angle::right()); camera.set_aspect_ratio(1); camera.set_depth_clip(0.1, 100); - } void EnvironmentMap::set_depth_clip(float n, float f) @@ -82,9 +82,9 @@ void EnvironmentMap::setup_frame(Renderer &renderer) { TextureCubeFace face = TextureCube::enumerate_faces(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)); + fbo[i].clear(); + camera.set_look_direction(TextureCube::get_face_direction(face)); + camera.set_up_direction(TextureCube::get_t_direction(face)); renderer.set_camera(camera); renderer.render(environment); }