Developer Documentation
Loading...
Searching...
No Matches
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// overload some GL functions
44//=============================================================================
45
46
47#ifndef ACG_GLTEXT_HH
48#define ACG_GLTEXT_HH
49
50
51//== INCLUDES =================================================================
52
53#include <ACG/Config/ACGDefines.hh>
54
55
56#if defined(ARCH_DARWIN)
57
58 #define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
59 #include <OpenGL/gl.h>
60
61#elif defined(WIN32)
62
63 #include <windows.h>
64 // Dont do this anymore! Use dll version. No problems with plugins and dll
65 // but a lot with static linking
66 // # define GLEW_STATIC 1
67 #include <gl/glew.h>
68
69#else
70
71 #include <GL/gl.h>
72
73#endif
74
75
76// qt refers to outdated include guard of glext.h, set the old guard if the
77// new one is defined:
78#ifdef __gl_glext_h_
79# ifndef __glext_h_
80# define __glext_h_ 1
81# endif
82#endif
83
84
85#include "../Math/VectorT.hh"
86
87
88//=============================================================================
89namespace ACG {
90//=============================================================================
91
92
93//-------------------------------------------------------------------- glVertex
94
96inline void glVertex(const Vec2i& _v) { glVertex2i(_v[0], _v[1]); }
98inline void glVertex(const Vec2f& _v) { glVertex2fv(_v.data()); }
100inline void glVertex(const Vec2d& _v) { glVertex2dv(_v.data()); }
101
103inline void glVertex(const Vec3f& _v) { glVertex3fv(_v.data()); }
105inline void glVertex(const Vec3d& _v) { glVertex3dv(_v.data()); }
106
108inline void glVertex(const Vec4f& _v) { glVertex4fv(_v.data()); }
110inline void glVertex(const Vec4d& _v) { glVertex4dv(_v.data()); }
111
112
113
114//------------------------------------------------------------------- glTexCoord
115
117inline void glTexCoord(const Vec2f& _t) { glTexCoord2fv(_t.data()); }
119inline void glTexCoord(const Vec2d& _t) { glTexCoord2dv(_t.data()); }
120
122inline void glTexCoord(const Vec3f& _t) { glTexCoord3fv(_t.data()); }
124inline void glTexCoord(const Vec3d& _t) { glTexCoord3dv(_t.data()); }
125
127inline void glTexCoord(const Vec4f& _t) { glTexCoord4fv(_t.data()); }
129inline void glTexCoord(const Vec4d& _t) { glTexCoord4dv(_t.data()); }
130
131
132
133//--------------------------------------------------------------------- glNormal
134
136inline void glNormal(const Vec3f& _n) { glNormal3fv(_n.data()); }
138inline void glNormal(const Vec3d& _n) { glNormal3dv(_n.data()); }
139
140
141
142//---------------------------------------------------------------------- glColor
143
145inline void glColor(const Vec3f& _v) { glColor3fv(_v.data()); }
147inline void glColor(const Vec3uc& _v) { glColor3ubv(_v.data()); }
148
150inline void glColor(const Vec4f& _v) { glColor4fv(_v.data()); }
152inline void glColor(const Vec4uc& _v) { glColor4ubv(_v.data()); }
153
154
155
156//-------------------------------------------------------------- ACG::GLState::vertexPointer
157/*
159inline void glVertexPointer(const Vec2f* _p)
160{ ::ACG::GLState::vertexPointer(2, GL_FLOAT, 0, _p); }
162inline void ACG::GLState::vertexPointer(const Vec2d* _p)
163{ ::ACG::GLState::vertexPointer(2, GL_DOUBLE, 0, _p); }
164
166inline void ACG::GLState::vertexPointer(const Vec3f* _p)
167{ ::ACG::GLState::vertexPointer(3, GL_FLOAT, 0, _p); }
169inline void ACG::GLState::vertexPointer(const Vec3d* _p)
170{ ::ACG::GLState::vertexPointer(3, GL_DOUBLE, 0, _p); }
171
173inline void ACG::GLState::vertexPointer(const Vec4f* _p)
174{ ::ACG::GLState::vertexPointer(4, GL_FLOAT, 0, _p); }
176inline void ACG::GLState::vertexPointer(const Vec4d* _p)
177{ ::ACG::GLState::vertexPointer(4, GL_DOUBLE, 0, _p); }
178
180inline void ACG::GLState::vertexPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
181{ ::ACG::GLState::vertexPointer(n, t, s, p); }
182
183
184
185//-------------------------------------------------------------- ACG::GLState::normalPointer
186
188inline void ACG::GLState::normalPointer(const Vec3f* _p)
189{ ::ACG::GLState::normalPointer(GL_FLOAT, 0, _p); }
191inline void ACG::GLState::normalPointer(const Vec3d* _p)
192{ ::ACG::GLState::normalPointer(GL_DOUBLE, 0, _p); }
193
195inline void ACG::GLState::normalPointer(GLenum t, GLsizei s, const GLvoid *p)
196{ ::ACG::GLState::normalPointer(t, s, p); }
197
198
199
200//--------------------------------------------------------------- ACG::GLState::colorPointer
201
203inline void ACG::GLState::colorPointer(const Vec3uc* _p)
204{ ::ACG::GLState::colorPointer(3, GL_UNSIGNED_BYTE, 0, _p); }
206inline void ACG::GLState::colorPointer(const Vec3f* _p)
207{ ::ACG::GLState::colorPointer(3, GL_FLOAT, 0, _p); }
208
210inline void ACG::GLState::colorPointer(const Vec4uc* _p)
211{ ::ACG::GLState::colorPointer(4, GL_UNSIGNED_BYTE, 0, _p); }
213inline void ACG::GLState::colorPointer(const Vec4f* _p)
214{ ::ACG::GLState::colorPointer(4, GL_FLOAT, 0, _p); }
215
217inline void ACG::GLState::colorPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
218{ ::ACG::GLState::colorPointer(n, t, s, p); }
219
220
221
222//------------------------------------------------------------ ACG::GLState::texcoordPointer
223
225inline void ACG::GLState::texcoordPointer(const float* _p)
226{ ::ACG::GLState::texcoordPointer(1, GL_FLOAT, 0, _p); }
228inline void ACG::GLState::texcoordPointer(const double* _p)
229{ ::ACG::GLState::texcoordPointer(1, GL_DOUBLE, 0, _p); }
230
232inline void ACG::GLState::texcoordPointer(const Vec2f* _p)
233{ ::ACG::GLState::texcoordPointer(2, GL_FLOAT, 0, _p); }
235inline void ACG::GLState::texcoordPointer(const Vec2d* _p)
236{ ::ACG::GLState::texcoordPointer(2, GL_DOUBLE, 0, _p); }
237
239inline void ACG::GLState::texcoordPointer(const Vec3f* _p)
240{ ::ACG::GLState::texcoordPointer(3, GL_FLOAT, 0, _p); }
242inline void ACG::GLState::texcoordPointer(const Vec3d* _p)
243{ ::ACG::GLState::texcoordPointer(3, GL_DOUBLE, 0, _p); }
244
246inline void ACG::GLState::texcoordPointer(const Vec4f* _p)
247{ ::ACG::GLState::texcoordPointer(4, GL_FLOAT, 0, _p); }
249inline void ACG::GLState::texcoordPointer(const Vec4d* _p)
250{ ::ACG::GLState::texcoordPointer(4, GL_DOUBLE, 0, _p); }
251
253inline void ACG::GLState::texcoordPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
254{ ::ACG::GLState::texcoordPointer(n, t, s, p); }
255*/
256
263std::string ACGDLLEXPORT getExtensionString( ) ;
264
267bool ACGDLLEXPORT checkExtensionSupported( const std::string& _extension ) ;
268
271bool ACGDLLEXPORT openGLVersion( const int _major, const int _minor, bool verbose = true );
272
276inline bool ACGDLLEXPORT openGLVersionTest( const int _major, const int _minor ){return openGLVersion(_major, _minor, false);}
277
279void ACGDLLEXPORT compatibilityProfile(bool _compatProfile);
280
282bool ACGDLLEXPORT compatibilityProfile( );
283
284//=============================================================================
285} // namespace ACG
286//=============================================================================
287#endif // ACG_GLTEXT_HH defined
288//=============================================================================
Scalar * data()
access to Scalar array
Definition Vector11T.hh:201
Namespace providing different geometric functions concerning angles.
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.
Definition gl.hh:145
void glNormal(const Vec3f &_n)
Wrapper: glNormal for Vec3f.
Definition gl.hh:136
bool ACGDLLEXPORT openGLVersionTest(const int _major, const int _minor)
Definition gl.hh:276
bool checkExtensionSupported(const std::string &_extension)
Definition gl.cc:107
bool openGLVersion(const int _major, const int _minor, bool _verbose)
Definition gl.cc:129
void glVertex(const Vec2i &_v)
Wrapper: glVertex for Vec2i.
Definition gl.hh:96
void glTexCoord(const Vec2f &_t)
Wrapper: glTexCoord for Vec2f.
Definition gl.hh:117
std::string getExtensionString()
getExtensionString returns a string containing all supported OpenGL extensions this function uses the...
Definition gl.cc:100
bool compatibilityProfile()
get opengl core profile setting
Definition gl.cc:171