diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp index d0f056afd2dda4653c281e97bd671a4a6d831211..072f869cf163ac093cd798c6e7834f80d7901d7b 100644 --- a/contrib/mobile/drawContext.cpp +++ b/contrib/mobile/drawContext.cpp @@ -192,9 +192,8 @@ void drawContext::OrthofFromGModel() ymin -= (ymax - ymin) / 5.; // clipping - double zmax = std::max(fabs(bb.min().z()), fabs(bb.max().z())); - double clip = zmax * 5.; - clip = 1.; + double zmax = std::max(std::max(std::max(fabs(bb.min().z()), fabs(bb.max().z())), std::max(fabs(bb.min().x()), fabs(bb.max().x()))), std::max(fabs(bb.min().y()), fabs(bb.max().y()))); + double clip = zmax * 1.5; GLint matrixMode; glGetIntegerv(GL_MATRIX_MODE, &matrixMode); @@ -204,6 +203,7 @@ void drawContext::OrthofFromGModel() this->_right = (xmin != 0 || xmax != 0)? xmax : ratio; this->_top = (xmin != 0 || xmax != 0)? ymax : 1.0; this->_bottom = (xmin != 0 || xmax != 0)? ymin : -1.0; + this->_far = -clip; glOrthof(this->_left, this->_right, this->_bottom, this->_top, -clip, clip); glMatrixMode(matrixMode); @@ -559,10 +559,10 @@ void drawContext::drawView() glPushMatrix(); glLoadIdentity(); const GLfloat squareVertices[] = { - (GLfloat)this->_top, (GLfloat)this->_left, -5., - (GLfloat)this->_top, (GLfloat)this->_right, -5., - (GLfloat)this->_bottom, (GLfloat)this->_left, -5., - (GLfloat)this->_bottom, (GLfloat)this->_right, -5., + (GLfloat)this->_top, (GLfloat)this->_left, 2*this->_far, + (GLfloat)this->_top, (GLfloat)this->_right, 2*this->_far, + (GLfloat)this->_bottom, (GLfloat)this->_left, 2*this->_far, + (GLfloat)this->_bottom, (GLfloat)this->_right, 2*this->_far, }; const GLubyte squareColors[] = { 255, 255, 255, 255, diff --git a/contrib/mobile/drawContext.h b/contrib/mobile/drawContext.h index d3cf3d63e12961fa5ce66dfde6f1067b3a6bdd62..d32b47f45cc4ae48344827fff601ed65f6cb0ed9 100644 --- a/contrib/mobile/drawContext.h +++ b/contrib/mobile/drawContext.h @@ -34,7 +34,7 @@ private: double _quaternion[4]; // current quaternion used for rotation movePosition _start, _previous, _current; // store informations about user interactions int _width, _height; // size of OpenGL context in pixel - float _left, _right, _top, _bottom; // value of "border" + float _left, _right, _top, _bottom, _far; // value of "border" float _fontFactor; bool _gradiant, // show the background gradiant _fillMesh; // fill the Mesh