00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OST_GFX_GL_HELPER_HH
00024 #define OST_GFX_GL_HELPER_HH
00025
00026
00027
00028
00029
00030 #ifdef OST_GFX_GLEXT_INCLUDE_HH
00031 #error gl_helper.hh must be included before any occurence of glext_include.hh
00032 #endif
00033 #ifdef OST_GFX_GL_INCLUDE_HH
00034 #error gl_helper.hh must be included before any occurence of gl_include.hh
00035 #endif
00036 #include <ost/geom/vec3.hh>
00037
00038 #include "glext_include.hh"
00039
00040 #include <ost/log.hh>
00041
00042 inline void check_gl_error(const std::string& m="")
00043 {
00044 #ifndef NDEBUG
00045 GLenum error_code;
00046 if((error_code=glGetError())!=GL_NO_ERROR) {
00047 if(!m.empty()) {
00048 LOG_VERBOSE("GL error in [" << m << "]: " << gluErrorString(error_code));
00049 }
00050 }
00051 #endif
00052 }
00053
00054 inline void glVertex3v(double* v){
00055 glVertex3dv(v);
00056 }
00057
00058 inline void glVertex3v(const double* v){
00059 glVertex3dv(v);
00060 }
00061
00062 inline void glVertex3v(float* v){
00063 glVertex3fv(v);
00064 }
00065
00066
00067 inline void glVertex3v(const float* v){
00068 glVertex3fv(v);
00069 }
00070
00071 inline void glVertex3(const geom::Vec3& v)
00072 {
00073 glVertex3v(&v[0]);
00074 }
00075
00076 inline void glMultMatrix(float* v) {
00077 glMultMatrixf(v);
00078 }
00079
00080 inline void glMultMatrix(double* v) {
00081 glMultMatrixd(v);
00082 }
00083
00084 inline void glNormal3v(double* v){
00085 glNormal3dv(v);
00086 }
00087
00088 inline void glNormal3v(float* v){
00089 glNormal3fv(v);
00090 }
00091
00092 inline void glTexCoord2v(float* v){
00093 glTexCoord2fv(v);
00094 }
00095
00096 inline void glTexCoord2v(double* v){
00097 glTexCoord2dv(v);
00098 }
00099
00100
00101 inline void glGetv(GLenum pname, double* v){
00102 glGetDoublev(pname, v);
00103 }
00104
00105 inline void glGetv(GLenum pname, float* v){
00106 glGetFloatv(pname, v);
00107 }
00108
00109
00110 inline void glLoadMatrix(float* arr) {
00111 glLoadMatrixf(arr);
00112 }
00113
00114 inline void glLoadMatrix(double* arr) {
00115 glLoadMatrixd(arr);
00116 }
00117
00118 #if OST_SHADER_SUPPORT_ENABLED
00119
00120 inline void glLoadTransposeMatrix(float* arr) {
00121 glLoadTransposeMatrixf(arr);
00122 }
00123
00124 inline void glLoadTransposeMatrix(double* arr) {
00125 glLoadTransposeMatrixd(arr);
00126 }
00127
00128 #endif
00129
00130 #endif