4.1.3.20. Type

This module provides classes to handle OpenGL Data Types.

It gives access to the following functions to set and get uniform values:

  • glGetUniform{f|i|ui|d}v
  • glUniform{1|2|3|4}{f|i|ui}
  • glUniform{1|2|3|4}{f|i|ui}v
  • glUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv
  • glProgramUniform{1|2|3|4}{f|i|ui}
  • glProgramUniform{1|2|3|4}{f|i|ui}v
  • glProgramUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv

GL data types:

GL Type Bit Width Description
boolean 1 or more Boolean
byte 8 Signed two’s complement binary integer
ubyte 8 Unsigned binary integer
char 8 Characters making up strings
short 16 Signed two’s complement binary integer
ushort 16 Unsigned binary integer
int 32 Signed two’s complement binary integer
uint 32 Unsigned binary integer
fixed 32 Signed two’s complement 16.16 scaled integer
int64 64 Signed two’s complement binary integer
uint64 64 Unsigned binary integer
sizei 32 Non-negative binary integer size
enum 32 Enumerated binary integer value
intptr ptrbits Signed twos complement binary integer
sizeiptr ptrbits Non-negative binary integer size
sync ptrbits Sync object handle
bitfield 32 Bit field
half 16 Half-precision floating-point value encoded in an unsigned scalar
float 32 Floating-point value
clampf 32 Floating-point value clamped to [0, 1]
double 64 Floating-point value
clampd 64 Floating-point value clamped to [0, 1]

Correspondence of command suffix type descriptors to GL argument types:

Type Descriptor Corresponding GL Type
b byte
s short
i int
i64 int64
f float
d double
ub ubyte
us ushort
ui uint
ui64 uint64
class PyOpenGLng.HighLevelApi.Type.GlMatrixType(data_type, number_of_rows, number_of_columns)[source]

Bases: PyOpenGLng.HighLevelApi.Type.GlType

This class defines a matrix type.

number_of_dimensions = 2
class PyOpenGLng.HighLevelApi.Type.GlSamplerType(data_type, token_name, keyword)[source]

Bases: PyOpenGLng.HighLevelApi.Type.GlType

This class defines a sampler type.

class PyOpenGLng.HighLevelApi.Type.GlType(token_name, keyword, data_type, uniform_get, uniform_set)[source]

Bases: object

This base class defines an OpenGL data type.

Public attributes are:

token_name
OpenGL type name token, for example GL.GL_FLOAT_VEC4
keyword
GLSL type keyword, for example vec4
data_type
OpenGL data type enumerate, for example gl_data_type.float
uniform_get_v
Function to get the uniform value, cf. glGetUniform<type>v functions.
uniform_set_v
Function to set the uniform from a pointer, cf. glUniform<type>v functions.
program_uniform_set_v
Function to set the uniform from a pointer for the given program, cf. glProgramUniform<type>v functions.
uniform_set
Function to set the uniform from arguments, cf. glUniform<type> functions. If it is irrelevant for the type, it is set to None.
dtype
corresponding Numpy data type

Subclasses public attributes are:

number_of_dimensions
Number of dimensions of the type
shape
Shape of the array for vector and matrix type
print_object()[source]
class PyOpenGLng.HighLevelApi.Type.GlTypes(gl_types)[source]

Bases: dict

This class stores the OpenGL types in a dictionary indexed by the token name.

class PyOpenGLng.HighLevelApi.Type.GlVariableType(data_type)[source]

Bases: PyOpenGLng.HighLevelApi.Type.GlType

This class defines a variable type.

number_of_dimensions = 1
shape = (1,)
class PyOpenGLng.HighLevelApi.Type.GlVectorType(data_type, size)[source]

Bases: PyOpenGLng.HighLevelApi.Type.GlType

This class defines a vector type.

number_of_dimensions = 1
PyOpenGLng.HighLevelApi.Type.get_gl_attr(name)[source]

Retrieve an attribute within the GL module.

PyOpenGLng.HighLevelApi.Type.gl_data_type

OpenGL data type, cf. OpenGL Specification Table 2.2: GL data types.

alias of GlDataType

PyOpenGLng.HighLevelApi.Type.gl_to_numpy_data_type = {bool := 0: <type 'numpy.uint32'>, double := 4: <type 'numpy.float64'>, unsigned_int := 1: <type 'numpy.uint32'>, float := 3: <type 'numpy.float32'>, int := 2: <type 'numpy.int32'>}

OpenGL to Numpy data type

PyOpenGLng.HighLevelApi.Type.gl_types = {5124: <PyOpenGLng.HighLevelApi.Type.GlVariableType object at 0x493ead0>, 5125: <PyOpenGLng.HighLevelApi.Type.GlVariableType object at 0x493ea50>, 5126: <PyOpenGLng.HighLevelApi.Type.GlVariableType object at 0x3ecb510>, 36310: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe810>, 5130: <PyOpenGLng.HighLevelApi.Type.GlVariableType object at 0x3ecbd10>, 36311: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe790>, 36312: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe410>, 36302: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebeb50>, 36678: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecbb10>, 36679: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb310>, 36680: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb410>, 36297: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe350>, 36298: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe510>, 36288: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe9d0>, 36289: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe610>, 36290: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe7d0>, 36299: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe550>, 36294: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb550>, 36295: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecbfd0>, 36296: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb6d0>, 36681: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb950>, 36682: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecbed0>, 36683: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb750>, 36684: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb3d0>, 36685: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb7d0>, 36686: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb350>, 36303: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebed50>, 35664: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecba50>, 35665: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecbd90>, 35666: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb0d0>, 35667: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb810>, 35668: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecbf90>, 35669: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecbdd0>, 35670: <PyOpenGLng.HighLevelApi.Type.GlVariableType object at 0x493ea10>, 35671: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb610>, 35672: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb450>, 35673: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecbb50>, 35674: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb110>, 35675: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb290>, 35676: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb910>, 35677: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebeb10>, 35678: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebea50>, 35679: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe910>, 35680: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe290>, 36304: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebea90>, 35683: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebef90>, 35685: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb490>, 35686: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecbf50>, 35687: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb790>, 35688: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecbc50>, 35689: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb1d0>, 35690: <PyOpenGLng.HighLevelApi.Type.GlMatrixType object at 0x3ecb890>, 36306: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebeb90>, 36300: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe590>, 36305: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ecbad0>, 36307: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe310>, 36308: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebec50>, 36301: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe0d0>, 36860: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecb2d0>, 36861: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecba10>, 36862: <PyOpenGLng.HighLevelApi.Type.GlVectorType object at 0x3ecba90>, 36309: <PyOpenGLng.HighLevelApi.Type.GlSamplerType object at 0x3ebe490>}

singleton for the GlTypes

Previous topic

4.1.3.19. Transforms

Next topic

4.1.3.21. VertexArrayObject

This Page