diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-24 23:11:26 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-24 23:11:26 +0000 |
commit | f2c7b3846468461d3d88a797b4cc006ee4d3b624 (patch) | |
tree | 0878808e90b2eb80a54bc67dadcd66dacd72eca0 | |
parent | 5e6ff388cff8d967667f97c611e5d2463239dcd3 (diff) |
better wireframe mode
-rw-r--r-- | src/render/draw.cc | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index c3aed94..e3d4174 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -66,11 +66,7 @@ void draw_sphere(math::Color const & color, float radius) // draw body for (int j=0; j < core::SPHERESEGMENTS-1; j++) { - if (r_drawwireframe && r_drawwireframe->value()) { - glDrawArrays(gl::LineLoop, index, count); - } else { - glDrawArrays(gl::QuadStrip, index, count); - } + glDrawArrays(gl::QuadStrip, index, count); index += count; Stats::quads += count/2-1; } @@ -163,13 +159,7 @@ void draw_model_vertex(core::Entity *entity) // draw model vertices if (count) { size_t index = entity->model()->first_vertex(); - - if (r_drawwireframe && r_drawwireframe->value()) { - glDrawArrays(gl::LineLoop, index, count); - } else { - glDrawArrays(gl::Triangles, index, count); - } - + glDrawArrays(gl::Triangles, index, count); Stats::tris += count/3; } } @@ -183,15 +173,8 @@ void draw_model_evertex(core::Entity *entity) // draw model evertices if (count) { size_t index = entity->model()->first_evertex(); - render::gl::color(entity->color()); - - if (r_drawwireframe && r_drawwireframe->value()) { - glDrawArrays(gl::LineLoop, index, count); - } else { - glDrawArrays(gl::Triangles, index, count); - } - + glDrawArrays(gl::Triangles, index, count); Stats::tris += count/3; } } @@ -481,6 +464,12 @@ void draw(math::Vector3f const &eye, math::Vector3f const &target, float seconds glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); + + if (r_drawwireframe && r_drawwireframe->value()) { + glPolygonMode(GL_FRONT, GL_LINE); + } else { + glPolygonMode(GL_FRONT, GL_FILL); + } draw_pass_model_vertex(); // draw entities with model |