![]() |
TAPs 0.7.7.3
|
#include "TAPsOpenGLEnumList.hpp"#include "../Core/TAPsLib.hpp"#include "wx/wx.h"#include "STAPsGLFns.cpp"
Include dependency graph for STAPsGLFns.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Defines | |
| #define | CHECK_GL_ERROR() GFnCheckGLError( __FILE__, __LINE__ ) |
| #define | CHECK_GL_ERROR_MESSAGE(s) GFnCheckGLError( s ) |
| #define | CHECK_FRAMEBUFFER_STATUS() GFnCheckFrameBufferStatus() |
Functions | |
| BEGIN_NAMESPACE_TAPs__OpenGL__Fn void | GFnCheckGLError (char *file, int line, int *glErrCode=NULL) |
| void | GFnCheckGLError (char *customMessage, int *glErrCode=NULL) |
| void | GFnCheckFrameBufferStatus () |
| void | SetFrontFaceCCW (bool=true) |
| void | SetFrontFaceCW (bool=true) |
| void | ToggleFrontFaceOriantation () |
| void | EnableCullFace () |
| void | DisableCullFace () |
| void | ToggleCullFace () |
| void | SetDrawingMode (GLenum face, GLenum mode) |
| void | SwitchDrawingMode () |
| void | SwitchDrawFaceMode () |
| void | SwitchCullFaceMode () |
| template<typename T > | |
| Matrix4x4< T > | CalShadowProjectionMatrix (Vector4< T > const &lightPos, Vector4< T > const &planeEqn) |
| #define CHECK_FRAMEBUFFER_STATUS | ( | ) | GFnCheckFrameBufferStatus() |
Definition at line 72 of file STAPsGLFns.hpp.
| #define CHECK_GL_ERROR | ( | ) | GFnCheckGLError( __FILE__, __LINE__ ) |
Definition at line 33 of file STAPsGLFns.hpp.
| #define CHECK_GL_ERROR_MESSAGE | ( | s | ) | GFnCheckGLError( s ) |
Definition at line 52 of file STAPsGLFns.hpp.
| Matrix4x4<T> CalShadowProjectionMatrix | ( | Vector4< T > const & | lightPos, |
| Vector4< T > const & | planeEqn | ||
| ) |
Definition at line 337 of file STAPsGLFns.cpp.
{
T dot = planeEqn*lightPos;
return Matrix4x4<T> (
dot - lightPos[0]*planeEqn[0],
dot - lightPos[0]*planeEqn[1],
dot - lightPos[0]*planeEqn[2],
dot - lightPos[0]*planeEqn[3],
dot - lightPos[1]*planeEqn[0],
dot - lightPos[1]*planeEqn[1],
dot - lightPos[1]*planeEqn[2],
dot - lightPos[1]*planeEqn[3],
dot - lightPos[2]*planeEqn[0],
dot - lightPos[2]*planeEqn[1],
dot - lightPos[2]*planeEqn[2],
dot - lightPos[2]*planeEqn[3],
dot - lightPos[3]*planeEqn[0],
dot - lightPos[3]*planeEqn[1],
dot - lightPos[3]*planeEqn[2],
dot - lightPos[3]*planeEqn[3]
);
}
| void DisableCullFace | ( | ) | [inline] |
Definition at line 222 of file STAPsGLFns.cpp.
{ glDisable( GL_CULL_FACE ); }
| void EnableCullFace | ( | ) | [inline] |
Definition at line 219 of file STAPsGLFns.cpp.
{ glEnable( GL_CULL_FACE ); }
| void GFnCheckFrameBufferStatus | ( | ) |
Use TAPs::OpenGL::Fn::CHECK_GL_ERROR() which is a macro for GFnCheckGLError( __FILE__, __LINE__ ) to printout GL errors that are accumulated due to OpenGL commands.
This function is a no-op function if the TAPs_DEBUG_MODE preprocessor symbol is not defined.
Definition at line 178 of file STAPsGLFns.cpp.
{}
| void GFnCheckGLError | ( | char * | customMessage, |
| int * | glErrCode | ||
| ) |
Use TAPs::OpenGL::Fn::CHECK_GL_ERROR_MESSAGE( char * customMessage ) which is a macro for GFnCheckGLError( s ) to printout GL errors that are accumulated due to OpenGL commands.
<customMessage> is a string that can be used to indicate the location or message where the error check occurs.
This function is a no-op function if the TAPs_DEBUG_MODE preprocessor symbol is not defined.
Definition at line 79 of file STAPsGLFns.cpp.
{
GLenum glErr = glGetError();
int errCode = 0;
while ( glErr != GL_NO_ERROR ) {
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "%s --> GL Error #%d (%s)!" ),
customMessage, glErr, gluErrorString(glErr) );
#else
std::cerr
<< customMessage << " --> GL Error #" << glErr
<< " (" << gluErrorString(glErr) << ")!" << std::endl;
#endif
errCode = 1;
glErr = glGetError();
}
if ( glErrCode ) *glErrCode = errCode;
}
| BEGIN_NAMESPACE_TAPs__OpenGL__Fn void GFnCheckGLError | ( | char * | file, |
| int | line, | ||
| int * | glErrCode | ||
| ) |
Use TAPs::OpenGL::Fn::CHECK_GL_ERROR() which is a macro for GFnCheckGLError( __FILE__, __LINE__ ) to printout GL errors that are accumulated due to OpenGL commands.
This function is a no-op function if the TAPs_DEBUG_MODE preprocessor symbol is not defined.
Definition at line 43 of file STAPsGLFns.cpp.
{
GLenum glErr = glGetError();
int errCode = 0;
while ( glErr != GL_NO_ERROR ) {
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "GL Error #%d (%s) in file %s at line#%d" ),
glErr, gluErrorString(glErr), file, line );
#else
std::cout
<< "GL Error #" << glErr << " (" << gluErrorString(glErr) << ") "
<< "in file " << file << " at line#" << line << std::endl;
#endif
errCode = 1;
glErr = glGetError();
}
if ( glErrCode ) *glErrCode = errCode;
}
| void SetDrawingMode | ( | GLenum | face, |
| GLenum | mode | ||
| ) | [inline] |
Definition at line 240 of file STAPsGLFns.cpp.
{
glPolygonMode( face, mode );
glCullFace( face );
glEnable( GL_CULL_FACE );
}
| void SetFrontFaceCCW | ( | bool | = true | ) | [inline] |
Definition at line 195 of file STAPsGLFns.cpp.
{
if ( b ) glFrontFace( GL_CCW );
else glFrontFace( GL_CW );
}
| void SetFrontFaceCW | ( | bool | = true | ) | [inline] |
Definition at line 202 of file STAPsGLFns.cpp.
{
SetFrontFaceCCW( !b );
}
| void SwitchCullFaceMode | ( | ) |
Definition at line 301 of file STAPsGLFns.cpp.
{
GLint cullFace;
glGetIntegerv( GL_CULL_FACE_MODE, &cullFace );
switch ( cullFace ) {
case GL_FRONT:
cullFace = GL_BACK;
break;
case GL_BACK:
cullFace = GL_FRONT_AND_BACK;
break;
case GL_FRONT_AND_BACK:
cullFace = GL_FRONT;
break;
}
glCullFace( cullFace );
// if ( GL_BACK == g_eCullFace ) g_eCullFace = GL_FRONT;
// else if ( GL_FRONT == g_eCullFace ) g_eCullFace = GL_FRONT_AND_BACK;
// else g_eCullFace = GL_BACK;
// glCullFace( g_eCullFace );
}
| void SwitchDrawFaceMode | ( | ) |
Definition at line 275 of file STAPsGLFns.cpp.
{
GLint DrawFaceAndMode[2];
glGetIntegerv( GL_POLYGON_MODE, DrawFaceAndMode );
switch ( DrawFaceAndMode[0] ) {
case GL_FRONT:
DrawFaceAndMode[0] = GL_BACK;
break;
case GL_BACK:
DrawFaceAndMode[0] = GL_FRONT_AND_BACK;
break;
case GL_FRONT_AND_BACK:
DrawFaceAndMode[0] = GL_FRONT;
break;
}
glPolygonMode( DrawFaceAndMode[0], DrawFaceAndMode[1] );
// if ( GL_FRONT == g_eCullFace ) g_eCullFace = GL_BACK;
// else if ( GL_BACK == g_eCullFace ) g_eCullFace = GL_FRONT_AND_BACK;
// else g_eCullFace = GL_FRONT;
// glPolygonMode( g_eDrawFace, g_eDrawMode );
}
| void SwitchDrawingMode | ( | ) |
Definition at line 250 of file STAPsGLFns.cpp.
{
GLint DrawFaceAndMode[2];
glGetIntegerv( GL_POLYGON_MODE, DrawFaceAndMode );
switch ( DrawFaceAndMode[1] ) {
case GL_POINT:
DrawFaceAndMode[1] = GL_LINE;
break;
case GL_LINE:
DrawFaceAndMode[1] = GL_FILL;
break;
case GL_FILL:
DrawFaceAndMode[1] = GL_POINT;
break;
}
glPolygonMode( DrawFaceAndMode[0], DrawFaceAndMode[1] );
//++g_eDrawMode;
//if ( g_eDrawMode > GL_FILL ) g_eDrawMode = GL_POINT;
//glPolygonMode( g_eDrawFace, g_eDrawMode );
}
| void ToggleCullFace | ( | ) | [inline] |
Definition at line 225 of file STAPsGLFns.cpp.
{
if ( glIsEnabled( GL_CULL_FACE ) ) glDisable( GL_CULL_FACE );
else glEnable ( GL_CULL_FACE );
}
| void ToggleFrontFaceOriantation | ( | ) | [inline] |
Definition at line 208 of file STAPsGLFns.cpp.
{
GLint value;
glGetIntegerv( GL_FRONT_FACE, &value );
if ( GL_CCW == value )
glEnable( GL_CW );
else
glEnable( GL_CCW );
}