Developer Documentation
gl.hh
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 
51 //=============================================================================
52 // overload some GL functions
53 //=============================================================================
54 
55 
56 #ifndef ACG_GLTEXT_HH
57 #define ACG_GLTEXT_HH
58 
59 
60 //== INCLUDES =================================================================
61 
62 #include <ACG/Config/ACGDefines.hh>
63 
64 
65 #if defined(ARCH_DARWIN)
66 
67  #include <glut.h>
68  #include <OpenGL/gl.h>
69 
70 #elif defined(WIN32)
71 
72  #include <windows.h>
73  // Dont do this anymore! Use dll version. No problems with plugins and dll
74  // but a lot with static linking
75  // # define GLEW_STATIC 1
76  #include <gl/glew.h>
77  #include <gl/glut.h>
78 
79 #else
80 
81  #include <GL/glut.h>
82  #include <GL/gl.h>
83 
84 #endif
85 
86 #include "../Math/VectorT.hh"
87 
88 
89 //=============================================================================
90 namespace ACG {
91 //=============================================================================
92 
93 
94 //-------------------------------------------------------------------- glVertex
95 
97 inline void glVertex(const Vec2i& _v) { glVertex2i(_v[0], _v[1]); }
99 inline void glVertex(const Vec2f& _v) { glVertex2fv(_v.data()); }
101 inline void glVertex(const Vec2d& _v) { glVertex2dv(_v.data()); }
102 
104 inline void glVertex(const Vec3f& _v) { glVertex3fv(_v.data()); }
106 inline void glVertex(const Vec3d& _v) { glVertex3dv(_v.data()); }
107 
109 inline void glVertex(const Vec4f& _v) { glVertex4fv(_v.data()); }
111 inline void glVertex(const Vec4d& _v) { glVertex4dv(_v.data()); }
112 
113 
114 
115 //------------------------------------------------------------------- glTexCoord
116 
118 inline void glTexCoord(const Vec2f& _t) { glTexCoord2fv(_t.data()); }
120 inline void glTexCoord(const Vec2d& _t) { glTexCoord2dv(_t.data()); }
121 
123 inline void glTexCoord(const Vec3f& _t) { glTexCoord3fv(_t.data()); }
125 inline void glTexCoord(const Vec3d& _t) { glTexCoord3dv(_t.data()); }
126 
128 inline void glTexCoord(const Vec4f& _t) { glTexCoord4fv(_t.data()); }
130 inline void glTexCoord(const Vec4d& _t) { glTexCoord4dv(_t.data()); }
131 
132 
133 
134 //--------------------------------------------------------------------- glNormal
135 
137 inline void glNormal(const Vec3f& _n) { glNormal3fv(_n.data()); }
139 inline void glNormal(const Vec3d& _n) { glNormal3dv(_n.data()); }
140 
141 
142 
143 //---------------------------------------------------------------------- glColor
144 
146 inline void glColor(const Vec3f& _v) { glColor3fv(_v.data()); }
148 inline void glColor(const Vec3uc& _v) { glColor3ubv(_v.data()); }
149 
151 inline void glColor(const Vec4f& _v) { glColor4fv(_v.data()); }
153 inline void glColor(const Vec4uc& _v) { glColor4ubv(_v.data()); }
154 
155 
156 
157 //-------------------------------------------------------------- ACG::GLState::vertexPointer
158 /*
160 inline void glVertexPointer(const Vec2f* _p)
161 { ::ACG::GLState::vertexPointer(2, GL_FLOAT, 0, _p); }
163 inline void ACG::GLState::vertexPointer(const Vec2d* _p)
164 { ::ACG::GLState::vertexPointer(2, GL_DOUBLE, 0, _p); }
165 
167 inline void ACG::GLState::vertexPointer(const Vec3f* _p)
168 { ::ACG::GLState::vertexPointer(3, GL_FLOAT, 0, _p); }
170 inline void ACG::GLState::vertexPointer(const Vec3d* _p)
171 { ::ACG::GLState::vertexPointer(3, GL_DOUBLE, 0, _p); }
172 
174 inline void ACG::GLState::vertexPointer(const Vec4f* _p)
175 { ::ACG::GLState::vertexPointer(4, GL_FLOAT, 0, _p); }
177 inline void ACG::GLState::vertexPointer(const Vec4d* _p)
178 { ::ACG::GLState::vertexPointer(4, GL_DOUBLE, 0, _p); }
179 
181 inline void ACG::GLState::vertexPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
182 { ::ACG::GLState::vertexPointer(n, t, s, p); }
183 
184 
185 
186 //-------------------------------------------------------------- ACG::GLState::normalPointer
187 
189 inline void ACG::GLState::normalPointer(const Vec3f* _p)
190 { ::ACG::GLState::normalPointer(GL_FLOAT, 0, _p); }
192 inline void ACG::GLState::normalPointer(const Vec3d* _p)
193 { ::ACG::GLState::normalPointer(GL_DOUBLE, 0, _p); }
194 
196 inline void ACG::GLState::normalPointer(GLenum t, GLsizei s, const GLvoid *p)
197 { ::ACG::GLState::normalPointer(t, s, p); }
198 
199 
200 
201 //--------------------------------------------------------------- ACG::GLState::colorPointer
202 
204 inline void ACG::GLState::colorPointer(const Vec3uc* _p)
205 { ::ACG::GLState::colorPointer(3, GL_UNSIGNED_BYTE, 0, _p); }
207 inline void ACG::GLState::colorPointer(const Vec3f* _p)
208 { ::ACG::GLState::colorPointer(3, GL_FLOAT, 0, _p); }
209 
211 inline void ACG::GLState::colorPointer(const Vec4uc* _p)
212 { ::ACG::GLState::colorPointer(4, GL_UNSIGNED_BYTE, 0, _p); }
214 inline void ACG::GLState::colorPointer(const Vec4f* _p)
215 { ::ACG::GLState::colorPointer(4, GL_FLOAT, 0, _p); }
216 
218 inline void ACG::GLState::colorPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
219 { ::ACG::GLState::colorPointer(n, t, s, p); }
220 
221 
222 
223 //------------------------------------------------------------ ACG::GLState::texcoordPointer
224 
226 inline void ACG::GLState::texcoordPointer(const float* _p)
227 { ::ACG::GLState::texcoordPointer(1, GL_FLOAT, 0, _p); }
229 inline void ACG::GLState::texcoordPointer(const double* _p)
230 { ::ACG::GLState::texcoordPointer(1, GL_DOUBLE, 0, _p); }
231 
233 inline void ACG::GLState::texcoordPointer(const Vec2f* _p)
234 { ::ACG::GLState::texcoordPointer(2, GL_FLOAT, 0, _p); }
236 inline void ACG::GLState::texcoordPointer(const Vec2d* _p)
237 { ::ACG::GLState::texcoordPointer(2, GL_DOUBLE, 0, _p); }
238 
240 inline void ACG::GLState::texcoordPointer(const Vec3f* _p)
241 { ::ACG::GLState::texcoordPointer(3, GL_FLOAT, 0, _p); }
243 inline void ACG::GLState::texcoordPointer(const Vec3d* _p)
244 { ::ACG::GLState::texcoordPointer(3, GL_DOUBLE, 0, _p); }
245 
247 inline void ACG::GLState::texcoordPointer(const Vec4f* _p)
248 { ::ACG::GLState::texcoordPointer(4, GL_FLOAT, 0, _p); }
250 inline void ACG::GLState::texcoordPointer(const Vec4d* _p)
251 { ::ACG::GLState::texcoordPointer(4, GL_DOUBLE, 0, _p); }
252 
254 inline void ACG::GLState::texcoordPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
255 { ::ACG::GLState::texcoordPointer(n, t, s, p); }
256 */
257 
258 
261 bool ACGDLLEXPORT checkExtensionSupported( const std::string& _extension ) ;
262 
265 bool ACGDLLEXPORT openGLVersion( const int _major, const int _minor );
266 
267 
268 //=============================================================================
269 } // namespace ACG
270 //=============================================================================
271 #endif // ACG_GLTEXT_HH defined
272 //=============================================================================
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
Definition: gl.hh:146
void glNormal(const Vec3f &_n)
Wrapper: glNormal for Vec3f.
Definition: gl.hh:137
void glVertex(const Vec2i &_v)
Wrapper: glVertex for Vec2i.
Definition: gl.hh:97
bool openGLVersion(const int _major, const int _minor)
Definition: gl.cc:95
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
void glTexCoord(const Vec2f &_t)
Wrapper: glTexCoord for Vec2f.
Definition: gl.hh:118
bool checkExtensionSupported(const std::string &_extension)
Definition: gl.cc:73
Scalar * data()
access to Scalar array
Definition: Vector11T.hh:193