From 6028ed9f0e2ab97749127457ed68ce458efd70b3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 4 Oct 2009 09:13:33 +0000 Subject: use GL_REFLECTION_MAP instead of GL_SPHERE_MAP for envmapping --- src/render/draw.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/render/draw.cc b/src/render/draw.cc index dea24bc..4e5e2a9 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -112,7 +112,7 @@ void pass_prepare(float seconds) for (size_t i = 0; i < 3; i++) { zone_light[i] = globe->location()[i]; zone_color[i] = globe->color()[i]; - diffuse_light[i] = globe->color()[i] * 0.4; + diffuse_light[i] = globe->color()[i] * 0.4f; } zone_light[3] = 1.0f; diffuse_light[3] = 1.0f; @@ -592,8 +592,9 @@ void draw_model_fragments(model::Model *model, //bool use_color_array = true; // glEnableClientState(GL_COLOR_ARRAY) is set // TODO this should probably be initialized somewhere else - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); for (model::Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) { @@ -714,6 +715,7 @@ void draw_model_fragments(model::Model *model, // enable env mapping gl::enable(GL_TEXTURE_GEN_S); gl::enable(GL_TEXTURE_GEN_T); + gl::enable(GL_TEXTURE_GEN_R); use_env = true; } @@ -723,6 +725,7 @@ void draw_model_fragments(model::Model *model, // disable env mapping gl::disable(GL_TEXTURE_GEN_S); gl::disable(GL_TEXTURE_GEN_T); + gl::disable(GL_TEXTURE_GEN_R); use_env = false; } } @@ -746,6 +749,7 @@ void draw_model_fragments(model::Model *model, // disable env mapping gl::disable(GL_TEXTURE_GEN_S); gl::disable(GL_TEXTURE_GEN_T); + gl::disable(GL_TEXTURE_GEN_R); use_env = false; } @@ -781,6 +785,7 @@ void draw_model_fragments(model::Model *model, // disable env mapping gl::disable(GL_TEXTURE_GEN_S); gl::disable(GL_TEXTURE_GEN_T); + gl::disable(GL_TEXTURE_GEN_R); use_env = false; } -- cgit v1.2.3