00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef ACG_GLTEXT_HH
00050 #define ACG_GLTEXT_HH
00051
00052
00053
00054
00055 #include <stdlib.h>
00056
00057
00058 #if defined(ARCH_DARWIN)
00059
00060 #include <GL/glew.h>
00061 #include <glut.h>
00062 #include <OpenGL/gl.h>
00063 #include <OpenGL/glu.h>
00064
00065 #elif defined(WIN32)
00066
00067 #include <windows.h>
00068
00069
00070
00071 #include <gl/glew.h>
00072 #include <gl/glut.h>
00073
00074 #else
00075
00076 #include <GL/glew.h>
00077 #include <GL/glut.h>
00078 #include <GL/gl.h>
00079 #include <GL/glu.h>
00080
00081 #endif
00082
00083 #include "../Math/VectorT.hh"
00084
00085
00086
00087 namespace ACG {
00088
00089
00090
00091
00092
00094 inline void glVertex(const Vec2i& _v) { glVertex2i(_v[0], _v[1]); }
00096 inline void glVertex(const Vec2f& _v) { glVertex2fv(_v.data()); }
00098 inline void glVertex(const Vec2d& _v) { glVertex2dv(_v.data()); }
00099
00101 inline void glVertex(const Vec3f& _v) { glVertex3fv(_v.data()); }
00103 inline void glVertex(const Vec3d& _v) { glVertex3dv(_v.data()); }
00104
00106 inline void glVertex(const Vec4f& _v) { glVertex4fv(_v.data()); }
00108 inline void glVertex(const Vec4d& _v) { glVertex4dv(_v.data()); }
00109
00110
00111
00112
00113
00115 inline void glTexCoord(const Vec2f& _t) { glTexCoord2fv(_t.data()); }
00117 inline void glTexCoord(const Vec2d& _t) { glTexCoord2dv(_t.data()); }
00118
00120 inline void glTexCoord(const Vec3f& _t) { glTexCoord3fv(_t.data()); }
00122 inline void glTexCoord(const Vec3d& _t) { glTexCoord3dv(_t.data()); }
00123
00125 inline void glTexCoord(const Vec4f& _t) { glTexCoord4fv(_t.data()); }
00127 inline void glTexCoord(const Vec4d& _t) { glTexCoord4dv(_t.data()); }
00128
00129
00130
00131
00132
00134 inline void glNormal(const Vec3f& _n) { glNormal3fv(_n.data()); }
00136 inline void glNormal(const Vec3d& _n) { glNormal3dv(_n.data()); }
00137
00138
00139
00140
00141
00143 inline void glColor(const Vec3f& _v) { glColor3fv(_v.data()); }
00145 inline void glColor(const Vec3uc& _v) { glColor3ubv(_v.data()); }
00146
00148 inline void glColor(const Vec4f& _v) { glColor4fv(_v.data()); }
00150 inline void glColor(const Vec4uc& _v) { glColor4ubv(_v.data()); }
00151
00152
00153
00154
00155
00157 inline void glVertexPointer(const Vec2f* _p)
00158 { ::glVertexPointer(2, GL_FLOAT, 0, _p); }
00160 inline void glVertexPointer(const Vec2d* _p)
00161 { ::glVertexPointer(2, GL_DOUBLE, 0, _p); }
00162
00164 inline void glVertexPointer(const Vec3f* _p)
00165 { ::glVertexPointer(3, GL_FLOAT, 0, _p); }
00167 inline void glVertexPointer(const Vec3d* _p)
00168 { ::glVertexPointer(3, GL_DOUBLE, 0, _p); }
00169
00171 inline void glVertexPointer(const Vec4f* _p)
00172 { ::glVertexPointer(4, GL_FLOAT, 0, _p); }
00174 inline void glVertexPointer(const Vec4d* _p)
00175 { ::glVertexPointer(4, GL_DOUBLE, 0, _p); }
00176
00178 inline void glVertexPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
00179 { ::glVertexPointer(n, t, s, p); }
00180
00181
00182
00183
00184
00186 inline void glNormalPointer(const Vec3f* _p)
00187 { ::glNormalPointer(GL_FLOAT, 0, _p); }
00189 inline void glNormalPointer(const Vec3d* _p)
00190 { ::glNormalPointer(GL_DOUBLE, 0, _p); }
00191
00193 inline void glNormalPointer(GLenum t, GLsizei s, const GLvoid *p)
00194 { ::glNormalPointer(t, s, p); }
00195
00196
00197
00198
00199
00201 inline void glColorPointer(const Vec3uc* _p)
00202 { ::glColorPointer(3, GL_UNSIGNED_BYTE, 0, _p); }
00204 inline void glColorPointer(const Vec3f* _p)
00205 { ::glColorPointer(3, GL_FLOAT, 0, _p); }
00206
00208 inline void glColorPointer(const Vec4uc* _p)
00209 { ::glColorPointer(4, GL_UNSIGNED_BYTE, 0, _p); }
00211 inline void glColorPointer(const Vec4f* _p)
00212 { ::glColorPointer(4, GL_FLOAT, 0, _p); }
00213
00215 inline void glColorPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
00216 { ::glColorPointer(n, t, s, p); }
00217
00218
00219
00220
00221
00223 inline void glTexCoordPointer(const float* _p)
00224 { ::glTexCoordPointer(1, GL_FLOAT, 0, _p); }
00226 inline void glTexCoordPointer(const double* _p)
00227 { ::glTexCoordPointer(1, GL_DOUBLE, 0, _p); }
00228
00230 inline void glTexCoordPointer(const Vec2f* _p)
00231 { ::glTexCoordPointer(2, GL_FLOAT, 0, _p); }
00233 inline void glTexCoordPointer(const Vec2d* _p)
00234 { ::glTexCoordPointer(2, GL_DOUBLE, 0, _p); }
00235
00237 inline void glTexCoordPointer(const Vec3f* _p)
00238 { ::glTexCoordPointer(3, GL_FLOAT, 0, _p); }
00240 inline void glTexCoordPointer(const Vec3d* _p)
00241 { ::glTexCoordPointer(3, GL_DOUBLE, 0, _p); }
00242
00244 inline void glTexCoordPointer(const Vec4f* _p)
00245 { ::glTexCoordPointer(4, GL_FLOAT, 0, _p); }
00247 inline void glTexCoordPointer(const Vec4d* _p)
00248 { ::glTexCoordPointer(4, GL_DOUBLE, 0, _p); }
00249
00251 inline void glTexCoordPointer(GLint n, GLenum t, GLsizei s, const GLvoid *p)
00252 { ::glTexCoordPointer(n, t, s, p); }
00253
00254
00255
00256
00257
00258
00262 inline void glCheckErrors()
00263 {
00264 GLenum error;
00265 while ((error = glGetError()) != GL_NO_ERROR)
00266 {
00267 std::cerr << "GL error: " << gluErrorString(error) << std::endl;
00268 }
00269 }
00270
00271
00272
00273 }
00274
00275 #endif // ACG_GLTEXT_HH defined
00276