MeVisLab Resolution Independence API
ml::OpenGL Class Reference

MeVis OpenGL Information Interface (Singleton) More...

#include <mlOpenGL.h>

Classes

struct  TypeInfo
 Struct to store infos about a type, e.g. about a uniform. More...
 

Static Public Member Functions

static bool init ()
 initialize the OpenGL information and GLEW, returns true if everything is ok
 
static const std::string & getVendorString ()
 get the open gl vendor string
 
static const std::string & getRendererString ()
 get the open gl driver string
 
static const std::string & getVersionString ()
 get the open gl version string
 
static bool isMesaSoftwareRenderer ()
 returns if the OpenGL driver is the Mesa software renderer (typically llvmpipe).
 
static bool supports10Bit ()
 returns if the OpenGL driver supports visible 10bit OpenGL contexts.
 
static bool supportsRenderTo3DTexture ()
 Returns if rendering to 3D textures is supported by FrameBufferObjects.
 
static bool supportsPBO ()
 Returns if PixelBufferObjects are supported.
 
static GLint getVideoMemorySizeInMB ()
 Returns the maximum available video memory size in MB.
 
static GLint getMaxTextureSize ()
 returns max 2d texture size (using GL_MAX_TEXTURE_SIZE)
 
static GLint getMaxTextureSize3D ()
 returns max 3d texture size (using GL_MAX_3D_TEXTURE_SIZE)
 
static GLint getMaxTextureImageUnits ()
 returns max available texture units (using GL_MAX_TEXTURE_IMAGE_UNITS)
 
static GLint getMaxVertexAttributes ()
 returns max available vertex attributes (using GL_MAX_VERTEX_ATTRIBS)
 
static GLint getMaxVaryingFloats ()
 returns max available varying floats ( using GL_MAX_VARYING_FLOATS )
 
static GLint getMaxSmoothLineWidth ()
 returns max size of a supported smooth line width
 
static GLint getMaxClipPlanes ()
 returns max number of clip planes
 
static GLint getMaxLights ()
 returns max number of lights
 
static bool isSupported (const char *extension)
 check if the given extension is supported
 
static void clearTextureUnitsAndShaders ()
 this method binds the 0 target to all texture units and ARB/GLSL shaders and it should be called in code that causes ATI OGL driver crashes when resources are freed in a shared context and have been previously bound in the original context (even if the state was popped afterwards) NOTE: needs a valid OpenGL context
 
static void disableAllClipPlanes ()
 disables all clip planes (needs a valid OpenGL context!)
 
static void disableAllLights ()
 disables all lights (needs a valid OpenGL context!)
 
static std::string uniformTypeToString (GLenum type)
 Get uniform type as string.
 
static std::string getUniformValue (GLint program, GLint uniform, GLenum type)
 Get uniform value as string.
 
static void getActiveUniforms (GLuint program, std::vector< TypeInfo > &uniforms, bool withValues)
 Get the active uniforms from a shader.
 
static const char * internalFormatToString (GLuint format)
 Returns the internal GL format as string;.
 

Detailed Description

MeVis OpenGL Information Interface (Singleton)

At MeVis we use the GLEW library, which is initialized in the init() call of this class. In addition to the API provided by GLEW, this class has some additional methods that give information on the underlying OpenGL system. All methods of this class can be called WITHOUT having a valid OpenGL context, given that the init() method was called once at program startup. Projects that use the OpenGL API or extensions should typically specify

CONFIG += MLOpenGL

in their profile and include

include <mlOpenGL.h>

This will also include the appropriate GLEW OpenGL header files.

See also
GLEW documentation at http://glew.sourceforge.net/

Definition at line 58 of file mlOpenGL.h.

Member Function Documentation

◆ clearTextureUnitsAndShaders()

static void ml::OpenGL::clearTextureUnitsAndShaders ( )
static

this method binds the 0 target to all texture units and ARB/GLSL shaders and it should be called in code that causes ATI OGL driver crashes when resources are freed in a shared context and have been previously bound in the original context (even if the state was popped afterwards) NOTE: needs a valid OpenGL context

◆ disableAllClipPlanes()

static void ml::OpenGL::disableAllClipPlanes ( )
static

disables all clip planes (needs a valid OpenGL context!)

◆ disableAllLights()

static void ml::OpenGL::disableAllLights ( )
static

disables all lights (needs a valid OpenGL context!)

◆ getActiveUniforms()

static void ml::OpenGL::getActiveUniforms ( GLuint program,
std::vector< TypeInfo > & uniforms,
bool withValues )
static

Get the active uniforms from a shader.

◆ getMaxClipPlanes()

static GLint ml::OpenGL::getMaxClipPlanes ( )
static

returns max number of clip planes

◆ getMaxLights()

static GLint ml::OpenGL::getMaxLights ( )
static

returns max number of lights

◆ getMaxSmoothLineWidth()

static GLint ml::OpenGL::getMaxSmoothLineWidth ( )
static

returns max size of a supported smooth line width

◆ getMaxTextureImageUnits()

static GLint ml::OpenGL::getMaxTextureImageUnits ( )
static

returns max available texture units (using GL_MAX_TEXTURE_IMAGE_UNITS)

◆ getMaxTextureSize()

static GLint ml::OpenGL::getMaxTextureSize ( )
static

returns max 2d texture size (using GL_MAX_TEXTURE_SIZE)

◆ getMaxTextureSize3D()

static GLint ml::OpenGL::getMaxTextureSize3D ( )
static

returns max 3d texture size (using GL_MAX_3D_TEXTURE_SIZE)

◆ getMaxVaryingFloats()

static GLint ml::OpenGL::getMaxVaryingFloats ( )
static

returns max available varying floats ( using GL_MAX_VARYING_FLOATS )

◆ getMaxVertexAttributes()

static GLint ml::OpenGL::getMaxVertexAttributes ( )
static

returns max available vertex attributes (using GL_MAX_VERTEX_ATTRIBS)

◆ getRendererString()

static const std::string & ml::OpenGL::getRendererString ( )
static

get the open gl driver string

◆ getUniformValue()

static std::string ml::OpenGL::getUniformValue ( GLint program,
GLint uniform,
GLenum type )
static

Get uniform value as string.

◆ getVendorString()

static const std::string & ml::OpenGL::getVendorString ( )
static

get the open gl vendor string

◆ getVersionString()

static const std::string & ml::OpenGL::getVersionString ( )
static

get the open gl version string

◆ getVideoMemorySizeInMB()

static GLint ml::OpenGL::getVideoMemorySizeInMB ( )
static

Returns the maximum available video memory size in MB.

This tries to use OpenGL extensions to detect the size that is available for OpenGL and has a fallback to use OS routines to detect the size. On the Mesa Software Renderer, 512 MB are returned as default value, since the renderer is quite slow and it does not make sense to use a large amount of video memory.

◆ init()

static bool ml::OpenGL::init ( )
static

initialize the OpenGL information and GLEW, returns true if everything is ok

◆ internalFormatToString()

static const char * ml::OpenGL::internalFormatToString ( GLuint format)
static

Returns the internal GL format as string;.

◆ isMesaSoftwareRenderer()

static bool ml::OpenGL::isMesaSoftwareRenderer ( )
inlinestatic

returns if the OpenGL driver is the Mesa software renderer (typically llvmpipe).

Definition at line 74 of file mlOpenGL.h.

◆ isSupported()

static bool ml::OpenGL::isSupported ( const char * extension)
static

check if the given extension is supported

◆ supports10Bit()

static bool ml::OpenGL::supports10Bit ( )
inlinestatic

returns if the OpenGL driver supports visible 10bit OpenGL contexts.

Definition at line 77 of file mlOpenGL.h.

◆ supportsPBO()

static bool ml::OpenGL::supportsPBO ( )
static

Returns if PixelBufferObjects are supported.

◆ supportsRenderTo3DTexture()

static bool ml::OpenGL::supportsRenderTo3DTexture ( )
static

Returns if rendering to 3D textures is supported by FrameBufferObjects.

◆ uniformTypeToString()

static std::string ml::OpenGL::uniformTypeToString ( GLenum type)
static

Get uniform type as string.


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