diff options
author | Stijn Buys <ingar@osirion.org> | 2010-09-29 17:36:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-09-29 17:36:49 +0000 |
commit | 3274ad9eeb02af614e1cba5cd05468de04069d6e (patch) | |
tree | d59c581164fdd22c0d3307b09508af56932c5276 /src/render | |
parent | 178f0e4a83918df416ac8274b0e845b390772d76 (diff) |
better envmapping, by Odin
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 10 | ||||
-rw-r--r-- | src/render/gl.cc | 10 | ||||
-rw-r--r-- | src/render/gl.h | 5 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 7d0242d..42b7d8c 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -591,10 +591,8 @@ void draw_model_fragments(model::Model *model, bool use_env = false; // environment mapping // TODO this should probably be initialized somewhere else - 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); - + gl::texgeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + gl::texgeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); for (model::Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) { @@ -714,7 +712,6 @@ 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; } @@ -724,7 +721,6 @@ 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; } } @@ -748,7 +744,6 @@ 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; } @@ -784,7 +779,6 @@ 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; } diff --git a/src/render/gl.cc b/src/render/gl.cc index 355efab..d21065e 100644 --- a/src/render/gl.cc +++ b/src/render/gl.cc @@ -204,5 +204,15 @@ void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdou glFrustum(left, right, bottom, top, znear, zfar); } +void texgeni(GLenum coord, GLenum param, GLenum value) +{ + glTexGeni(coord, param, value); +} + +void texgenfv(GLenum coord, GLenum param, const GLfloat* value) +{ + glTexGenfv(coord, param, value); +} + } // namespace gl diff --git a/src/render/gl.h b/src/render/gl.h index 5bd42b5..7d1857c 100644 --- a/src/render/gl.h +++ b/src/render/gl.h @@ -203,6 +203,11 @@ void loadidentity(); /// Perspective matrix void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble znear, GLdouble zfar); + +/// Texture coordinate generation +void texgeni(GLenum coord, GLenum param, GLenum value); + +void texgenfv(GLenum coord, GLenum param, const GLfloat* value); } #endif // __INCLUDED_RENDER_GL_H__ |