From f2c7b3846468461d3d88a797b4cc006ee4d3b624 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 24 Mar 2008 23:11:26 +0000 Subject: better wireframe mode --- src/render/draw.cc | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/render/draw.cc') 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 -- cgit v1.2.3