OpenGLVisualizer.h
Go to the documentation of this file.
1 // ****************************************************************************
2 // This file is part of the Integrating Vision Toolkit (IVT).
3 //
4 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
5 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
6 //
7 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // 3. Neither the name of the KIT nor the names of its contributors may be
21 // used to endorse or promote products derived from this software
22 // without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
25 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
28 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // ****************************************************************************
35 // ****************************************************************************
36 // Filename: OpenGLVisualizer.h
37 // Author: Pedram Azad
38 // Date: 2004
39 // ****************************************************************************
40 // Changes: 25.10.2010, Zhixing Xue
41 // * Added COpenGLVisualizer::GetDepthMatrix
42 // ****************************************************************************
43 
44 #ifndef _OPENGL_VISUALIZER_SCENE_H_
45 #define _OPENGL_VISUALIZER_SCENE_H_
46 
47 
48 // ****************************************************************************
49 // Necessary includes
50 // ****************************************************************************
51 
52 #include "Math/Math3d.h"
53 
54 
55 // ****************************************************************************
56 // Forward declarations
57 // ****************************************************************************
58 
59 class GLUquadric;
60 class CByteImage;
61 class CCalibration;
62 class CFloatMatrix;
63 
64 
65 
66 // ****************************************************************************
67 // COpenGLVisualizer
68 // ****************************************************************************
69 
71 {
72 public:
73  // constructor
75 
76  // destructor
78 
79  // static variables for colors
80  static const float red[3];
81  static const float green[3];
82  static const float blue[3];
83  static const float yellow[3];
84 
85 
86  // public methods
87  bool Init(int width = 640, int height = 480, bool bActivateShading = true);
88  bool InitByCalibration(const CCalibration *pCalibration, bool bActivateShading = true);
89  void ActivateShading(bool bActivateShading);
90  void SetProjectionMatrix(const CCalibration *pCalibration);
91  bool GetImage(CByteImage *pDestinationImage);
92  bool GetDepthMatrix(CFloatMatrix *pDestinationMatrix);
93  void SetViewMatrix(const Transformation3d &transformation)
94  {
95  m_ViewMatrix = transformation;
96  }
97 
98  // methods for drawing
99  void Clear();
100  void DrawPoint(float x, float y, float z, const float *pColor = 0);
101  void DrawPoints(Vec3dList &points, const float *pColor = 0);
102  void DrawSphere(const Vec3d &point, float radius, const float *pColor = 0);
103  void DrawCylinder(const Vec3d &point1, const Vec3d &point2, float radius1, float radius2, const float color[3]);
104  void DrawObject(const CFloatMatrix *pMatrix, const Transformation3d &transformation);
105 
106  // static methods
107  static void ConvertToOpenGLMatrix(const Transformation3d &transformation, float resultMatrix[16]);
108  static void CalculateOpenGLProjectionMatrix(const Mat3d &K, int width, int height, float gnear, float gfar, float *m);
109  static void CalculateOpenGLProjectionMatrixDefaultPrincipalPoint(const Mat3d &K, int width, int height, float gnear, float gfar, float *m);
110 
111 
112 private:
113  // private methods
114  void SetProjectionMatrix(int nWidth, int nHeight);
115  bool InitExtension();
116 
117  // private attributes
118  int width, height;
119 
120  GLUquadric *m_pQuadric;
121 
122  // current view matrix
125 };
126 
127 
128 
129 #endif /* _OPENGL_VISUALIZER_SCENE_H_ */
bool GetImage(CByteImage *pDestinationImage)
void ActivateShading(bool bActivateShading)
bool GetDepthMatrix(CFloatMatrix *pDestinationMatrix)
static void ConvertToOpenGLMatrix(const Transformation3d &transformation, float resultMatrix[16])
GLdouble GLdouble z
Definition: glext.h:3343
bool InitByCalibration(const CCalibration *pCalibration, bool bActivateShading=true)
GLclampf green
Definition: glext.h:3119
Data structure for the representation of a 3D vector.
Definition: Math3d.h:73
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
Definition: ByteImage.h:80
void DrawObject(const CFloatMatrix *pMatrix, const Transformation3d &transformation)
GLsizei const GLfloat * points
Definition: glext.h:4388
std::vector< Vec3d > Vec3dList
Definition: Math3d.h:126
static const float yellow[3]
GLenum GLint x
Definition: glext.h:3125
Data structure for the representation of a matrix of values of the data type float.
Definition: FloatMatrix.h:56
void DrawPoint(float x, float y, float z, const float *pColor=0)
void DrawPoints(Vec3dList &points, const float *pColor=0)
static const float red[3]
GLclampf GLclampf blue
Definition: glext.h:3119
static void CalculateOpenGLProjectionMatrix(const Mat3d &K, int width, int height, float gnear, float gfar, float *m)
GLenum GLsizei width
Definition: glext.h:3122
GLenum GLsizei GLsizei height
Definition: glext.h:3132
bool Init(int width=640, int height=480, bool bActivateShading=true)
void SetProjectionMatrix(const CCalibration *pCalibration)
Transformation3d m_ViewMatrix
GLenum GLint GLint y
Definition: glext.h:3125
void SetViewMatrix(const Transformation3d &transformation)
static void CalculateOpenGLProjectionMatrixDefaultPrincipalPoint(const Mat3d &K, int width, int height, float gnear, float gfar, float *m)
Data structure for the representation of a 3x3 matrix.
Definition: Math3d.h:93
Camera model parameters and functions for a single camera.
Definition: Calibration.h:125
void DrawCylinder(const Vec3d &point1, const Vec3d &point2, float radius1, float radius2, const float color[3])
Data structure for the representation of a 3D rigid body transformation.
Definition: Math3d.h:105
GLUquadric * m_pQuadric
void DrawSphere(const Vec3d &point, float radius, const float *pColor=0)


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28