Skip to content
Snippets Groups Projects
Commit 6909aad9 authored by Maxime Graulich's avatar Maxime Graulich
Browse files

mobile: fix clipping

parent eb47ffc8
No related branches found
No related tags found
No related merge requests found
...@@ -192,9 +192,8 @@ void drawContext::OrthofFromGModel() ...@@ -192,9 +192,8 @@ void drawContext::OrthofFromGModel()
ymin -= (ymax - ymin) / 5.; ymin -= (ymax - ymin) / 5.;
// clipping // clipping
double zmax = std::max(fabs(bb.min().z()), fabs(bb.max().z())); 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 * 5.; double clip = zmax * 1.5;
clip = 1.;
GLint matrixMode; GLint matrixMode;
glGetIntegerv(GL_MATRIX_MODE, &matrixMode); glGetIntegerv(GL_MATRIX_MODE, &matrixMode);
...@@ -204,6 +203,7 @@ void drawContext::OrthofFromGModel() ...@@ -204,6 +203,7 @@ void drawContext::OrthofFromGModel()
this->_right = (xmin != 0 || xmax != 0)? xmax : ratio; this->_right = (xmin != 0 || xmax != 0)? xmax : ratio;
this->_top = (xmin != 0 || xmax != 0)? ymax : 1.0; this->_top = (xmin != 0 || xmax != 0)? ymax : 1.0;
this->_bottom = (xmin != 0 || xmax != 0)? ymin : -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); glOrthof(this->_left, this->_right, this->_bottom, this->_top, -clip, clip);
glMatrixMode(matrixMode); glMatrixMode(matrixMode);
...@@ -559,10 +559,10 @@ void drawContext::drawView() ...@@ -559,10 +559,10 @@ void drawContext::drawView()
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
const GLfloat squareVertices[] = { const GLfloat squareVertices[] = {
(GLfloat)this->_top, (GLfloat)this->_left, -5., (GLfloat)this->_top, (GLfloat)this->_left, 2*this->_far,
(GLfloat)this->_top, (GLfloat)this->_right, -5., (GLfloat)this->_top, (GLfloat)this->_right, 2*this->_far,
(GLfloat)this->_bottom, (GLfloat)this->_left, -5., (GLfloat)this->_bottom, (GLfloat)this->_left, 2*this->_far,
(GLfloat)this->_bottom, (GLfloat)this->_right, -5., (GLfloat)this->_bottom, (GLfloat)this->_right, 2*this->_far,
}; };
const GLubyte squareColors[] = { const GLubyte squareColors[] = {
255, 255, 255, 255, 255, 255, 255, 255,
......
...@@ -34,7 +34,7 @@ private: ...@@ -34,7 +34,7 @@ private:
double _quaternion[4]; // current quaternion used for rotation double _quaternion[4]; // current quaternion used for rotation
movePosition _start, _previous, _current; // store informations about user interactions movePosition _start, _previous, _current; // store informations about user interactions
int _width, _height; // size of OpenGL context in pixel 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; float _fontFactor;
bool _gradiant, // show the background gradiant bool _gradiant, // show the background gradiant
_fillMesh; // fill the Mesh _fillMesh; // fill the Mesh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment