MeVisLab Toolbox Reference
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 ()
 Initializes the OpenGL information and GLEW, returns true if everything is ok. More...
 
static const std::string & getVendorString ()
 Returns the OpenGL vendor string. More...
 
static const std::string & getRendererString ()
 Returns the OpenGL driver string. More...
 
static const std::string & getVersionString ()
 Return the OpenGL version string. More...
 
static bool isMesaSoftwareRenderer ()
 Returns whether the OpenGL driver is the Mesa software renderer (typically llvmpipe). More...
 
static bool supports10Bit ()
 Returns whether the OpenGL driver supports visible 10-bit OpenGL contexts. More...
 
static bool supportsRenderTo3DTexture ()
 Returns whether rendering to 3D textures is supported by FrameBufferObjects. More...
 
static bool supportsPBO ()
 Returns whether PixelBufferObjects are supported. More...
 
static GLint getVideoMemorySizeInMB ()
 Returns the maximum available video memory size in MB. More...
 
static GLint getMaxTextureSize ()
 Returns the maximum 2D texture size (using GL_MAX_TEXTURE_SIZE). More...
 
static GLint getMaxTextureSize3D ()
 Returns the maximum 3D texture size (using GL_MAX_3D_TEXTURE_SIZE). More...
 
static GLint getMaxTextureImageUnits ()
 Returns the maximum available texture units (using GL_MAX_TEXTURE_IMAGE_UNITS). More...
 
static GLint getMaxVertexAttributes ()
 Returns the maximum available vertex attributes (using GL_MAX_VERTEX_ATTRIBS). More...
 
static GLint getMaxVaryingFloats ()
 Returns the maximum available varying floats (using GL_MAX_VARYING_FLOATS). More...
 
static GLint getMaxSmoothLineWidth ()
 Returns the maximum size of a supported smooth line width. More...
 
static GLint getMaxClipPlanes ()
 Returns the maximum number of clip planes. More...
 
static GLint getMaxLights ()
 Returns the maximum number of lights. More...
 
static bool isSupported (const char *extension)
 Checks whether the given extension is supported. More...
 
static void clearTextureUnitsAndShaders ()
 This method binds the 0 target to all texture units and ARB/GLSL shaders. More...
 
static void disableAllClipPlanes ()
 Disables all clip planes (needs a valid OpenGL context!). More...
 
static void disableAllLights ()
 Disables all lights (needs a valid OpenGL context!). More...
 
static std::string uniformTypeToString (GLenum type)
 Returns the uniform type as string. More...
 
static std::string getUniformValue (GLint program, GLint uniform, GLenum type)
 Returns the uniform value as string. More...
 
static void getActiveUniforms (GLuint program, std::vector< TypeInfo > &uniforms, bool withValues)
 Returns the active uniforms from a shader. More...
 
static const char * internalFormatToString (GLuint format)
 Returns the internal GL format as string;. More...
 

Detailed Description

MeVis OpenGL Information Interface (Singleton)

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 methods that provide 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 https://glew.sourceforge.net/

Definition at line 58 of file mlOpenGL.h.

Member Function Documentation

◆ clearTextureUnitsAndShaders()

static void OpenGL::clearTextureUnitsAndShaders ( )
static

This method binds the 0 target to all texture units and ARB/GLSL shaders.

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 OpenGL::disableAllClipPlanes ( )
static

Disables all clip planes (needs a valid OpenGL context!).

◆ disableAllLights()

static void OpenGL::disableAllLights ( )
static

Disables all lights (needs a valid OpenGL context!).

◆ getActiveUniforms()

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

Returns the active uniforms from a shader.

◆ getMaxClipPlanes()

static GLint OpenGL::getMaxClipPlanes ( )
static

Returns the maximum number of clip planes.

◆ getMaxLights()

static GLint OpenGL::getMaxLights ( )
static

Returns the maximum number of lights.

◆ getMaxSmoothLineWidth()

static GLint OpenGL::getMaxSmoothLineWidth ( )
static

Returns the maximum size of a supported smooth line width.

◆ getMaxTextureImageUnits()

static GLint OpenGL::getMaxTextureImageUnits ( )
static

Returns the maximum available texture units (using GL_MAX_TEXTURE_IMAGE_UNITS).

◆ getMaxTextureSize()

static GLint OpenGL::getMaxTextureSize ( )
static

Returns the maximum 2D texture size (using GL_MAX_TEXTURE_SIZE).

◆ getMaxTextureSize3D()

static GLint OpenGL::getMaxTextureSize3D ( )
static

Returns the maximum 3D texture size (using GL_MAX_3D_TEXTURE_SIZE).

◆ getMaxVaryingFloats()

static GLint OpenGL::getMaxVaryingFloats ( )
static

Returns the maximum available varying floats (using GL_MAX_VARYING_FLOATS).

◆ getMaxVertexAttributes()

static GLint OpenGL::getMaxVertexAttributes ( )
static

Returns the maximum available vertex attributes (using GL_MAX_VERTEX_ATTRIBS).

◆ getRendererString()

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

Returns the OpenGL driver string.

◆ getUniformValue()

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

Returns the uniform value as string.

◆ getVendorString()

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

Returns the OpenGL vendor string.

◆ getVersionString()

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

Return the OpenGL version string.

◆ getVideoMemorySizeInMB()

static GLint OpenGL::getVideoMemorySizeInMB ( )
static

Returns the maximum available video memory size in MB.

This attempts to use OpenGL extensions to detect the available size for OpenGL and has a fallback to use OS routines to detect the actual size. On the Mesa software renderer, 512 MB is returned as a 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 OpenGL::init ( )
static

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

◆ internalFormatToString()

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

Returns the internal GL format as string;.

◆ isMesaSoftwareRenderer()

static bool OpenGL::isMesaSoftwareRenderer ( )
inlinestatic

Returns whether the OpenGL driver is the Mesa software renderer (typically llvmpipe).

Definition at line 74 of file mlOpenGL.h.

◆ isSupported()

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

Checks whether the given extension is supported.

◆ supports10Bit()

static bool OpenGL::supports10Bit ( )
inlinestatic

Returns whether the OpenGL driver supports visible 10-bit OpenGL contexts.

Definition at line 77 of file mlOpenGL.h.

◆ supportsPBO()

static bool OpenGL::supportsPBO ( )
static

Returns whether PixelBufferObjects are supported.

◆ supportsRenderTo3DTexture()

static bool OpenGL::supportsRenderTo3DTexture ( )
static

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

◆ uniformTypeToString()

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

Returns the uniform type as string.


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