Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlTools.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef GLTOOLS_H
00022 #define GLTOOLS_H
00023 #ifndef DOXYGEN_NOTFOR_DEVEL
00024 #include <tulip/tulipconf.h>
00025 #include <tulip/Color.h>
00026 #include <tulip/Coord.h>
00027 #include <tulip/Size.h>
00028 #include <tulip/Matrix.h>
00029 
00030 #if defined(_MSC_VER)
00031 #include <Windows.h>
00032 #endif
00033 
00034 #if defined(__APPLE__)
00035 #include <OpenGL/gl.h>
00036 #else
00037 #include <GL/gl.h>
00038 #endif
00039 
00040 namespace tlp {
00041 
00042 struct BoundingBox;
00043 
00044 typedef Matrix<float, 4> MatrixGL;
00045 TLP_GL_SCOPE const std::string& glGetErrorDescription(GLuint errorCode);
00046 TLP_GL_SCOPE void glTest(const std::string &message = std::string("(no description)"));
00047 TLP_GL_SCOPE void setColor(const Color &c);
00048 TLP_GL_SCOPE void setColor(GLfloat *);
00049 TLP_GL_SCOPE void setMaterial(const Color &c);
00050 TLP_GL_SCOPE bool cameraIs3D();
00051 /*
00052  * Project point on screnn according to the transformation matrix (modelview * projection)
00053  * and the viewport (x, y, width, height) given in parmaeter.
00054  */
00055 TLP_GL_SCOPE Coord projectPoint(const Coord &obj,
00056                                 const MatrixGL &,
00057                                 const Vector<int, 4> &viewport);
00058 /*
00059  * UnProject point from screen to 3D world according to the inverse transformation matrix (modelview * projection)^-1
00060  * and the viewport (x, y, width, height) given in parmaeter.
00061  */
00062 TLP_GL_SCOPE Coord unprojectPoint(const Coord &obj,
00063                                   const MatrixGL &,
00064                                   const tlp::Vector<int, 4> &viewport);
00065 TLP_GL_SCOPE GLfloat projectSize(const BoundingBox& bb,
00066                                  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
00067 TLP_GL_SCOPE GLfloat projectSize(const Coord& position,const Size& size,
00068                                  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
00069 TLP_GL_SCOPE float calculateAABBSize(const BoundingBox& bb,const Coord& eye,const Matrix<float, 4>& transformMatrix,const Vector<int, 4>& globalViewport,const Vector<int, 4>& currentViewport);
00070 TLP_GL_SCOPE float calculate2DLod(const BoundingBox& bb,const Vector<int, 4>& globalViewport,const Vector<int, 4>& currentViewport);
00071 }
00072 
00073 #endif //DOXYGEN_NOTFOR_DEVEL
00074 #endif
00075 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties