![]() |
TAPs 0.7.7.3
|
#include <GL/glew.h>#include <GL/wglew.h>#include <GL/gl.h>#include "../Core/TAPsLib.hpp"#include "../OpenGL/TAPsOpenGLFns.hpp"#include <iostream>#include <fstream>#include <vector>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <fcntl.h>#include <wx/wx.h>#include "TAPsGLSLFns.cpp"
Include dependency graph for TAPsGLSLFns.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| class | GLSLShader |
| class | GLSLVertexShader |
| class | GLSLGeometryShader |
| class | GLSLFragmentShader |
| class | GLSLProgramObject |
| class | GLSLShaderManager |
| To simplify the process of loading/compiling/linking shaders, this high level interface to setup vertex, geometry, and fragment shaders has been created. More... | |
Defines | |
| #define | TAPs_USE_GLSL |
| #define | GLEW_STATIC 1 |
Functions | |
| bool | GFnInitGLSL () |
| bool | GFnCheckGLSL () |
| bool | GFnCheckGL2 () |
| #define GLEW_STATIC 1 |
Definition at line 56 of file TAPsGLSLFns.hpp.
| #define TAPs_USE_GLSL |
There are four (actually five) classes:
class GLSLVertexShader, derived from class GLSLShader, represents a GLSL vertex shader object.
class GLSLGeometryShader, derived from class GLSLShader, represents a GLSL geometry shader object.
class GLSLFragmentShader, derived from class GLSLShader, represents a GLSL fragment shader object.
class GLSLProgramObject represents a GLSL shader program object.
class GLSLShaderManager is for simplifing the process of loading/compiling/linking shaders.
Currently Load methods of GLSLShaderManager can only be used to create one vertex shader and one fragment shader and a GLSLProgramobject created by the load method.
Definition at line 34 of file TAPsGLSLFns.hpp.
| bool GFnCheckGL2 | ( | ) |
Definition at line 199 of file TAPsGLARBVertexBufferObject.cpp.
References gbIsInitialized, and GFnInitGLSL().
{
if ( !gbIsInitialized ) GFnInitGLSL();
return GLEW_VERSION_2_0 == GL_TRUE;
}
Here is the call graph for this function:| bool GFnCheckGLSL | ( | ) |
Definition at line 138 of file TAPsGLARBVertexBufferObject.cpp.
{
if ( gbIsGLSLSupported ) return true; // GLSL is available and initailized
//---------------------------------------------------------------
if ( !gbIsInitialized ) GFnInitGLSL();
//---------------------------------------------------------------
#ifdef TAPs_DEBUG_MODE
#ifdef TAPs_USE_WXWIDGETS
if ( GLEW_VERSION_2_0 )
wxLogError( wxT( "OpenGL 2.0 is available!" ) );
else if ( GLEW_VERSION_1_5 )
wxLogError( wxT( "OpenGL 1.5 is available!" ) );
else if ( GLEW_VERSION_1_4 )
wxLogError( wxT( "OpenGL 1.4 is available!" ) );
else if ( GLEW_VERSION_1_3 )
wxLogError( wxT( "OpenGL 1.3 is available!" ) );
else if ( GLEW_VERSION_1_2 )
wxLogError( wxT( "OpenGL 1.2 is available!" ) );
#else
if ( GLEW_VERSION_2_0 )
std::cout << "OpenGL 2.0 is available!\n";
else if ( GLEW_VERSION_1_5 )
std::cout << "OpenGL 1.5 is available!\n";
else if ( GLEW_VERSION_1_4 )
std::cout << "OpenGL 1.4 is available!\n";
else if ( GLEW_VERSION_1_3 )
std::cout << "OpenGL 1.3 is available!\n";
else if ( GLEW_VERSION_1_2 )
std::cout << "OpenGL 1.2 is available!\n";
#endif
#endif
//---------------------------------------------------------------
// Ensure we have the necessary OpenGL Shading Language extensions.
if (glewGetExtension("GL_ARB_fragment_shader") != GL_TRUE ||
glewGetExtension("GL_ARB_vertex_shader") != GL_TRUE ||
glewGetExtension("GL_ARB_shader_objects") != GL_TRUE ) //||
//glewGetExtension("GL_ARB_shading_language_100") != GL_TRUE)
{
#ifdef TAPs_DEBUG_MODE
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "[FAILIED] OpenGL Shading Language is NOT available!" ) );
#else
std::cout << "[FAILIED] OpenGL Shading Language is NOT available!\n";
#endif
#endif
gbIsGLSLSupported = false;
}
else {
#ifdef TAPs_DEBUG_MODE
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "[OK] OpenGL Shading Language is available!" ) );
#else
std::cout << "[OK] OpenGL Shading Language is available!\n";
#endif
#endif
gbIsGLSLSupported = true;
}
//---------------------------------------------------------------
return gbIsGLSLSupported;
}
| bool GFnInitGLSL | ( | ) |
Definition at line 102 of file TAPsGLARBVertexBufferObject.cpp.
{
if ( gbIsGLSLSupported ) return true; // GLSL has already been initialized
//---------------------------------------------------------------
// Initialize the "OpenGL Extension Wrangler" library
if ( gbIsInitialized ) return true;
gbIsInitialized = true;
GLenum err = glewInit();
if ( GLEW_OK != err ) {
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "Error: %s" ), glewGetErrorString( err ) );
#else
std::cerr << "Error: " << glewGetErrorString( err ) << std::endl;
#endif
gbIsGLSLSupported = false;
return gbIsGLSLSupported;
}
//---------------------------------------------------------------
// OpenGL Info
#ifdef TAPs_DEBUG_MODE
#ifdef TAPs_USE_WXWIDGETS
wxLogError( wxT( "OpenGL Vendor: %s" ), glGetString( GL_VENDOR ) );
wxLogError( wxT( "OpenGL Renderer: %s" ), glGetString( GL_RENDERER ) );
wxLogError( wxT( "OpenGL Version: %s" ), glGetString( GL_VERSION ) );
#else
std::cout << "OpenGL Vendor: " << glGetString( GL_VENDOR ) << "\n";
std::cout << "OpenGL Renderer: " << glGetString( GL_RENDERER ) << "\n";
std::cout << "OpenGL Version: " << glGetString( GL_VERSION ) << "\n";
#endif
#endif
//---------------------------------------------------------------
GFnCheckGLSL();
//---------------------------------------------------------------
return gbIsGLSLSupported;
}