Version

Quick search

Table Of Contents

OpenGL utilities

New in version 1.0.7.

kivy.graphics.opengl_utils.gl_get_extensions() → list

Return a list of OpenGL extensions available. All the names in the list have the GL_ stripped at the start (if it exists) and are in lowercase.

>>> print(gl_get_extensions())
['arb_blend_func_extended', 'arb_color_buffer_float', 'arb_compatibility',
 'arb_copy_buffer'... ]
kivy.graphics.opengl_utils.gl_get_texture_formats() → tuple

Return a list of texture formats recognized by kivy. The texture list is informative but might not been supported by your hardware. If you want a list of supported textures, you must filter that list as follows:

supported_fmts = [gl_has_texture_format(x) for x in gl_get_texture_formats()]
kivy.graphics.opengl_utils.gl_get_version() → tuple

Return the (major, minor) OpenGL version, parsed from the GL_VERSION.

New in version 1.2.0.

kivy.graphics.opengl_utils.gl_get_version_major() → int

Return the major component of the OpenGL version.

New in version 1.2.0.

kivy.graphics.opengl_utils.gl_get_version_minor() → int

Return the minor component of the OpenGL version.

New in version 1.2.0.

kivy.graphics.opengl_utils.gl_has_capability(int cap) → int

Return the status of a OpenGL Capability. This is a wrapper that auto-discovers all the capabilities that Kivy might need. The current capabilities tested are:

  • GLCAP_BGRA: Test the support of BGRA texture format

  • GLCAP_NPOT: Test the support of Non Power of Two texture

  • GLCAP_S3TC: Test the support of S3TC texture (DXT1, DXT3, DXT5)

  • GLCAP_DXT1: Test the support of DXT texture (subset of S3TC)

  • GLCAP_ETC1: Test the support of ETC1 texture

kivy.graphics.opengl_utils.gl_has_extension(name) → int

Check if an OpenGL extension is available. If the name starts with GL_, it will be stripped for the test and converted to lowercase.

>>> gl_has_extension('NV_get_tex_image')
False
>>> gl_has_extension('OES_texture_npot')
True
kivy.graphics.opengl_utils.gl_has_texture_conversion(fmt) → int

Return 1 if the texture can be converted to a native format.

kivy.graphics.opengl_utils.gl_has_texture_format(fmt) → int

Return whether a texture format is supported by your system, natively or by conversion. For example, if your card doesn’t support ‘bgra’, we are able to convert to ‘rgba’ but only in software mode.

kivy.graphics.opengl_utils.gl_has_texture_native_format(fmt) → int

Return 1 if the texture format is handled natively.

>>> gl_has_texture_format('azdmok')
0
>>> gl_has_texture_format('rgba')
1
>>> gl_has_texture_format('s3tc_dxt1')
[INFO   ] [GL          ] S3TC texture support is available
[INFO   ] [GL          ] DXT1 texture support is available
1
kivy.graphics.opengl_utils.gl_register_get_size(int constid, int size)

Register an association between an OpenGL Const used in glGet* to a number of elements.

By example, the GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX is a special pname that will return the integer 1 (nvidia only).

>>> GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047
>>> gl_register_get_size(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, 1)
>>> glGetIntegerv(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX)[0]
524288