vispy.gloo.gl package#

Subpackages#

Submodules#

Module contents#

This module provides a (functional) API to OpenGL ES 2.0.

There are multiple backend implementations of this API, available as submodules of this module. One can use one of the backends directly, or call gl.use_gl() to select one. The backend system allow running visualizations using Angle, WebGL, or other forms of remote rendering. This is in part possible by the widespread availability of OpenGL ES 2.0.

All functions that this API provides accept and return Python arguments (no ctypes is required); strings are real strings and you can pass data as numpy arrays. In general the input arguments are not checked (for performance reasons). Each function results in exactly one OpenGL API call, except when using the pyopengl backend.

The functions do not have docstrings, but most IDE’s should provide you with the function signature. For more documentation see http://www.khronos.org/opengles/sdk/docs/man/

class vispy.gloo.gl.MainProxy#

Bases: BaseGLProxy

Main proxy for the GL ES 2.0 API.

The functions in this namespace always call into the correct GL backend. Therefore these function objects can be safely stored for reuse. However, for efficienty it would probably be better to store the function name and then do func = getattr(gloo.gl, funcname).

vispy.gloo.gl.check_error(when='periodic check')#

Check this from time to time to detect GL errors.

Parameters:
whenstr

Shown in the exception to help the developer determine when this check was done.

vispy.gloo.gl.glActiveTexture(*args)#
vispy.gloo.gl.glAttachShader(*args)#
vispy.gloo.gl.glBindAttribLocation(*args)#
vispy.gloo.gl.glBindBuffer(*args)#
vispy.gloo.gl.glBindFramebuffer(*args)#
vispy.gloo.gl.glBindRenderbuffer(*args)#
vispy.gloo.gl.glBindTexture(*args)#
vispy.gloo.gl.glBlendColor(*args)#
vispy.gloo.gl.glBlendEquation(*args)#
vispy.gloo.gl.glBlendEquationSeparate(*args)#
vispy.gloo.gl.glBlendFunc(*args)#
vispy.gloo.gl.glBlendFuncSeparate(*args)#
vispy.gloo.gl.glBufferData(*args)#
vispy.gloo.gl.glBufferSubData(*args)#
vispy.gloo.gl.glCheckFramebufferStatus(*args)#
vispy.gloo.gl.glClear(*args)#
vispy.gloo.gl.glClearColor(*args)#
vispy.gloo.gl.glClearDepth(*args)#
vispy.gloo.gl.glClearStencil(*args)#
vispy.gloo.gl.glColorMask(*args)#
vispy.gloo.gl.glCompileShader(*args)#
vispy.gloo.gl.glCompressedTexImage2D(*args)#
vispy.gloo.gl.glCompressedTexSubImage2D(*args)#
vispy.gloo.gl.glCopyTexImage2D(*args)#
vispy.gloo.gl.glCopyTexSubImage2D(*args)#
vispy.gloo.gl.glCreateBuffer(*args)#
vispy.gloo.gl.glCreateFramebuffer(*args)#
vispy.gloo.gl.glCreateProgram(*args)#
vispy.gloo.gl.glCreateRenderbuffer(*args)#
vispy.gloo.gl.glCreateShader(*args)#
vispy.gloo.gl.glCreateTexture(*args)#
vispy.gloo.gl.glCullFace(*args)#
vispy.gloo.gl.glDeleteBuffer(*args)#
vispy.gloo.gl.glDeleteFramebuffer(*args)#
vispy.gloo.gl.glDeleteProgram(*args)#
vispy.gloo.gl.glDeleteRenderbuffer(*args)#
vispy.gloo.gl.glDeleteShader(*args)#
vispy.gloo.gl.glDeleteTexture(*args)#
vispy.gloo.gl.glDepthFunc(*args)#
vispy.gloo.gl.glDepthMask(*args)#
vispy.gloo.gl.glDepthRange(*args)#
vispy.gloo.gl.glDetachShader(*args)#
vispy.gloo.gl.glDisable(*args)#
vispy.gloo.gl.glDisableVertexAttribArray(*args)#
vispy.gloo.gl.glDrawArrays(*args)#
vispy.gloo.gl.glDrawElements(*args)#
vispy.gloo.gl.glEnable(*args)#
vispy.gloo.gl.glEnableVertexAttribArray(*args)#
vispy.gloo.gl.glFinish(*args)#
vispy.gloo.gl.glFlush(*args)#
vispy.gloo.gl.glFramebufferRenderbuffer(*args)#
vispy.gloo.gl.glFramebufferTexture2D(*args)#
vispy.gloo.gl.glFrontFace(*args)#
vispy.gloo.gl.glGenerateMipmap(*args)#
vispy.gloo.gl.glGetActiveAttrib(*args)#
vispy.gloo.gl.glGetActiveUniform(*args)#
vispy.gloo.gl.glGetAttachedShaders(*args)#
vispy.gloo.gl.glGetAttribLocation(*args)#
vispy.gloo.gl.glGetBufferParameter(*args)#
vispy.gloo.gl.glGetFramebufferAttachmentParameter(*args)#
vispy.gloo.gl.glGetParameter(*args)#
vispy.gloo.gl.glGetProgramInfoLog(*args)#
vispy.gloo.gl.glGetProgramParameter(*args)#
vispy.gloo.gl.glGetRenderbufferParameter(*args)#
vispy.gloo.gl.glGetShaderInfoLog(*args)#
vispy.gloo.gl.glGetShaderParameter(*args)#
vispy.gloo.gl.glGetShaderPrecisionFormat(*args)#
vispy.gloo.gl.glGetShaderSource(*args)#
vispy.gloo.gl.glGetTexParameter(*args)#
vispy.gloo.gl.glGetUniform(*args)#
vispy.gloo.gl.glGetUniformLocation(*args)#
vispy.gloo.gl.glGetVertexAttrib(*args)#
vispy.gloo.gl.glGetVertexAttribOffset(*args)#
vispy.gloo.gl.glHint(*args)#
vispy.gloo.gl.glIsBuffer(*args)#
vispy.gloo.gl.glIsEnabled(*args)#
vispy.gloo.gl.glIsFramebuffer(*args)#
vispy.gloo.gl.glIsProgram(*args)#
vispy.gloo.gl.glIsRenderbuffer(*args)#
vispy.gloo.gl.glIsShader(*args)#
vispy.gloo.gl.glIsTexture(*args)#
vispy.gloo.gl.glLineWidth(*args)#
vispy.gloo.gl.glLinkProgram(*args)#
vispy.gloo.gl.glPixelStorei(*args)#
vispy.gloo.gl.glPolygonOffset(*args)#
vispy.gloo.gl.glReadPixels(*args)#
vispy.gloo.gl.glRenderbufferStorage(*args)#
vispy.gloo.gl.glSampleCoverage(*args)#
vispy.gloo.gl.glScissor(*args)#
vispy.gloo.gl.glShaderSource(*args)#
vispy.gloo.gl.glStencilFunc(*args)#
vispy.gloo.gl.glStencilFuncSeparate(*args)#
vispy.gloo.gl.glStencilMask(*args)#
vispy.gloo.gl.glStencilMaskSeparate(*args)#
vispy.gloo.gl.glStencilOp(*args)#
vispy.gloo.gl.glStencilOpSeparate(*args)#
vispy.gloo.gl.glTexImage2D(*args)#
vispy.gloo.gl.glTexParameterf(*args)#
vispy.gloo.gl.glTexParameteri(*args)#
vispy.gloo.gl.glTexSubImage2D(*args)#
vispy.gloo.gl.glUniform1f(*args)#
vispy.gloo.gl.glUniform1fv(*args)#
vispy.gloo.gl.glUniform1i(*args)#
vispy.gloo.gl.glUniform1iv(*args)#
vispy.gloo.gl.glUniform2f(*args)#
vispy.gloo.gl.glUniform2fv(*args)#
vispy.gloo.gl.glUniform2i(*args)#
vispy.gloo.gl.glUniform2iv(*args)#
vispy.gloo.gl.glUniform3f(*args)#
vispy.gloo.gl.glUniform3fv(*args)#
vispy.gloo.gl.glUniform3i(*args)#
vispy.gloo.gl.glUniform3iv(*args)#
vispy.gloo.gl.glUniform4f(*args)#
vispy.gloo.gl.glUniform4fv(*args)#
vispy.gloo.gl.glUniform4i(*args)#
vispy.gloo.gl.glUniform4iv(*args)#
vispy.gloo.gl.glUniformMatrix2fv(*args)#
vispy.gloo.gl.glUniformMatrix3fv(*args)#
vispy.gloo.gl.glUniformMatrix4fv(*args)#
vispy.gloo.gl.glUseProgram(*args)#
vispy.gloo.gl.glValidateProgram(*args)#
vispy.gloo.gl.glVertexAttrib1f(*args)#
vispy.gloo.gl.glVertexAttrib2f(*args)#
vispy.gloo.gl.glVertexAttrib3f(*args)#
vispy.gloo.gl.glVertexAttrib4f(*args)#
vispy.gloo.gl.glVertexAttribPointer(*args)#
vispy.gloo.gl.glViewport(*args)#
vispy.gloo.gl.make_debug_wrapper(fn)#
vispy.gloo.gl.use_gl(target=None)#

Let Vispy use the target OpenGL ES 2.0 implementation

Also see vispy.use().

Parameters:
targetstr

The target GL backend to use. Default gl2 or es2, depending on the platform.

Available backends:
* gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL
* gl+ - Use the desktop ES 2.0 subset plus all non-deprecated GL

functions on your system (requires PyOpenGL)

* es2 - Use the ES2 library (Angle/DirectX on Windows)
* pyopengl2 - Use ES 2.0 subset of pyopengl (for fallback and testing)
* dummy - Prevent usage of gloo.gl (for when rendering occurs elsewhere)
You can use vispy’s config option “gl_debug” to check for errors
on each API call. Or, one can specify it as the target, e.g. “gl2
debug”. (Debug does not apply to ‘gl+’, since PyOpenGL has its own
debug mechanism)