Commit 17a55b9f authored by Jan Möbius's avatar Jan Möbius
Browse files

Guard per face draw modes if no faces are available

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11124 383ad7c9-94d9-4d36-a494-682f7c89f535
parent bb3a91a4
......@@ -341,7 +341,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
glDepthRange(0.0, 1.0);
}
if ( ( _drawMode & DrawModes::SOLID_FLAT_SHADED ) && mesh_.has_face_normals())
if ( ( _drawMode & DrawModes::SOLID_FLAT_SHADED ) && mesh_.has_face_normals() && mesh_.n_faces() > 0)
{
glEnable(GL_LIGHTING);
glShadeModel(GL_FLAT);
......@@ -389,7 +389,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
}
if ( ( _drawMode & DrawModes::SOLID_FACES_COLORED )&& mesh_.has_face_colors())
if ( ( _drawMode & DrawModes::SOLID_FACES_COLORED ) && mesh_.has_face_colors() && mesh_.n_faces() > 0)
{
Vec4f base_color_backup = _state.base_color();
......@@ -404,7 +404,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
}
if ( ( _drawMode & DrawModes::SOLID_FACES_COLORED_FLAT_SHADED ) && mesh_.has_face_colors() && mesh_.has_face_normals())
if ( ( _drawMode & DrawModes::SOLID_FACES_COLORED_FLAT_SHADED ) && mesh_.has_face_colors() && mesh_.has_face_normals() && mesh_.n_faces() > 0 )
{
Vec4f base_color_backup = _state.base_color();
glEnable(GL_LIGHTING);
......@@ -447,7 +447,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
// Textured by using coordinates stored in halfedges ... arrays generated by stripprocessor
if ( _drawMode & DrawModes::SOLID_2DTEXTURED_FACE )
if ( (_drawMode & DrawModes::SOLID_2DTEXTURED_FACE) && mesh_.n_faces() > 0 )
{
glEnable(GL_TEXTURE_2D);
......@@ -463,7 +463,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
}
// Textured by using coordinates stored in halfedges
if ( ( _drawMode & DrawModes::SOLID_2DTEXTURED_FACE_SHADED ) && mesh_.has_face_normals())
if ( ( _drawMode & DrawModes::SOLID_2DTEXTURED_FACE_SHADED ) && mesh_.has_face_normals() && mesh_.n_faces() > 0)
{
glEnable(GL_TEXTURE_2D);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment