![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 STAPsGLFns.hpp 00003 00004 Global OpenGL Functions in TAPs::OpenGL::Fn namespace 00005 00006 SUKITTI PUNAK (09/10/2010) 00007 UPDATE (09/10/2010) 00008 ******************************************************************************/ 00009 #ifndef STAPs_GL_FNS_HPP 00010 #define STAPs_GL_FNS_HPP 00011 00012 #include "TAPsOpenGLEnumList.hpp" 00013 #include "../Core/TAPsLib.hpp" 00014 00015 #ifdef TAPs_USE_WXWIDGETS 00016 #include "wx/wx.h" 00017 #endif 00018 00019 BEGIN_NAMESPACE_TAPs__OpenGL__Fn 00020 //============================================================================= 00021 // START: OPENGL DEBUG/ERROR 00022 //----------------------------------------------------------------------------- 00023 // Check OpenGL Error 00032 void GFnCheckGLError ( char * file, int line, int * glErrCode = NULL ); 00033 #define CHECK_GL_ERROR() GFnCheckGLError( __FILE__, __LINE__ ) 00034 //----------------------------------------------------------------------------- 00035 // Check OpenGL Error with Custom Message 00047 //#ifdef TAPs_DEBUG_MODE 00048 void GFnCheckGLError ( char * customMessage, int * glErrCode = NULL ); 00049 //#else 00050 // void GFnCheckGLError ( char * customMessage, int * glErrCode = NULL ); 00051 //#endif 00052 #define CHECK_GL_ERROR_MESSAGE( s ) GFnCheckGLError( s ) 00053 //----------------------------------------------------------------------------- 00054 // Check OpenGL Frame Buffer Status 00063 #ifdef TAPs_DEBUG_MODE 00064 //#ifdef TAPs_USE_GLSL 00065 void GFnCheckFrameBufferStatus (); 00066 //#else 00067 // void GFnCheckFrameBufferStatus (); 00068 //#endif 00069 #else 00070 void GFnCheckFrameBufferStatus (); 00071 #endif 00072 #define CHECK_FRAMEBUFFER_STATUS() GFnCheckFrameBufferStatus() 00073 //----------------------------------------------------------------------------- 00074 // END: OPENGL DEBUG/ERROR 00075 //============================================================================= 00076 00077 00078 //============================================================================= 00079 // START: OPENGL DRAWING 00080 //----------------------------------------------------------------------------- 00081 // Set Polygon Face Oriantation with CCW 00082 inline void SetFrontFaceCCW( bool = true ); 00083 //----------------------------------------------------------------------------- 00084 // Set Polygon Face Oriantation with CW 00085 inline void SetFrontFaceCW( bool = true ); 00086 //----------------------------------------------------------------------------- 00087 // Toggle Polygon Face Oriantation: CCW <--> CW 00088 inline void ToggleFrontFaceOriantation(); 00089 //----------------------------------------------------------------------------- 00090 // Enable OpenGL Cull Face 00091 inline void EnableCullFace(); 00092 //----------------------------------------------------------------------------- 00093 // Disable OpenGL Cull Face 00094 inline void DisableCullFace(); 00095 //----------------------------------------------------------------------------- 00096 // Toggle OpenGL Cull Face 00097 inline void ToggleCullFace(); 00098 //----------------------------------------------------------------------------- 00099 // Set Drawing Mode 00100 // face (GLenum) can be 00101 // GL_FRONT_AND_BACK = 1032 00102 // GL_FRONT = 1028 00103 // GL_BACK = 1029 00104 // mode (GLenum) can be 00105 // GL_POINT = 6912 00106 // GL_LINE = 6913 00107 // GL_FILL = 6914 00108 inline void SetDrawingMode( GLenum face, GLenum mode ); 00109 //----------------------------------------------------------------------------- 00110 // Switch Drawing Mode 00111 // the drawing mode is switched circularly from 00112 // GL_POINT, GL_LINE, and GL_FILL 00113 void SwitchDrawingMode(); 00114 //----------------------------------------------------------------------------- 00115 // Switch Draw Face Mode 00116 // the draw face mode is switched circularly from 00117 // GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK 00118 void SwitchDrawFaceMode(); 00119 //----------------------------------------------------------------------------- 00120 // Switch Cull Face Mode 00121 // the cull face mode is switched circularly from 00122 // GL_BACK, GL_FRONT, and GL_FRONT_AND_BACK 00123 void SwitchCullFaceMode(); 00124 //----------------------------------------------------------------------------- 00125 // END: OPENGL DRAWING 00126 //============================================================================= 00127 00128 00129 //============================================================================= 00130 // START: SHADOW FUNCTIONS 00131 //----------------------------------------------------------------------------- 00132 // Create a shadow projection matrix out of the plane equation 00133 // lightPos ==> { xPos, yPos, zPos, 1 } 00134 // planeEqn ==> a*x + b*y + c*z + d = 0 00135 template <typename T> 00136 Matrix4x4<T> CalShadowProjectionMatrix ( Vector4<T> const &lightPos, Vector4<T> const &planeEqn ); 00137 //----------------------------------------------------------------------------- 00138 // END: SHADOW FUNCTIONS 00139 //============================================================================= 00140 00141 //============================================================================= 00142 END_NAMESPACE_TAPs__OpenGL__Fn 00143 //----------------------------------------------------------------------------- 00144 // Include definition if TAPs_USE_EXPORT is not defined 00145 #if !defined( TAPs_USE_EXPORT ) 00146 #include "STAPsGLFns.cpp" 00147 #endif 00148 //----------------------------------------------------------------------------- 00149 #endif 00150 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00151 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8