Quick search

Table Of Contents

OpenGL utilities

New in version 1.0.7.

kivy.graphics.opengl_utils.gl_get_extensions()

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

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

Return the status of a OpenGL Capability. This is a wrapper that auto-discovers all the capabilities that Kivy might need. The current capabilites 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_register_get_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
kivy.graphics.opengl_utils.gl_has_texture_format()

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

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

kivy.graphics.opengl_utils.gl_has_texture_native_format()

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

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

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

New in version 1.2.0.

kivy.graphics.opengl_utils.gl_get_version_minor()

Return the minor component of the OpenGL version.

New in version 1.2.0.

kivy.graphics.opengl_utils.gl_get_version_major()

Return the major component of the OpenGL version.

New in version 1.2.0.