Uranium
Application Framework
Loading...
Searching...
No Matches
UM.View.GL.OpenGL.OpenGL Class Reference

Classes

class  Vendor
 

Public Member Functions

None __init__ (self)
 
bool hasFrameBufferObjects (self)
 
str getOpenGLVersion (self)
 
str getOpenGLVersionShort (self)
 
"Version" getOpenGLShadingLanguageVersion (self)
 
str getGPUVendorName (self)
 
int getGPUVendor (self)
 
str getGPUType (self)
 
Any getBindingsObject (self)
 
FrameBufferObject createFrameBufferObject (self, int width, int height)
 
Texture createTexture (self)
 
Optional[ShaderProgramcreateShaderProgram (self, str file_name)
 
QOpenGLBuffer createVertexBuffer (self, "MeshData" mesh, **Any kwargs)
 
 createIndexBuffer (self, "MeshData" mesh, **Any kwargs)
 
"OpenGL" getInstance (cls, *args, **kwargs)
 

Static Public Attributes

str VertexBufferProperty = "__vertex_buffer"
 
str IndexBufferProperty = "__index_buffer"
 

Protected Attributes

 _gl
 
 _gpu_vendor
 
 _gpu_type
 
 _opengl_version
 
 _opengl_version_short
 
 _opengl_shading_language_version
 

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()

FrameBufferObject UM.View.GL.OpenGL.OpenGL.createFrameBufferObject ( self,
int width,
int height )
Create a FrameBuffer Object.

This should return an implementation-specifc FrameBufferObject subclass.

◆ createIndexBuffer()

UM.View.GL.OpenGL.OpenGL.createIndexBuffer ( self,
"MeshData" mesh,
**Any kwargs )
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.

:param mesh: The mesh to create an index buffer for.
:param kwargs: Keyword arguments.
    Possible values:
    - force_recreate: Ignore the cached value if set and always create a new buffer.

◆ createShaderProgram()

Optional[ShaderProgram] UM.View.GL.OpenGL.OpenGL.createShaderProgram ( self,
str file_name )
Create a ShaderProgram Object.

This should return an implementation-specifc ShaderProgram subclass.

◆ createTexture()

Texture UM.View.GL.OpenGL.OpenGL.createTexture ( self)
Create a Texture Object.

This should return an implementation-specific Texture subclass.

◆ createVertexBuffer()

QOpenGLBuffer UM.View.GL.OpenGL.OpenGL.createVertexBuffer ( self,
"MeshData" mesh,
**Any kwargs )
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.

:param mesh: The mesh to create a vertex buffer for.
:param kwargs: Keyword arguments.
Possible values:
- force_recreate: Ignore the cached value if set and always create a new buffer.

◆ getBindingsObject()

Any 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()

str UM.View.GL.OpenGL.OpenGL.getGPUType ( self)
Get a string describing the current GPU type.

This effectively should return the OpenGL renderer string.

◆ getGPUVendor()

int UM.View.GL.OpenGL.OpenGL.getGPUVendor ( self)
Get the current GPU vendor.

:return: One of the items of OpenGL.Vendor.

◆ getGPUVendorName()

str UM.View.GL.OpenGL.OpenGL.getGPUVendorName ( self)
Get the current GPU vendor name.

:return: Name of the vendor of current GPU

◆ getOpenGLShadingLanguageVersion()

"Version" UM.View.GL.OpenGL.OpenGL.getOpenGLShadingLanguageVersion ( self)
Get the current OpenGL shading language version.

:return: Shading language version of OpenGL

◆ getOpenGLVersion()

str UM.View.GL.OpenGL.OpenGL.getOpenGLVersion ( self)
Get the current OpenGL version.

:return: Version of OpenGL

◆ getOpenGLVersionShort()

str UM.View.GL.OpenGL.OpenGL.getOpenGLVersionShort ( self)
Get a short version of the OpenGL version, which is just the version
number, not any build number or anything.
:return: Version number of OpenGL.

◆ hasFrameBufferObjects()

bool UM.View.GL.OpenGL.OpenGL.hasFrameBufferObjects ( self)
Check if the current OpenGL implementation supports FrameBuffer Objects.

:return: True if FBOs are supported, False if not.

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