Uranium
Application Framework
UM.View.GL.OpenGL.OpenGL Class Reference

Convenience methods for dealing with OpenGL. More...

Classes

class  Vendor
 Different OpenGL chipset vendors. More...
 

Public Member Functions

def __init__ (self)
 
def hasFrameBufferObjects (self)
 Check if the current OpenGL implementation supports FrameBuffer Objects. More...
 
def getOpenGLVersion (self)
 Get the current OpenGL version. More...
 
def getGPUVendorName (self)
 Get the current GPU vendor name. More...
 
def getGPUVendor (self)
 Get the current GPU vendor. More...
 
def getGPUType (self)
 Get a string describing the current GPU type. More...
 
def getBindingsObject (self)
 Get the OpenGL bindings object. More...
 
def createFrameBufferObject
 Create a FrameBuffer Object. More...
 
def createTexture (self)
 Create a Texture Object. More...
 
def createShaderProgram
 Create a ShaderProgram Object. More...
 
def createVertexBuffer
 Create a Vertex buffer for a mesh. More...
 
def createIndexBuffer
 Create an index buffer for a mesh. More...
 
def getInstance (cls, args, kwargs)
 

Static Public Attributes

string VertexBufferProperty = "__vertex_buffer"
 
string IndexBufferProperty = "__index_buffer"
 

Detailed Description

Convenience methods for dealing with OpenGL.

This class simplifies dealing with OpenGL and different Python OpenGL bindings. It mostly describes an interface that should be implemented for dealing with basic OpenGL functionality using these different OpenGL bindings. Additionally, it provides singleton handling. The implementation-defined subclass must be set as singleton instance as soon as possible so that any calls to getInstance() return a proper object.

Member Function Documentation

◆ createFrameBufferObject()

def UM.View.GL.OpenGL.OpenGL.createFrameBufferObject (   self,
  width 
)

Create a FrameBuffer Object.

This should return an implementation-specifc FrameBufferObject subclass.

◆ createIndexBuffer()

def UM.View.GL.OpenGL.OpenGL.createIndexBuffer (   self,
  mesh 
)

Create an index buffer for a mesh.

This will create an index buffer object that is filled with the index data of the mesh.

By default, the associated index buffer should be cached using a custom property on the mesh. This should use the IndexBufferProperty property name.

Parameters
meshThe mesh to create an index buffer for.
kwargsKeyword arguments. Possible values:
  • force_recreate: Ignore the cached value if set and always create a new buffer.

◆ createShaderProgram()

def UM.View.GL.OpenGL.OpenGL.createShaderProgram (   self,
  file_name 
)

Create a ShaderProgram Object.

This should return an implementation-specifc ShaderProgram subclass.

◆ createTexture()

def UM.View.GL.OpenGL.OpenGL.createTexture (   self,
  Texture 
)

Create a Texture Object.

This should return an implementation-specific Texture subclass.

◆ createVertexBuffer()

def UM.View.GL.OpenGL.OpenGL.createVertexBuffer (   self,
  mesh 
)

Create a Vertex buffer for a mesh.

This will create a vertex buffer object that is filled with the vertex data of the mesh.

By default, the associated vertex buffer should be cached using a custom property on the mesh. This should use the VertexBufferProperty property name.

Parameters
meshThe mesh to create a vertex buffer for.
kwargsKeyword arguments. Possible values:
  • force_recreate: Ignore the cached value if set and always create a new buffer.

◆ getBindingsObject()

def UM.View.GL.OpenGL.OpenGL.getBindingsObject (   self)

Get the OpenGL bindings object.

This should return an object that has all supported OpenGL functions as methods and additionally defines all OpenGL constants. This object is used to make direct OpenGL calls so should match OpenGL as closely as possible.

◆ getGPUType()

def UM.View.GL.OpenGL.OpenGL.getGPUType (   self,
  str 
)

Get a string describing the current GPU type.

This effectively should return the OpenGL renderer string.

◆ getGPUVendor()

def UM.View.GL.OpenGL.OpenGL.getGPUVendor (   self,
  int 
)

Get the current GPU vendor.

Returns
One of the items of OpenGL.Vendor.

◆ getGPUVendorName()

def UM.View.GL.OpenGL.OpenGL.getGPUVendorName (   self,
  str 
)

Get the current GPU vendor name.

Returns
Name of the vendor of current GPU

◆ getOpenGLVersion()

def UM.View.GL.OpenGL.OpenGL.getOpenGLVersion (   self,
  str 
)

Get the current OpenGL version.

Returns
Version of OpenGL

◆ hasFrameBufferObjects()

def UM.View.GL.OpenGL.OpenGL.hasFrameBufferObjects (   self,
  bool 
)

Check if the current OpenGL implementation supports FrameBuffer Objects.

Returns
True if FBOs are supported, False if not.

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