GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Related Functions | List of all members
Glip::CoreGL::HandleOpenGL Class Reference

Main OpenGL Handle. More...

#include <OglInclude.hpp>

Public Types

enum  SupportedVendor {
  vd_NVIDIA,
  vd_AMDATI,
  vd_INTEL,
  vd_UNKNOWN
}
 ID of the supported hardware vendors. More...
 

Public Member Functions

 HandleOpenGL (void)
 Initialize Glew and other tools for the OpenGL state machine. More...
 

Static Public Member Functions

static void init (void)
 Initialize Glew and other tools for the OpenGL state machine. More...
 
static void deinit (void)
 Deinitialize Glew and other tools for the OpenGL state machine. More...
 
static bool isInitialized (void)
 Test if the context was already initialized. More...
 
static SupportedVendor getVendorID (void)
 
static std::string getVendorName (void)
 
static std::string getRendererName (void)
 
static std::string getVersion (void)
 
static void getVersion (int &major, int &minor)
 Get the major and minor version number for OpenGL. More...
 
static std::string getGLSLVersion (void)
 
static std::vector< std::string > getAvailableGLSLVersions (void)
 Get the list of available GLSL version. More...
 
static unsigned int getShaderTypeIndex (GLenum shaderType)
 Get the index of a shader type. More...
 

Static Public Attributes

static const unsigned int numShaderTypes = GLIP_NUM_SHADER_TYPES
 Number of different shader types.
 
static const GLenum shaderTypes [GLIP_NUM_SHADER_TYPES] = {GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER}
 List (tight) of various shader types.
 

Related Functions

(Note that these are not member functions.)

template< size_t N > bool belongsToGLEnums (const GLenum &p, const GLenum(&l)[N])
 Test if a symbol belongs to a list of possible symbols. More...
 
std::string getGLErrorDescription (const GLenum &e)
 Get the description for a particular error code. More...
 
void debugGL (void)
 Print the current binding points state on std::cout (GL_TEXTURE_BINDING_1D, GL_TEXTURE_BINDING_2D, GL_TEXTURE_BINDING_3D, GL_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_PIXEL_PACK_BUFFER_BINDING, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_FRAMEBUFFER_BINDING, GL_TEXTURE_BUFFER_EXT, GL_CURRENT_PROGRAM).
 
std::string getGLEnumName (const GLenum &p)
 Get the parameter name as a string. More...
 
std::string getGLEnumNameSafe (const GLenum &p)
 Get the parameter name as a string. More...
 
GLenum getGLEnum (const std::string &s)
 Get the parameter from its name in a string. More...
 
bool belongsToGLEnums (const GLenum &p, const GLenum *l, const size_t s)
 Test if a symbol belongs to a list of possible symbols. More...
 

Detailed Description

Main OpenGL Handle.

Member Enumeration Documentation

ID of the supported hardware vendors.

Enumerator
vd_NVIDIA 

For NVIDIA.

vd_AMDATI 

For AMD/ATI.

vd_INTEL 

For INTEL.

vd_UNKNOWN 

When unknown.

Constructor & Destructor Documentation

HandleOpenGL::HandleOpenGL ( void  )

Initialize Glew and other tools for the OpenGL state machine.

You have to create one object of this type before functions using OpenGL.

Member Function Documentation

void HandleOpenGL::deinit ( void  )
static

Deinitialize Glew and other tools for the OpenGL state machine.

You have to call this function when the context has been created with HandleOpenGL::init.

std::vector< std::string > HandleOpenGL::getAvailableGLSLVersions ( void  )
static

Get the list of available GLSL version.

Returns
A vector of string containing the available GLSL versions.
std::string HandleOpenGL::getGLSLVersion ( void  )
static
Returns
A std::string object containing the GLSL version or an empty string if the OpenGL version is less than 2.0.
std::string HandleOpenGL::getRendererName ( void  )
static
Returns
A std::string object containing the renderer name.
unsigned int HandleOpenGL::getShaderTypeIndex ( GLenum  shaderType)
static

Get the index of a shader type.

Parameters
shaderTypeThe shader type : GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER.
Returns
The index associated with the type.
HandleOpenGL::SupportedVendor HandleOpenGL::getVendorID ( void  )
static
Returns
The ID (HandleOpenGL::SupportedVendor) of the Hardware vendor for this platform.
std::string HandleOpenGL::getVendorName ( void  )
static
Returns
A std::string object containing the vendor name.
std::string HandleOpenGL::getVersion ( void  )
static
Returns
A std::string object containing the OpenGL version.
void HandleOpenGL::getVersion ( int &  major,
int &  minor 
)
static

Get the major and minor version number for OpenGL.

/fn void HandleOpenGL::getVersion(int& major, int& minor)

Parameters
majorThe major number of the version.
minorThe minor number of the version.
void HandleOpenGL::init ( void  )
static

Initialize Glew and other tools for the OpenGL state machine.

When using this function, you MUST make an explicit call to HandleOpenGL::deinit when exiting program.

bool HandleOpenGL::isInitialized ( void  )
static

Test if the context was already initialized.

Returns
True if the context was initialized (and not terminated).

Friends And Related Function Documentation

template< size_t N > bool belongsToGLEnums ( const GLenum &  p,
const GLenum(&)  l[N] 
)
related

Test if a symbol belongs to a list of possible symbols.

Parameters
pSymbol to be tested.
lList of symbols.
Returns
True if the symbol belongs to the list.

Sample usage :

const GLenum list[] = {GL_RED, GL_LUMINANCE, GL_RGB, GL_RGBA};
bool test = belongsToGLEnums(symbol, list);
bool belongsToGLEnums ( const GLenum &  p,
const GLenum *  l,
const size_t  s 
)
related

Test if a symbol belongs to a list of possible symbols.

Parameters
pSymbol to be tested.
lList of symbols.
sSize of the list, in bytes (from sizeof, for instance).
Returns
True if the symbol belongs to the list.

Sample usage :

const GLenum[] list = {GL_RED, GL_LUMINANCE, GL_RGB, GL_RGBA};
bool test = belongsToGLEnums(symbol, list, sizeof(list));
GLenum getGLEnum ( const std::string &  s)
related

Get the parameter from its name in a string.

Parameters
sThe GLenum parameter name.
Returns
The corresponding enum or throw an exception if no enum was found.
std::string getGLEnumName ( const GLenum &  p)
related

Get the parameter name as a string.

Parameters
pThe GLenum parameter.
Returns
A standard string.
std::string getGLEnumNameSafe ( const GLenum &  p)
related

Get the parameter name as a string.

Parameters
pThe GLenum parameter.
Returns
A standard string or <Unknown:ID> where ID is the decimal representation of the enum.
std::string getGLErrorDescription ( const GLenum &  e)
related

Get the description for a particular error code.

Parameters
eThe GL error code.
Returns
A std::string containing a description of the error or a string with the error code if it is unknown.

The documentation for this class was generated from the following files: