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 #include <OpenGL/gl.h>
59
60#elif defined(WIN32)
61
62 #include <windows.h>
63 // Dont do this anymore! Use dll version. No problems with plugins and dll
64 // but a lot with static linking
65 // # define GLEW_STATIC 1
66 #include <gl/glew.h>
67
68#else
69
70 #include <GL/gl.h>
71
72#endif
73
74
75// qt refers to outdated include guard of glext.h, set the old guard if the
76// new one is defined:
77#ifdef __gl_glext_h_
78# ifndef __glext_h_
79# define __glext_h_ 1
80# endif
81#endif
82
83
84#include "../Math/VectorT.hh"
85
86
87//=============================================================================
88namespace ACG {
89//=============================================================================
90
91
92//-------------------------------------------------------------------- glVertex
93
95inline void glVertex(const Vec2i& _v) { glVertex2i(_v[0], _v[1]); }
97inline void glVertex(const Vec2f& _v) { glVertex2fv(_v.data()); }
99inline void glVertex(const Vec2d& _v) { glVertex2dv(_v.data()); }
100
102inline void glVertex(const Vec3f& _v) { glVertex3fv(_v.data()); }
104inline void glVertex(const Vec3d& _v) { glVertex3dv(_v.data()); }
105
107inline void glVertex(const Vec4f& _v) { glVertex4fv(_v.data()); }
109inline void glVertex(const Vec4d& _v) { glVertex4dv(_v.data()); }
110
111
112
113//------------------------------------------------------------------- glTexCoord
114
116inline void glTexCoord(const Vec2f& _t) { glTexCoord2fv(_t.data()); }
118inline void glTexCoord(const Vec2d& _t) { glTexCoord2dv(_t.data()); }
119
121inline void glTexCoord(const Vec3f& _t) { glTexCoord3fv(_t.data()); }
123inline void glTexCoord(const Vec3d& _t) { glTexCoord3dv(_t.data()); }
124
126inline void glTexCoord(const Vec4f& _t) { glTexCoord4fv(_t.data()); }
128inline void glTexCoord(const Vec4d& _t) { glTexCoord4dv(_t.data()); }
129
130
131
132//--------------------------------------------------------------------- glNormal
133
135inline void glNormal(const Vec3f& _n) { glNormal3fv(_n.data()); }
137inline void glNormal(const Vec3d& _n) { glNormal3dv(_n.data()); }
138
139
140
141//---------------------------------------------------------------------- glColor
142
144inline void glColor(const Vec3f& _v) { glColor3fv(_v.data()); }
146inline void glColor(const Vec3uc& _v) { glColor3ubv(_v.data()); }
147
149inline void glColor(const Vec4f& _v) { glColor4fv(_v.data()); }
151inline void glColor(const Vec4uc& _v) { glColor4ubv(_v.data()); }
152
153
154
155//-------------------------------------------------------------- ACG::GLState::vertexPointer
156/*
158inline void glVertexPointer(const Vec2f* _p)
159{ ::ACG::GLState::vertexPointer(2, GL_FLOAT, 0, _p); }
161inline void ACG::GLState::vertexPointer(const Vec2d* _p)
162{ ::ACG::GLState::vertexPointer(2, GL_DOUBLE, 0, _p); }
163
165inline void ACG::GLState::vertexPointer(const Vec3f* _p)
166{ ::ACG::GLState::vertexPointer(3, GL_FLOAT, 0, _p); }
168inline void ACG::GLState::vertexPointer(const Vec3d* _p)
169{ ::ACG::GLState::vertexPointer(3, GL_DOUBLE, 0, _p); }
170
172inline void ACG::GLState::vertexPointer(const Vec4f* _p)
173{ ::ACG::GLState::vertexPointer(4, GL_FLOAT, 0, _p); }
175inline void ACG::GLState::vertexPointer(const Vec4d* _p)
176{ ::ACG::GLState::vertexPointer(4, GL_DOUBLE, 0, _p); }
177
179inline void ACG::GLState::vertexPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
180{ ::ACG::GLState::vertexPointer(n, t, s, p); }
181
182
183
184//-------------------------------------------------------------- ACG::GLState::normalPointer
185
187inline void ACG::GLState::normalPointer(const Vec3f* _p)
188{ ::ACG::GLState::normalPointer(GL_FLOAT, 0, _p); }
190inline void ACG::GLState::normalPointer(const Vec3d* _p)
191{ ::ACG::GLState::normalPointer(GL_DOUBLE, 0, _p); }
192
194inline void ACG::GLState::normalPointer(GLenum t, GLsizei s, const GLvoid *p)
195{ ::ACG::GLState::normalPointer(t, s, p); }
196
197
198
199//--------------------------------------------------------------- ACG::GLState::colorPointer
200
202inline void ACG::GLState::colorPointer(const Vec3uc* _p)
203{ ::ACG::GLState::colorPointer(3, GL_UNSIGNED_BYTE, 0, _p); }
205inline void ACG::GLState::colorPointer(const Vec3f* _p)
206{ ::ACG::GLState::colorPointer(3, GL_FLOAT, 0, _p); }
207
209inline void ACG::GLState::colorPointer(const Vec4uc* _p)
210{ ::ACG::GLState::colorPointer(4, GL_UNSIGNED_BYTE, 0, _p); }
212inline void ACG::GLState::colorPointer(const Vec4f* _p)
213{ ::ACG::GLState::colorPointer(4, GL_FLOAT, 0, _p); }
214
216inline void ACG::GLState::colorPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
217{ ::ACG::GLState::colorPointer(n, t, s, p); }
218
219
220
221//------------------------------------------------------------ ACG::GLState::texcoordPointer
222
224inline void ACG::GLState::texcoordPointer(const float* _p)
225{ ::ACG::GLState::texcoordPointer(1, GL_FLOAT, 0, _p); }
227inline void ACG::GLState::texcoordPointer(const double* _p)
228{ ::ACG::GLState::texcoordPointer(1, GL_DOUBLE, 0, _p); }
229
231inline void ACG::GLState::texcoordPointer(const Vec2f* _p)
232{ ::ACG::GLState::texcoordPointer(2, GL_FLOAT, 0, _p); }
234inline void ACG::GLState::texcoordPointer(const Vec2d* _p)
235{ ::ACG::GLState::texcoordPointer(2, GL_DOUBLE, 0, _p); }
236
238inline void ACG::GLState::texcoordPointer(const Vec3f* _p)
239{ ::ACG::GLState::texcoordPointer(3, GL_FLOAT, 0, _p); }
241inline void ACG::GLState::texcoordPointer(const Vec3d* _p)
242{ ::ACG::GLState::texcoordPointer(3, GL_DOUBLE, 0, _p); }
243
245inline void ACG::GLState::texcoordPointer(const Vec4f* _p)
246{ ::ACG::GLState::texcoordPointer(4, GL_FLOAT, 0, _p); }
248inline void ACG::GLState::texcoordPointer(const Vec4d* _p)
249{ ::ACG::GLState::texcoordPointer(4, GL_DOUBLE, 0, _p); }
250
252inline void ACG::GLState::texcoordPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
253{ ::ACG::GLState::texcoordPointer(n, t, s, p); }
254*/
255
262std::string ACGDLLEXPORT getExtensionString( ) ;
263
266bool ACGDLLEXPORT checkExtensionSupported( const std::string& _extension ) ;
267
270bool ACGDLLEXPORT openGLVersion( const int _major, const int _minor, bool verbose = true );
271
275inline bool ACGDLLEXPORT openGLVersionTest( const int _major, const int _minor ){return openGLVersion(_major, _minor, false);}
276
278void ACGDLLEXPORT compatibilityProfile(bool _compatProfile);
279
281bool ACGDLLEXPORT compatibilityProfile( );
282
283//=============================================================================
284} // namespace ACG
285//=============================================================================
286#endif // ACG_GLTEXT_HH defined
287//=============================================================================
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:144
void glNormal(const Vec3f &_n)
Wrapper: glNormal for Vec3f.
Definition gl.hh:135
bool ACGDLLEXPORT openGLVersionTest(const int _major, const int _minor)
Definition gl.hh:275
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:95
void glTexCoord(const Vec2f &_t)
Wrapper: glTexCoord for Vec2f.
Definition gl.hh:116
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