Python: Remove deprecated BGL API
The API was in a deprecation state for many years now. This API was not compatible with Metal nor Vulkan. This also remove `Image.bindcode`. Pull Request: https://projects.blender.org/blender/blender/pulls/140370
This commit is contained in:
committed by
Clément Foucault
parent
9ddc67166f
commit
decd88f67e
@@ -1,1497 +0,0 @@
|
||||
|
||||
OpenGL Wrapper (bgl)
|
||||
====================
|
||||
|
||||
.. module:: bgl
|
||||
|
||||
.. warning::
|
||||
|
||||
This module is deprecated and will be removed in a future release,
|
||||
when OpenGL is replaced by Metal and Vulkan.
|
||||
Use the graphics API independent :mod:`gpu` module instead.
|
||||
|
||||
This module wraps OpenGL constants and functions, making them available from
|
||||
within Blender Python.
|
||||
|
||||
The complete list can be retrieved from the module itself, by listing its
|
||||
contents: dir(bgl). A simple search on the web can point to more
|
||||
than enough material to teach OpenGL programming, from books to many
|
||||
collections of tutorials.
|
||||
|
||||
Here is a comprehensive `list of books <https://www.khronos.org/developers/books/>`__ (non free).
|
||||
`Learn OpenGL <https://learnopengl.com/>`__ is one of the best resources to learn modern OpenGL and
|
||||
`opengl-tutorial.org <http://www.opengl-tutorial.org/>`__ offers a set of extensive examples,
|
||||
including advanced features.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
You can use the :class:`bpy.types.Image` type to load and set textures.
|
||||
See :class:`bpy.types.Image.gl_load` and :class:`bpy.types.Image.gl_free`,
|
||||
for example.
|
||||
|
||||
|
||||
.. function:: glBindTexture(target, texture):
|
||||
|
||||
Bind a named texture to a texturing target
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glBindTexture.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the target to which the texture is bound.
|
||||
:type texture: unsigned int
|
||||
:arg texture: Specifies the name of a texture.
|
||||
|
||||
|
||||
.. function:: glBlendFunc(sfactor, dfactor):
|
||||
|
||||
Specify pixel arithmetic
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml>`__
|
||||
|
||||
:type sfactor: Enumerated constant
|
||||
:arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are
|
||||
computed.
|
||||
:type dfactor: Enumerated constant
|
||||
:arg dfactor: Specifies how the red, green, blue, and alpha destination
|
||||
blending factors are computed.
|
||||
|
||||
|
||||
.. function:: glClear(mask):
|
||||
|
||||
Clear buffers to preset values
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClear.xhtml>`__
|
||||
|
||||
:type mask: Enumerated constant(s)
|
||||
:arg mask: Bitwise OR of masks that indicate the buffers to be cleared.
|
||||
|
||||
|
||||
.. function:: glClearColor(red, green, blue, alpha):
|
||||
|
||||
Specify clear values for the color buffers
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearColor.xhtml>`__
|
||||
|
||||
:type red, green, blue, alpha: float
|
||||
:arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
|
||||
color buffers are cleared. The initial values are all 0.
|
||||
|
||||
|
||||
.. function:: glClearDepth(depth):
|
||||
|
||||
Specify the clear value for the depth buffer
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearDepth.xhtml>`__
|
||||
|
||||
:type depth: int
|
||||
:arg depth: Specifies the depth value used when the depth buffer is cleared.
|
||||
The initial value is 1.
|
||||
|
||||
|
||||
.. function:: glClearStencil(s):
|
||||
|
||||
Specify the clear value for the stencil buffer
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClearStencil.xhtml>`__
|
||||
|
||||
:type s: int
|
||||
:arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0.
|
||||
|
||||
|
||||
.. function:: glClipPlane (plane, equation):
|
||||
|
||||
Specify a plane against which all geometry is clipped
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glClipPlane.xhtml>`__
|
||||
|
||||
:type plane: Enumerated constant
|
||||
:arg plane: Specifies which clipping plane is being positioned.
|
||||
:type equation: :class:`bgl.Buffer` object I{type GL_FLOAT}(double)
|
||||
:arg equation: Specifies the address of an array of four double- precision
|
||||
floating-point values. These values are interpreted as a plane equation.
|
||||
|
||||
|
||||
.. function:: glColorMask(red, green, blue, alpha):
|
||||
|
||||
Enable and disable writing of frame buffer color components
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColorMask.xhtml>`__
|
||||
|
||||
:type red, green, blue, alpha: int (boolean)
|
||||
:arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be
|
||||
written into the frame buffer. The initial values are all GL_TRUE, indicating that the
|
||||
color components can be written.
|
||||
|
||||
|
||||
.. function:: glCopyTexImage2D(target, level, internalformat, x, y, width, height, border):
|
||||
|
||||
Copy pixels into a 2D texture image
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCopyTexImage2D.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the target texture.
|
||||
:type level: int
|
||||
:arg level: Specifies the level-of-detail number. Level 0 is the base image level.
|
||||
Level n is the nth mipmap reduction image.
|
||||
:type internalformat: int
|
||||
:arg internalformat: Specifies the number of color components in the texture.
|
||||
:type width: int
|
||||
:type x, y: int
|
||||
:arg x, y: Specify the window coordinates of the first pixel that is copied
|
||||
from the frame buffer. This location is the lower left corner of a rectangular
|
||||
block of pixels.
|
||||
:arg width: Specifies the width of the texture image. Must be 2n+2(border) for
|
||||
some integer n. All implementations support texture images that are at least 64
|
||||
texels wide.
|
||||
:type height: int
|
||||
:arg height: Specifies the height of the texture image. Must be 2m+2(border) for
|
||||
some integer m. All implementations support texture images that are at least 64
|
||||
texels high.
|
||||
:type border: int
|
||||
:arg border: Specifies the width of the border. Must be either 0 or 1.
|
||||
|
||||
|
||||
.. function:: glCullFace(mode):
|
||||
|
||||
Specify whether front- or back-facing facets can be culled
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCullFace.xhtml>`__
|
||||
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies whether front- or back-facing facets are candidates for culling.
|
||||
|
||||
|
||||
.. function:: glDeleteTextures(n, textures):
|
||||
|
||||
Delete named textures
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteTextures.xhtml>`__
|
||||
|
||||
:type n: int
|
||||
:arg n: Specifies the number of textures to be deleted
|
||||
:type textures: :class:`bgl.Buffer` I{GL_INT}
|
||||
:arg textures: Specifies an array of textures to be deleted
|
||||
|
||||
|
||||
.. function:: glDepthFunc(func):
|
||||
|
||||
Specify the value used for depth buffer comparisons
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthFunc.xhtml>`__
|
||||
|
||||
:type func: Enumerated constant
|
||||
:arg func: Specifies the depth comparison function.
|
||||
|
||||
|
||||
.. function:: glDepthMask(flag):
|
||||
|
||||
Enable or disable writing into the depth buffer
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthMask.xhtml>`__
|
||||
|
||||
:type flag: int (boolean)
|
||||
:arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE,
|
||||
depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer
|
||||
writing is enabled.
|
||||
|
||||
|
||||
.. function:: glDepthRange(zNear, zFar):
|
||||
|
||||
Specify mapping of depth values from normalized device coordinates to window coordinates
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDepthRange.xhtml>`__
|
||||
|
||||
:type zNear: int
|
||||
:arg zNear: Specifies the mapping of the near clipping plane to window coordinates.
|
||||
The initial value is 0.
|
||||
:type zFar: int
|
||||
:arg zFar: Specifies the mapping of the far clipping plane to window coordinates.
|
||||
The initial value is 1.
|
||||
|
||||
|
||||
.. function:: glDisable(cap):
|
||||
|
||||
Disable server-side GL capabilities
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml>`__
|
||||
|
||||
:type cap: Enumerated constant
|
||||
:arg cap: Specifies a symbolic constant indicating a GL capability.
|
||||
|
||||
|
||||
.. function:: glDrawBuffer(mode):
|
||||
|
||||
Specify which color buffers are to be drawn into
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawBuffer.xhtml>`__
|
||||
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies up to four color buffers to be drawn into.
|
||||
|
||||
|
||||
.. function:: glEdgeFlag (flag):
|
||||
|
||||
B{glEdgeFlag, glEdgeFlagv}
|
||||
|
||||
Flag edges as either boundary or non-boundary
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEdgeFlag.xhtml>`__
|
||||
|
||||
:type flag: Depends of function prototype
|
||||
:arg flag: Specifies the current edge flag value.The initial value is GL_TRUE.
|
||||
|
||||
|
||||
.. function:: glEnable(cap):
|
||||
|
||||
Enable server-side GL capabilities
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEnable.xhtml>`__
|
||||
|
||||
:type cap: Enumerated constant
|
||||
:arg cap: Specifies a symbolic constant indicating a GL capability.
|
||||
|
||||
|
||||
.. function:: glEvalCoord (u,v):
|
||||
|
||||
B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv,
|
||||
glEvalCoord2dv, glEvalCoord2fv}
|
||||
|
||||
Evaluate enabled one- and two-dimensional maps
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalCoord.xhtml>`__
|
||||
|
||||
:type u: Depends on function prototype.
|
||||
:arg u: Specifies a value that is the domain coordinate u to the basis function defined
|
||||
in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then
|
||||
u specifies a pointer to an array containing either one or two domain coordinates. The first
|
||||
coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions.
|
||||
:type v: Depends on function prototype. (only with '2' prototypes)
|
||||
:arg v: Specifies a value that is the domain coordinate v to the basis function defined
|
||||
in a previous glMap2 command. This argument is not present in a glEvalCoord1 command.
|
||||
|
||||
|
||||
.. function:: glEvalMesh (mode, i1, i2):
|
||||
|
||||
B{glEvalMesh1 or glEvalMesh2}
|
||||
|
||||
Compute a one- or two-dimensional grid of points or lines
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalMesh.xhtml>`__
|
||||
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional
|
||||
mesh of points or lines.
|
||||
:type i1, i2: int
|
||||
:arg i1, i2: Specify the first and last integer values for the grid domain variable i.
|
||||
|
||||
|
||||
.. function:: glEvalPoint (i, j):
|
||||
|
||||
B{glEvalPoint1 and glEvalPoint2}
|
||||
|
||||
Generate and evaluate a single point in a mesh
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glEvalPoint.xhtml>`__
|
||||
|
||||
:type i: int
|
||||
:arg i: Specifies the integer value for grid domain variable i.
|
||||
:type j: int (only with '2' prototypes)
|
||||
:arg j: Specifies the integer value for grid domain variable j (glEvalPoint2 only).
|
||||
|
||||
|
||||
.. function:: glFeedbackBuffer (size, type, buffer):
|
||||
|
||||
Controls feedback mode
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFeedbackBuffer.xhtml>`__
|
||||
|
||||
:type size: int
|
||||
:arg size: Specifies the maximum number of values that can be written into buffer.
|
||||
:type type: Enumerated constant
|
||||
:arg type: Specifies a symbolic constant that describes the information that
|
||||
will be returned for each vertex.
|
||||
:type buffer: :class:`bgl.Buffer` object I{GL_FLOAT}
|
||||
:arg buffer: Returns the feedback data.
|
||||
|
||||
|
||||
.. function:: glFinish():
|
||||
|
||||
Block until all GL execution is complete
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFinish.xhtml>`__
|
||||
|
||||
|
||||
.. function:: glFlush():
|
||||
|
||||
Force Execution of GL commands in finite time
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFlush.xhtml>`__
|
||||
|
||||
|
||||
.. function:: glFog (pname, param):
|
||||
|
||||
B{glFogf, glFogi, glFogfv, glFogiv}
|
||||
|
||||
Specify fog parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFog.xhtml>`__
|
||||
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies a single-valued fog parameter. If the function prototype
|
||||
ends in 'v' specifies a fog parameter.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR
|
||||
requires an array of four values. All other parameters accept an array containing
|
||||
only a single value.
|
||||
|
||||
|
||||
.. function:: glFrontFace(mode):
|
||||
|
||||
Define front- and back-facing polygons
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glFrontFace.xhtml>`__
|
||||
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies the orientation of front-facing polygons.
|
||||
|
||||
|
||||
.. function:: glGenTextures(n, textures):
|
||||
|
||||
Generate texture names
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGenTextures.xhtml>`__
|
||||
|
||||
:type n: int
|
||||
:arg n: Specifies the number of textures name to be generated.
|
||||
:type textures: :class:`bgl.Buffer` object I{type GL_INT}
|
||||
:arg textures: Specifies an array in which the generated textures names are stored.
|
||||
|
||||
|
||||
.. function:: glGet (pname, param):
|
||||
|
||||
B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv}
|
||||
|
||||
Return the value or values of a selected parameter
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGet.xhtml>`__
|
||||
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the parameter value to be returned.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Returns the value or values of the specified parameter.
|
||||
|
||||
|
||||
.. function:: glGetError():
|
||||
|
||||
Return error information
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetError.xhtml>`__
|
||||
|
||||
|
||||
.. function:: glGetLight (light, pname, params):
|
||||
|
||||
B{glGetLightfv and glGetLightiv}
|
||||
|
||||
Return light source parameter values
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetLight.xhtml>`__
|
||||
|
||||
:type light: Enumerated constant
|
||||
:arg light: Specifies a light source. The number of possible lights depends on the
|
||||
implementation, but at least eight lights are supported. They are identified by symbolic
|
||||
names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies a light source parameter for light.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetMap (target, query, v):
|
||||
|
||||
B{glGetMapdv, glGetMapfv, glGetMapiv}
|
||||
|
||||
Return evaluator parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetMap.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the symbolic name of a map.
|
||||
:type query: Enumerated constant
|
||||
:arg query: Specifies which parameter to return.
|
||||
:type v: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg v: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetMaterial (face, pname, params):
|
||||
|
||||
B{glGetMaterialfv, glGetMaterialiv}
|
||||
|
||||
Return material parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetMaterial.xhtml>`__
|
||||
|
||||
:type face: Enumerated constant
|
||||
:arg face: Specifies which of the two materials is being queried.
|
||||
representing the front and back materials, respectively.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the material parameter to return.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetPixelMap (map, values):
|
||||
|
||||
B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv}
|
||||
|
||||
Return the specified pixel map
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetPixelMap.xhtml>`__
|
||||
|
||||
:type map: Enumerated constant
|
||||
:arg map: Specifies the name of the pixel map to return.
|
||||
:type values: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg values: Returns the pixel map contents.
|
||||
|
||||
|
||||
.. function:: glGetString(name):
|
||||
|
||||
Return a string describing the current GL connection
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetString.xhtml>`__
|
||||
|
||||
:type name: Enumerated constant
|
||||
:arg name: Specifies a symbolic constant.
|
||||
|
||||
|
||||
|
||||
.. function:: glGetTexEnv (target, pname, params):
|
||||
|
||||
B{glGetTexEnvfv, glGetTexEnviv}
|
||||
|
||||
Return texture environment parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexEnv.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of a texture environment parameter.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetTexGen (coord, pname, params):
|
||||
|
||||
B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv}
|
||||
|
||||
Return texture coordinate generation parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexGen.xhtml>`__
|
||||
|
||||
:type coord: Enumerated constant
|
||||
:arg coord: Specifies a texture coordinate.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of the value(s) to be returned.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetTexImage(target, level, format, type, pixels):
|
||||
|
||||
Return a texture image
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexImage.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies which texture is to be obtained.
|
||||
:type level: int
|
||||
:arg level: Specifies the level-of-detail number of the desired image.
|
||||
Level 0 is the base image level. Level n is the nth mipmap reduction image.
|
||||
:type format: Enumerated constant
|
||||
:arg format: Specifies a pixel format for the returned data.
|
||||
:type type: Enumerated constant
|
||||
:arg type: Specifies a pixel type for the returned data.
|
||||
:type pixels: :class:`bgl.Buffer` object.
|
||||
:arg pixels: Returns the texture image. Should be a pointer to an array of the
|
||||
type specified by type
|
||||
|
||||
|
||||
.. function:: glGetTexLevelParameter (target, level, pname, params):
|
||||
|
||||
B{glGetTexLevelParameterfv, glGetTexLevelParameteriv}
|
||||
|
||||
return texture parameter values for a specific level of detail
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexLevelParameter.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the symbolic name of the target texture.
|
||||
:type level: int
|
||||
:arg level: Specifies the level-of-detail number of the desired image.
|
||||
Level 0 is the base image level. Level n is the nth mipmap reduction image.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of a texture parameter.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the requested data.
|
||||
|
||||
|
||||
.. function:: glGetTexParameter (target, pname, params):
|
||||
|
||||
B{glGetTexParameterfv, glGetTexParameteriv}
|
||||
|
||||
Return texture parameter values
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetTexParameter.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the symbolic name of the target texture.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name the target texture.
|
||||
:type params: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg params: Returns the texture parameters.
|
||||
|
||||
|
||||
.. function:: glHint(target, mode):
|
||||
|
||||
Specify implementation-specific hints
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glHint.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies a symbolic constant indicating the behavior to be
|
||||
controlled.
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies a symbolic constant indicating the desired behavior.
|
||||
|
||||
|
||||
.. function:: glIsEnabled(cap):
|
||||
|
||||
Test whether a capability is enabled
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsEnabled.xhtml>`__
|
||||
|
||||
:type cap: Enumerated constant
|
||||
:arg cap: Specifies a constant representing a GL capability.
|
||||
|
||||
|
||||
.. function:: glIsTexture(texture):
|
||||
|
||||
Determine if a name corresponds to a texture
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsTexture.xhtml>`__
|
||||
|
||||
:type texture: unsigned int
|
||||
:arg texture: Specifies a value that may be the name of a texture.
|
||||
|
||||
|
||||
.. function:: glLight (light, pname, param):
|
||||
|
||||
B{glLightf,glLighti, glLightfv, glLightiv}
|
||||
|
||||
Set the light source parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLight.xhtml>`__
|
||||
|
||||
:type light: Enumerated constant
|
||||
:arg light: Specifies a light. The number of lights depends on the implementation,
|
||||
but at least eight lights are supported. They are identified by symbolic names of the
|
||||
form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies a single-valued light source parameter for light.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value that parameter pname of light source light will be set to.
|
||||
If function prototype ends in 'v' specifies a pointer to the value or values that
|
||||
parameter pname of light source light will be set to.
|
||||
|
||||
|
||||
.. function:: glLightModel (pname, param):
|
||||
|
||||
B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv}
|
||||
|
||||
Set the lighting model parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLightModel.xhtml>`__
|
||||
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies a single-value light model parameter.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value that param will be set to. If function prototype ends in 'v'
|
||||
specifies a pointer to the value or values that param will be set to.
|
||||
|
||||
|
||||
.. function:: glLineWidth(width):
|
||||
|
||||
Specify the width of rasterized lines.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLineWidth.xhtml>`__
|
||||
|
||||
:type width: float
|
||||
:arg width: Specifies the width of rasterized lines. The initial value is 1.
|
||||
|
||||
|
||||
.. function:: glLoadMatrix (m):
|
||||
|
||||
B{glLoadMatrixd, glLoadMatixf}
|
||||
|
||||
Replace the current matrix with the specified matrix
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLoadMatrix.xhtml>`__
|
||||
|
||||
:type m: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg m: Specifies a pointer to 16 consecutive values, which are used as the elements
|
||||
of a 4x4 column-major matrix.
|
||||
|
||||
|
||||
.. function:: glLogicOp(opcode):
|
||||
|
||||
Specify a logical pixel operation for color index rendering
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLogicOp.xhtml>`__
|
||||
|
||||
:type opcode: Enumerated constant
|
||||
:arg opcode: Specifies a symbolic constant that selects a logical operation.
|
||||
|
||||
|
||||
.. function:: glMap1 (target, u1, u2, stride, order, points):
|
||||
|
||||
B{glMap1d, glMap1f}
|
||||
|
||||
Define a one-dimensional evaluator
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMap1.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the kind of values that are generated by the evaluator.
|
||||
:type u1, u2: Depends on function prototype.
|
||||
:arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t
|
||||
he variable that is evaluated by the equations specified by this command.
|
||||
:type stride: int
|
||||
:arg stride: Specifies the number of floats or float (double)s between the beginning
|
||||
of one control point and the beginning of the next one in the data structure
|
||||
referenced in points. This allows control points to be embedded in arbitrary data
|
||||
structures. The only constraint is that the values for a particular control point must
|
||||
occupy contiguous memory locations.
|
||||
:type order: int
|
||||
:arg order: Specifies the number of control points. Must be positive.
|
||||
:type points: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg points: Specifies a pointer to the array of control points.
|
||||
|
||||
|
||||
.. function:: glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points):
|
||||
|
||||
B{glMap2d, glMap2f}
|
||||
|
||||
Define a two-dimensional evaluator
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMap2.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the kind of values that are generated by the evaluator.
|
||||
:type u1, u2: Depends on function prototype.
|
||||
:arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t
|
||||
he variable that is evaluated by the equations specified by this command. Initially
|
||||
u1 is 0 and u2 is 1.
|
||||
:type ustride: int
|
||||
:arg ustride: Specifies the number of floats or float (double)s between the beginning
|
||||
of control point R and the beginning of control point R ij, where i and j are the u
|
||||
and v control point indices, respectively. This allows control points to be embedded
|
||||
in arbitrary data structures. The only constraint is that the values for a particular
|
||||
control point must occupy contiguous memory locations. The initial value of ustride is 0.
|
||||
:type uorder: int
|
||||
:arg uorder: Specifies the dimension of the control point array in the u axis.
|
||||
Must be positive. The initial value is 1.
|
||||
:type v1, v2: Depends on function prototype.
|
||||
:arg v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2,
|
||||
to ^, one of the two variables that are evaluated by the equations
|
||||
specified by this command. Initially, v1 is 0 and v2 is 1.
|
||||
:type vstride: int
|
||||
:arg vstride: Specifies the number of floats or float (double)s between the
|
||||
beginning of control point R and the beginning of control point R ij,
|
||||
where i and j are the u and v control point(indices, respectively.
|
||||
This allows control points to be embedded in arbitrary data structures.
|
||||
The only constraint is that the values for a particular control point must
|
||||
occupy contiguous memory locations. The initial value of vstride is 0.
|
||||
:type vorder: int
|
||||
:arg vorder: Specifies the dimension of the control point array in the v axis.
|
||||
Must be positive. The initial value is 1.
|
||||
:type points: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg points: Specifies a pointer to the array of control points.
|
||||
|
||||
|
||||
.. function:: glMapGrid (un, u1,u2 ,vn, v1, v2):
|
||||
|
||||
B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f}
|
||||
|
||||
Define a one- or two-dimensional mesh
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMapGrid.xhtml>`__
|
||||
|
||||
:type un: int
|
||||
:arg un: Specifies the number of partitions in the grid range interval
|
||||
[u1, u2]. Must be positive.
|
||||
:type u1, u2: Depends on function prototype.
|
||||
:arg u1, u2: Specify the mappings for integer grid domain values i=0 and i=un.
|
||||
:type vn: int
|
||||
:arg vn: Specifies the number of partitions in the grid range interval
|
||||
[v1, v2] (glMapGrid2 only).
|
||||
:type v1, v2: Depends on function prototype.
|
||||
:arg v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn
|
||||
(glMapGrid2 only).
|
||||
|
||||
|
||||
.. function:: glMaterial (face, pname, params):
|
||||
|
||||
Specify material parameters for the lighting model.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMaterial.xhtml>`__
|
||||
|
||||
:type face: Enumerated constant
|
||||
:arg face: Specifies which face or faces are being updated. Must be one of:
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the single-valued material parameter of the face
|
||||
or faces that is being updated. Must be GL_SHININESS.
|
||||
:type params: int
|
||||
:arg params: Specifies the value that parameter GL_SHININESS will be set to.
|
||||
If function prototype ends in 'v' specifies a pointer to the value or values that
|
||||
pname will be set to.
|
||||
|
||||
|
||||
.. function:: glMultMatrix (m):
|
||||
|
||||
B{glMultMatrixd, glMultMatrixf}
|
||||
|
||||
Multiply the current matrix with the specified matrix
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glMultMatrix.xhtml>`__
|
||||
|
||||
:type m: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column
|
||||
major matrix.
|
||||
|
||||
|
||||
.. function:: glNormal3 (nx, ny, nz, v):
|
||||
|
||||
B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv,
|
||||
Normal3s, Normal3sv}
|
||||
|
||||
Set the current normal vector
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glNormal.xhtml>`__
|
||||
|
||||
:type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only)
|
||||
:arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal.
|
||||
The initial value of the current normal is the unit vector, (0, 0, 1).
|
||||
:type v: :class:`bgl.Buffer` object. Depends on function prototype. ('v' prototypes)
|
||||
:arg v: Specifies a pointer to an array of three elements: the x, y, and z coordinates
|
||||
of the new current normal.
|
||||
|
||||
|
||||
.. function:: glPixelMap (map, mapsize, values):
|
||||
|
||||
B{glPixelMapfv, glPixelMapuiv, glPixelMapusv}
|
||||
|
||||
Set up pixel transfer maps
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelMap.xhtml>`__
|
||||
|
||||
:type map: Enumerated constant
|
||||
:arg map: Specifies a symbolic map name.
|
||||
:type mapsize: int
|
||||
:arg mapsize: Specifies the size of the map being defined.
|
||||
:type values: :class:`bgl.Buffer` object. Depends on function prototype.
|
||||
:arg values: Specifies an array of mapsize values.
|
||||
|
||||
|
||||
.. function:: glPixelStore (pname, param):
|
||||
|
||||
B{glPixelStoref, glPixelStorei}
|
||||
|
||||
Set pixel storage modes
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelStore.xhtml>`__
|
||||
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of the parameter to be set.
|
||||
Six values affect the packing of pixel data into memory.
|
||||
Six more affect the unpacking of pixel data from memory.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value that pname is set to.
|
||||
|
||||
|
||||
.. function:: glPixelTransfer (pname, param):
|
||||
|
||||
B{glPixelTransferf, glPixelTransferi}
|
||||
|
||||
Set pixel transfer modes
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPixelTransfer.xhtml>`__
|
||||
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of the pixel transfer parameter to be set.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value that pname is set to.
|
||||
|
||||
|
||||
.. function:: glPointSize(size):
|
||||
|
||||
Specify the diameter of rasterized points
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPointSize.xhtml>`__
|
||||
|
||||
:type size: float
|
||||
:arg size: Specifies the diameter of rasterized points. The initial value is 1.
|
||||
|
||||
|
||||
.. function:: glPolygonMode(face, mode):
|
||||
|
||||
Select a polygon rasterization mode
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonMode.xhtml>`__
|
||||
|
||||
:type face: Enumerated constant
|
||||
:arg face: Specifies the polygons that mode applies to.
|
||||
Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing
|
||||
polygons, or GL_FRONT_AND_BACK for front- and back-facing polygons.
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies how polygons will be rasterized.
|
||||
The initial value is GL_FILL for both front- and back- facing polygons.
|
||||
|
||||
|
||||
.. function:: glPolygonOffset(factor, units):
|
||||
|
||||
Set the scale and units used to calculate depth values
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonOffset.xhtml>`__
|
||||
|
||||
:type factor: float
|
||||
:arg factor: Specifies a scale factor that is used to create a variable depth
|
||||
offset for each polygon. The initial value is 0.
|
||||
:type units: float
|
||||
:arg units: Is multiplied by an implementation-specific value to create a
|
||||
constant depth offset. The initial value is 0.
|
||||
|
||||
|
||||
.. function:: glRasterPos (x,y,z,w):
|
||||
|
||||
B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d,
|
||||
glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f,
|
||||
glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv,
|
||||
glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv,
|
||||
glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv}
|
||||
|
||||
Specify the raster position for pixel operations
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRasterPos.xhtml>`__
|
||||
|
||||
:type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only)
|
||||
:arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the
|
||||
raster position. If function prototype ends in 'v' specifies a pointer to an array of two,
|
||||
three, or four elements, specifying x, y, z, and w coordinates, respectively.
|
||||
|
||||
.. note::
|
||||
|
||||
If you are drawing to the 3d view with a Scriptlink of a space handler
|
||||
the zoom level of the panels will scale the glRasterPos by the view matrix.
|
||||
so a X of 10 will not always offset 10 pixels as you would expect.
|
||||
|
||||
To work around this get the scale value of the view matrix and use it to scale your pixel values.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import bgl
|
||||
xval, yval= 100, 40
|
||||
# Get the scale of the view matrix.
|
||||
view_matrix = bgl.Buffer(bgl.GL_FLOAT, 16)
|
||||
bgl.glGetFloatv(bgl.GL_MODELVIEW_MATRIX, view_matrix)
|
||||
f = 1.0 / view_matrix[0]
|
||||
|
||||
# Instead of the usual `glRasterPos2i(xval, yval)`.
|
||||
bgl.glRasterPos2f(xval * f, yval * f)
|
||||
|
||||
|
||||
.. function:: glReadBuffer(mode):
|
||||
|
||||
Select a color buffer source for pixels.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glReadBuffer.xhtml>`__
|
||||
|
||||
:type mode: Enumerated constant
|
||||
:arg mode: Specifies a color buffer.
|
||||
|
||||
|
||||
.. function:: glReadPixels(x, y, width, height, format, type, pixels):
|
||||
|
||||
Read a block of pixels from the frame buffer
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glReadPixels.xhtml>`__
|
||||
|
||||
:type x, y: int
|
||||
:arg x, y: Specify the window coordinates of the first pixel that is read
|
||||
from the frame buffer. This location is the lower left corner of a rectangular
|
||||
block of pixels.
|
||||
:type width, height: int
|
||||
:arg width, height: Specify the dimensions of the pixel rectangle. width and
|
||||
height of one correspond to a single pixel.
|
||||
:type format: Enumerated constant
|
||||
:arg format: Specifies the format of the pixel data.
|
||||
:type type: Enumerated constant
|
||||
:arg type: Specifies the data type of the pixel data.
|
||||
:type pixels: :class:`bgl.Buffer` object
|
||||
:arg pixels: Returns the pixel data.
|
||||
|
||||
|
||||
.. function:: glRect (x1,y1,x2,y2,v1,v2):
|
||||
|
||||
B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv}
|
||||
|
||||
Draw a rectangle
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRect.xhtml>`__
|
||||
|
||||
:type x1, y1: Depends on function prototype. (for non 'v' prototypes only)
|
||||
:arg x1, y1: Specify one vertex of a rectangle
|
||||
:type x2, y2: Depends on function prototype. (for non 'v' prototypes only)
|
||||
:arg x2, y2: Specify the opposite vertex of the rectangle
|
||||
:type v1, v2: Depends on function prototype. (for 'v' prototypes only)
|
||||
:arg v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer
|
||||
to the opposite vertex of the rectangle
|
||||
|
||||
|
||||
.. function:: glRotate (angle, x, y, z):
|
||||
|
||||
B{glRotated, glRotatef}
|
||||
|
||||
Multiply the current matrix by a rotation matrix
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glRotate.xhtml>`__
|
||||
|
||||
:type angle: Depends on function prototype.
|
||||
:arg angle: Specifies the angle of rotation in degrees.
|
||||
:type x, y, z: Depends on function prototype.
|
||||
:arg x, y, z: Specify the x, y, and z coordinates of a vector respectively.
|
||||
|
||||
|
||||
.. function:: glScale (x,y,z):
|
||||
|
||||
B{glScaled, glScalef}
|
||||
|
||||
Multiply the current matrix by a general scaling matrix
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glScale.xhtml>`__
|
||||
|
||||
:type x, y, z: Depends on function prototype.
|
||||
:arg x, y, z: Specify scale factors along the x, y, and z axes, respectively.
|
||||
|
||||
|
||||
.. function:: glScissor(x,y,width,height):
|
||||
|
||||
Define the scissor box
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glScissor.xhtml>`__
|
||||
|
||||
:type x, y: int
|
||||
:arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0).
|
||||
:type width, height: int
|
||||
:arg width height: Specify the width and height of the scissor box. When a
|
||||
GL context is first attached to a window, width and height are set to the
|
||||
dimensions of that window.
|
||||
|
||||
|
||||
.. function:: glStencilFunc(func, ref, mask):
|
||||
|
||||
Set function and reference value for stencil testing
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glStencilFunc.xhtml>`__
|
||||
|
||||
:type func: Enumerated constant
|
||||
:arg func: Specifies the test function.
|
||||
:type ref: int
|
||||
:arg ref: Specifies the reference value for the stencil test. ref is clamped
|
||||
to the range [0,2n-1], where n is the number of bitplanes in the stencil
|
||||
buffer. The initial value is 0.
|
||||
:type mask: unsigned int
|
||||
:arg mask: Specifies a mask that is ANDed with both the reference value and
|
||||
the stored stencil value when the test is done. The initial value is all 1's.
|
||||
|
||||
|
||||
.. function:: glStencilMask(mask):
|
||||
|
||||
Control the writing of individual bits in the stencil planes
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glStencilMask.xhtml>`__
|
||||
|
||||
:type mask: unsigned int
|
||||
:arg mask: Specifies a bit mask to enable and disable writing of individual bits
|
||||
in the stencil planes. Initially, the mask is all 1's.
|
||||
|
||||
|
||||
.. function:: glStencilOp(fail, zfail, zpass):
|
||||
|
||||
Set stencil test actions
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glStencilOp.xhtml>`__
|
||||
|
||||
:type fail: Enumerated constant
|
||||
:arg fail: Specifies the action to take when the stencil test fails.
|
||||
The initial value is GL_KEEP.
|
||||
:type zfail: Enumerated constant
|
||||
:arg zfail: Specifies the stencil action when the stencil test passes, but the
|
||||
depth test fails. zfail accepts the same symbolic constants as fail.
|
||||
The initial value is GL_KEEP.
|
||||
:type zpass: Enumerated constant
|
||||
:arg zpass: Specifies the stencil action when both the stencil test and the
|
||||
depth test pass, or when the stencil test passes and either there is no
|
||||
depth buffer or depth testing is not enabled. zpass accepts the same
|
||||
symbolic constants
|
||||
as fail. The initial value is GL_KEEP.
|
||||
|
||||
|
||||
.. function:: glTexCoord (s,t,r,q,v):
|
||||
|
||||
B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f,
|
||||
glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s,
|
||||
glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv,
|
||||
glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv,
|
||||
glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv,
|
||||
glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv}
|
||||
|
||||
Set the current texture coordinates
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexCoord.xhtml>`__
|
||||
|
||||
:type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
|
||||
:arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are
|
||||
present in all forms of the command.
|
||||
:type v: :class:`bgl.Buffer` object. Depends on function prototype. (for 'v' prototypes only)
|
||||
:arg v: Specifies a pointer to an array of one, two, three, or four elements,
|
||||
which in turn specify the s, t, r, and q texture coordinates.
|
||||
|
||||
|
||||
.. function:: glTexEnv (target, pname, param):
|
||||
|
||||
B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv}
|
||||
|
||||
Set texture environment parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexEnv.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of a single-valued texture environment
|
||||
parameter. Must be GL_TEXTURE_ENV_MODE.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies a single symbolic constant. If function prototype ends in 'v'
|
||||
specifies a pointer to a parameter array that contains either a single
|
||||
symbolic constant or an RGBA color
|
||||
|
||||
|
||||
.. function:: glTexGen (coord, pname, param):
|
||||
|
||||
B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv}
|
||||
|
||||
Control the generation of texture coordinates
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexGen.xhtml>`__
|
||||
|
||||
:type coord: Enumerated constant
|
||||
:arg coord: Specifies a texture coordinate.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of the texture- coordinate generation function.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies a single-valued texture generation parameter.
|
||||
If function prototype ends in 'v' specifies a pointer to an array of texture
|
||||
generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must
|
||||
contain a single symbolic constant. Otherwise, params holds the coefficients
|
||||
for the texture-coordinate generation function specified by pname.
|
||||
|
||||
|
||||
.. function:: glTexImage1D(target, level, internalformat, width, border, format, type, pixels):
|
||||
|
||||
Specify a one-dimensional texture image
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage1D.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the target texture.
|
||||
:type level: int
|
||||
:arg level: Specifies the level-of-detail number. Level 0 is the base image level.
|
||||
Level n is the nth mipmap reduction image.
|
||||
:type internalformat: int
|
||||
:arg internalformat: Specifies the number of color components in the texture.
|
||||
:type width: int
|
||||
:arg width: Specifies the width of the texture image. Must be 2n+2(border)
|
||||
for some integer n. All implementations support texture images that are
|
||||
at least 64 texels wide. The height of the 1D texture image is 1.
|
||||
:type border: int
|
||||
:arg border: Specifies the width of the border. Must be either 0 or 1.
|
||||
:type format: Enumerated constant
|
||||
:arg format: Specifies the format of the pixel data.
|
||||
:type type: Enumerated constant
|
||||
:arg type: Specifies the data type of the pixel data.
|
||||
:type pixels: :class:`bgl.Buffer` object.
|
||||
:arg pixels: Specifies a pointer to the image data in memory.
|
||||
|
||||
|
||||
.. function:: glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels):
|
||||
|
||||
Specify a two-dimensional texture image
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the target texture.
|
||||
:type level: int
|
||||
:arg level: Specifies the level-of-detail number. Level 0 is the base image level.
|
||||
Level n is the nth mipmap reduction image.
|
||||
:type internalformat: int
|
||||
:arg internalformat: Specifies the number of color components in the texture.
|
||||
:type width: int
|
||||
:arg width: Specifies the width of the texture image. Must be 2n+2(border)
|
||||
for some integer n. All implementations support texture images that are at
|
||||
least 64 texels wide.
|
||||
:type height: int
|
||||
:arg height: Specifies the height of the texture image. Must be 2m+2(border) for
|
||||
some integer m. All implementations support texture images that are at
|
||||
least 64 texels high.
|
||||
:type border: int
|
||||
:arg border: Specifies the width of the border. Must be either 0 or 1.
|
||||
:type format: Enumerated constant
|
||||
:arg format: Specifies the format of the pixel data.
|
||||
:type type: Enumerated constant
|
||||
:arg type: Specifies the data type of the pixel data.
|
||||
:type pixels: :class:`bgl.Buffer` object.
|
||||
:arg pixels: Specifies a pointer to the image data in memory.
|
||||
|
||||
|
||||
.. function:: glTexParameter (target, pname, param):
|
||||
|
||||
B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv}
|
||||
|
||||
Set texture parameters
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTexParameter.xhtml>`__
|
||||
|
||||
:type target: Enumerated constant
|
||||
:arg target: Specifies the target texture.
|
||||
:type pname: Enumerated constant
|
||||
:arg pname: Specifies the symbolic name of a single-valued texture parameter.
|
||||
:type param: Depends on function prototype.
|
||||
:arg param: Specifies the value of pname. If function prototype ends in 'v' specifies
|
||||
a pointer to an array where the value or values of pname are stored.
|
||||
|
||||
|
||||
.. function:: glTranslate (x, y, z):
|
||||
|
||||
B{glTranslatef, glTranslated}
|
||||
|
||||
Multiply the current matrix by a translation matrix
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glTranslate.xhtml>`__
|
||||
|
||||
:type x, y, z: Depends on function prototype.
|
||||
:arg x, y, z: Specify the x, y, and z coordinates of a translation vector.
|
||||
|
||||
|
||||
.. function:: glViewport(x,y,width,height):
|
||||
|
||||
Set the viewport
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glViewport.xhtml>`__
|
||||
|
||||
:type x, y: int
|
||||
:arg x, y: Specify the lower left corner of the viewport rectangle,
|
||||
in pixels. The initial value is (0,0).
|
||||
:type width, height: int
|
||||
:arg width, height: Specify the width and height of the viewport. When a GL
|
||||
context is first attached to a window, width and height are set to the
|
||||
dimensions of that window.
|
||||
|
||||
|
||||
.. function:: glUseProgram(program):
|
||||
|
||||
Installs a program object as part of current rendering state
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glUseProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
|
||||
|
||||
|
||||
.. function:: glValidateProgram(program):
|
||||
|
||||
Validates a program object
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glValidateProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the handle of the program object to be validated.
|
||||
|
||||
|
||||
.. function:: glLinkProgram(program):
|
||||
|
||||
Links a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the handle of the program object to be linked.
|
||||
|
||||
|
||||
.. function:: glActiveTexture(texture):
|
||||
|
||||
Select active texture unit.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glActiveTexture.xhtml>`__
|
||||
|
||||
:type texture: int
|
||||
:arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
|
||||
|
||||
|
||||
.. function:: glAttachShader(program, shader):
|
||||
|
||||
Attaches a shader object to a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glAttachShader.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object to which a shader object will be attached.
|
||||
:type shader: int
|
||||
:arg shader: Specifies the shader object that is to be attached.
|
||||
|
||||
|
||||
.. function:: glCompileShader(shader):
|
||||
|
||||
Compiles a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCompileShader.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies the shader object to be compiled.
|
||||
|
||||
|
||||
.. function:: glCreateProgram():
|
||||
|
||||
Creates a program object
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateProgram.xhtml>`__
|
||||
|
||||
:rtype: int
|
||||
:return: The new program or zero if an error occurs.
|
||||
|
||||
|
||||
.. function:: glCreateShader(shaderType):
|
||||
|
||||
Creates a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateShader.xhtml>`__
|
||||
|
||||
:type shaderType: Specifies the type of shader to be created.
|
||||
Must be one of ``GL_VERTEX_SHADER``,
|
||||
``GL_TESS_CONTROL_SHADER``,
|
||||
``GL_TESS_EVALUATION_SHADER``,
|
||||
``GL_GEOMETRY_SHADER``,
|
||||
or ``GL_FRAGMENT_SHADER``.
|
||||
:arg shaderType:
|
||||
:rtype: int
|
||||
:return: 0 if an error occurs.
|
||||
|
||||
|
||||
.. function:: glDeleteProgram(program):
|
||||
|
||||
Deletes a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object to be deleted.
|
||||
|
||||
|
||||
.. function:: glDeleteShader(shader):
|
||||
|
||||
Deletes a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteShader.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies the shader object to be deleted.
|
||||
|
||||
|
||||
.. function:: glDetachShader(program, shader):
|
||||
|
||||
Detaches a shader object from a program object to which it is attached.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glDetachShader.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object from which to detach the shader object.
|
||||
:type shader: int
|
||||
:arg shader: pecifies the program object from which to detach the shader object.
|
||||
|
||||
|
||||
.. function:: glGetAttachedShaders(program, maxCount, count, shaders):
|
||||
|
||||
Returns the handles of the shader objects attached to a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetAttachedShaders.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object to be queried.
|
||||
:type maxCount: int
|
||||
:arg maxCount: Specifies the size of the array for storing the returned object names.
|
||||
:type count: :class:`bgl.Buffer` int buffer.
|
||||
:arg count: Returns the number of names actually returned in objects.
|
||||
:type shaders: :class:`bgl.Buffer` int buffer.
|
||||
:arg shaders: Specifies an array that is used to return the names of attached shader objects.
|
||||
|
||||
|
||||
.. function:: glGetProgramInfoLog(program, maxLength, length, infoLog):
|
||||
|
||||
Returns the information log for a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetProgramInfoLog.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object whose information log is to be queried.
|
||||
:type maxLength: int
|
||||
:arg maxLength: Specifies the size of the character buffer for storing the returned information log.
|
||||
:type length: :class:`bgl.Buffer` int buffer.
|
||||
:arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
|
||||
:type infoLog: :class:`bgl.Buffer` char buffer.
|
||||
:arg infoLog: Specifies an array of characters that is used to return the information log.
|
||||
|
||||
|
||||
.. function:: glGetShaderInfoLog(program, maxLength, length, infoLog):
|
||||
|
||||
Returns the information log for a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetShaderInfoLog.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies the shader object whose information log is to be queried.
|
||||
:type maxLength: int
|
||||
:arg maxLength: Specifies the size of the character buffer for storing the returned information log.
|
||||
:type length: :class:`bgl.Buffer` int buffer.
|
||||
:arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
|
||||
:type infoLog: :class:`bgl.Buffer` char buffer.
|
||||
:arg infoLog: Specifies an array of characters that is used to return the information log.
|
||||
|
||||
|
||||
.. function:: glGetProgramiv(program, pname, params):
|
||||
|
||||
Returns a parameter from a program object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies the program object to be queried.
|
||||
:type pname: int
|
||||
:arg pname: Specifies the object parameter.
|
||||
:type params: :class:`bgl.Buffer` int buffer.
|
||||
:arg params: Returns the requested object parameter.
|
||||
|
||||
|
||||
.. function:: glIsShader(shader):
|
||||
|
||||
Determines if a name corresponds to a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsShader.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies a potential shader object.
|
||||
|
||||
|
||||
.. function:: glIsProgram(program):
|
||||
|
||||
Determines if a name corresponds to a program object
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glIsProgram.xhtml>`__
|
||||
|
||||
:type program: int
|
||||
:arg program: Specifies a potential program object.
|
||||
|
||||
|
||||
.. function:: glGetShaderSource(shader, bufSize, length, source):
|
||||
|
||||
Returns the source code string from a shader object
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glGetShaderSource.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies the shader object to be queried.
|
||||
:type bufSize: int
|
||||
:arg bufSize: Specifies the size of the character buffer for storing the returned source code string.
|
||||
:type length: :class:`bgl.Buffer` int buffer.
|
||||
:arg length: Returns the length of the string returned in source (excluding the null terminator).
|
||||
:type source: :class:`bgl.Buffer` char.
|
||||
:arg source: Specifies an array of characters that is used to return the source code string.
|
||||
|
||||
|
||||
.. function:: glShaderSource(shader, shader_string):
|
||||
|
||||
Replaces the source code in a shader object.
|
||||
|
||||
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man/html/glShaderSource.xhtml>`__
|
||||
|
||||
:type shader: int
|
||||
:arg shader: Specifies the handle of the shader object whose source code is to be replaced.
|
||||
:type shader_string: string
|
||||
:arg shader_string: The shader string.
|
||||
|
||||
|
||||
.. class:: Buffer
|
||||
|
||||
The Buffer object is simply a block of memory that is delineated and initialized by the
|
||||
user. Many OpenGL functions return data to a C-style pointer, however, because this
|
||||
is not possible in python the Buffer object can be used to this end. Wherever pointer
|
||||
notation is used in the OpenGL functions the Buffer object can be used in it's bgl
|
||||
wrapper. In some instances the Buffer object will need to be initialized with the template
|
||||
parameter, while in other instances the user will want to create just a blank buffer
|
||||
which will be zeroed by default.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import bgl
|
||||
|
||||
myByteBuffer = bgl.Buffer(bgl.GL_BYTE, [32, 32])
|
||||
bgl.glGetPolygonStipple(myByteBuffer)
|
||||
|
||||
print(myByteBuffer.dimensions)
|
||||
print(myByteBuffer.to_list())
|
||||
|
||||
sliceBuffer = myByteBuffer[0:16]
|
||||
print(sliceBuffer)
|
||||
|
||||
.. attribute:: dimensions
|
||||
|
||||
The number of dimensions of the Buffer.
|
||||
|
||||
.. method:: to_list()
|
||||
|
||||
The contents of the Buffer as a python list.
|
||||
|
||||
.. method:: __init__(type, dimensions, template = None):
|
||||
|
||||
This will create a new Buffer object for use with other bgl OpenGL commands.
|
||||
Only the type of argument to store in the buffer and the dimensions of the buffer
|
||||
are necessary. Buffers are zeroed by default unless a template is supplied, in
|
||||
which case the buffer is initialized to the template.
|
||||
|
||||
:type type: int
|
||||
:arg type: The format to store data in. The type should be one of
|
||||
GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT.
|
||||
:type dimensions: An int or sequence object specifying the dimensions of the buffer.
|
||||
:arg dimensions: If the dimensions are specified as an int a linear array will
|
||||
be created for the buffer. If a sequence is passed for the dimensions, the buffer
|
||||
becomes n-Dimensional, where n is equal to the number of parameters passed in the
|
||||
sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates
|
||||
a three- dimensional buffer. You can think of each additional dimension as a sub-item
|
||||
of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items.
|
||||
[(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc.
|
||||
:type template: A python sequence object (optional)
|
||||
:arg template: A sequence of matching dimensions which will be used to initialize
|
||||
the Buffer. If a template is not passed in all fields will be initialized to 0.
|
||||
:rtype: Buffer object
|
||||
:return: The newly created buffer as a PyObject.
|
||||
@@ -267,7 +267,6 @@ else:
|
||||
EXCLUDE_INFO_DOCS = True
|
||||
EXCLUDE_MODULES = [
|
||||
"aud",
|
||||
"bgl",
|
||||
"blf",
|
||||
"bl_math",
|
||||
"imbuf",
|
||||
@@ -2033,7 +2032,6 @@ def write_rst_index(basepath):
|
||||
standalone_modules = (
|
||||
# Sub-modules are added in parent page.
|
||||
"aud",
|
||||
"bgl",
|
||||
"bl_math",
|
||||
"blf",
|
||||
"bmesh",
|
||||
@@ -2364,7 +2362,6 @@ def copy_handwritten_rsts(basepath):
|
||||
|
||||
# TODO: put this docs in Blender's code and use import as per modules above.
|
||||
handwritten_modules = [
|
||||
"bgl", # "Blender OpenGl wrapper"
|
||||
"bmesh.ops", # Generated by `rst_from_bmesh_opdefines.py`.
|
||||
|
||||
# Includes.
|
||||
|
||||
@@ -350,7 +350,7 @@ def banner(context):
|
||||
"PYTHON INTERACTIVE CONSOLE {:s}".format(version_string),
|
||||
"",
|
||||
"Builtin Modules: "
|
||||
"bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, gpu, blf, mathutils",
|
||||
"bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, gpu, blf, mathutils",
|
||||
|
||||
"Convenience Imports: from mathutils import *; from math import *",
|
||||
"Convenience Variables: C = bpy.context, D = bpy.data",
|
||||
|
||||
@@ -89,14 +89,6 @@ def draw_texture_2d(texture, position, width, height):
|
||||
gpu.matrix.scale((width, height))
|
||||
|
||||
shader = gpu.shader.from_builtin('IMAGE')
|
||||
|
||||
if isinstance(texture, int):
|
||||
# Call the legacy bgl to not break the existing API
|
||||
import bgl
|
||||
bgl.glActiveTexture(bgl.GL_TEXTURE0)
|
||||
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture)
|
||||
shader.uniform_int("image", 0)
|
||||
else:
|
||||
shader.uniform_sampler("image", texture)
|
||||
shader.uniform_sampler("image", texture)
|
||||
|
||||
batch.draw(shader)
|
||||
|
||||
@@ -590,10 +590,6 @@ void BLF_draw(int fontid, const char *str, const size_t str_len, ResultBLF *r_in
|
||||
FontBLF *font = blf_get(fontid);
|
||||
|
||||
if (font) {
|
||||
|
||||
/* Avoid bgl usage to corrupt BLF drawing. */
|
||||
GPU_bgl_end();
|
||||
|
||||
blf_draw_gpu__start(font);
|
||||
if (font->flags & BLF_WORD_WRAP) {
|
||||
blf_font_draw__wrap(font, str, str_len, r_info);
|
||||
@@ -635,8 +631,6 @@ void BLF_draw_svg_icon(uint icon_id,
|
||||
#ifndef WITH_HEADLESS
|
||||
FontBLF *font = global_font[0];
|
||||
if (font) {
|
||||
/* Avoid bgl usage to corrupt BLF drawing. */
|
||||
GPU_bgl_end();
|
||||
blf_draw_gpu__start(font);
|
||||
blf_draw_svg_icon(font, icon_id, x, y, size, color, outline_alpha, multicolor, edit_source_cb);
|
||||
blf_draw_gpu__end(font);
|
||||
|
||||
@@ -173,13 +173,6 @@ struct Global {
|
||||
*/
|
||||
char autoexec_fail[200];
|
||||
|
||||
/**
|
||||
* Has there been an opengl deprecation call detected when running on a none OpenGL backend.
|
||||
*/
|
||||
bool opengl_deprecation_usage_detected;
|
||||
const char *opengl_deprecation_usage_filename;
|
||||
int opengl_deprecation_usage_lineno;
|
||||
|
||||
/**
|
||||
* Triggers a GPU capture if the name matches a DebugScope.
|
||||
* Set using `--debug-gpu-scope-capture "debug_scope"`.
|
||||
|
||||
@@ -259,8 +259,6 @@ class Instance : public DrawEngine {
|
||||
const RenderEngineType *type = render_engine->type;
|
||||
type->view_draw(render_engine, draw_ctx->evil_C, draw_ctx->depsgraph);
|
||||
|
||||
GPU_bgl_end();
|
||||
|
||||
GPU_matrix_pop();
|
||||
GPU_matrix_pop_projection();
|
||||
|
||||
@@ -362,7 +360,6 @@ class Instance : public DrawEngine {
|
||||
GPU_matrix_pop_projection();
|
||||
|
||||
blender::draw::command::StateSet::set();
|
||||
GPU_bgl_end();
|
||||
|
||||
RE_engine_draw_release(re);
|
||||
}
|
||||
|
||||
@@ -263,9 +263,6 @@ static void ed_region_draw_cb_draw(const bContext *C, ARegion *region, ARegionTy
|
||||
LISTBASE_FOREACH_MUTABLE (RegionDrawCB *, rdc, &art->drawcalls) {
|
||||
if (rdc->type == type) {
|
||||
rdc->draw(C, region, rdc->customdata);
|
||||
|
||||
/* This is needed until we get rid of BGL which can change the states we are tracking. */
|
||||
GPU_bgl_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,14 +215,6 @@ void GPU_flush();
|
||||
void GPU_finish();
|
||||
void GPU_apply_state();
|
||||
|
||||
void GPU_bgl_start();
|
||||
|
||||
/**
|
||||
* Just turn off the `bgl` safeguard system. Can be called even without #GPU_bgl_start.
|
||||
*/
|
||||
void GPU_bgl_end();
|
||||
bool GPU_bgl_get();
|
||||
|
||||
/**
|
||||
* A barrier _must_ be issued _after_ a shader arbitrary write to a buffer or a
|
||||
* texture (i.e: using imageStore, imageAtomics, or SSBO). Otherwise, the written value may not
|
||||
|
||||
@@ -1272,13 +1272,6 @@ void **GPU_texture_py_reference_get(GPUTexture *texture);
|
||||
void GPU_texture_py_reference_set(GPUTexture *texture, void **py_ref);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the backend handle of the texture.
|
||||
* \note This is a legacy feature only working on OpenGL backend. It will be removed once we remove
|
||||
* the python BGL module.
|
||||
*/
|
||||
int GPU_texture_opengl_bindcode(const GPUTexture *texture);
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -319,65 +319,6 @@ void GPU_apply_state()
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name BGL workaround
|
||||
*
|
||||
* bgl makes direct GL calls that makes our state tracking out of date.
|
||||
* This flag make it so that the pyGPU calls will not override the state set by
|
||||
* bgl functions.
|
||||
* \{ */
|
||||
|
||||
void GPU_bgl_start()
|
||||
{
|
||||
Context *ctx = Context::get();
|
||||
if (!(ctx && ctx->state_manager)) {
|
||||
return;
|
||||
}
|
||||
StateManager &state_manager = *(Context::get()->state_manager);
|
||||
if (state_manager.use_bgl == false) {
|
||||
/* Expected by many addons (see #80169, #81289).
|
||||
* This will reset the blend function. */
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
/* Equivalent of setting the depth func `glDepthFunc(GL_LEQUAL)`
|
||||
* Needed since Python scripts may enable depth test.
|
||||
* Without this block the depth test function is undefined. */
|
||||
{
|
||||
eGPUDepthTest depth_test_real = GPU_depth_test_get();
|
||||
eGPUDepthTest depth_test_temp = GPU_DEPTH_LESS_EQUAL;
|
||||
if (depth_test_real != depth_test_temp) {
|
||||
GPU_depth_test(depth_test_temp);
|
||||
state_manager.apply_state();
|
||||
GPU_depth_test(depth_test_real);
|
||||
}
|
||||
}
|
||||
|
||||
state_manager.apply_state();
|
||||
state_manager.use_bgl = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_bgl_end()
|
||||
{
|
||||
Context *ctx = Context::get();
|
||||
if (!(ctx && ctx->state_manager)) {
|
||||
return;
|
||||
}
|
||||
StateManager &state_manager = *ctx->state_manager;
|
||||
if (state_manager.use_bgl == true) {
|
||||
state_manager.use_bgl = false;
|
||||
/* Resync state tracking. */
|
||||
state_manager.force_state();
|
||||
}
|
||||
}
|
||||
|
||||
bool GPU_bgl_get()
|
||||
{
|
||||
return Context::get()->state_manager->use_bgl;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Synchronization Utils
|
||||
* \{ */
|
||||
|
||||
@@ -946,12 +946,6 @@ void GPU_texture_py_reference_set(GPUTexture *texture, void **py_ref)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TODO: remove. */
|
||||
int GPU_texture_opengl_bindcode(const GPUTexture *texture)
|
||||
{
|
||||
return unwrap(texture)->gl_bindcode_get();
|
||||
}
|
||||
|
||||
void GPU_texture_get_mipmap_size(GPUTexture *texture, int mip_level, int *r_size)
|
||||
{
|
||||
unwrap(texture)->mip_size_get(mip_level, r_size);
|
||||
|
||||
@@ -215,7 +215,7 @@ void check_gl_error(const char *info)
|
||||
|
||||
void check_gl_resources(const char *info)
|
||||
{
|
||||
if (!(G.debug & G_DEBUG_GPU) || GPU_bgl_get()) {
|
||||
if (!(G.debug & G_DEBUG_GPU)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -556,13 +556,6 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
|
||||
BKE_image_release_ibuf(im, ibuf, lock);
|
||||
}
|
||||
|
||||
static int rna_Image_bindcode_get(PointerRNA *ptr)
|
||||
{
|
||||
Image *ima = (Image *)ptr->data;
|
||||
GPUTexture *tex = ima->gputexture[TEXTARGET_2D][0];
|
||||
return (tex) ? GPU_texture_opengl_bindcode(tex) : 0;
|
||||
}
|
||||
|
||||
static int rna_Image_depth_get(PointerRNA *ptr)
|
||||
{
|
||||
Image *im = (Image *)ptr->data;
|
||||
@@ -1296,12 +1289,6 @@ static void rna_def_image(BlenderRNA *brna)
|
||||
prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
|
||||
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", nullptr, nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
|
||||
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "RenderSlot");
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "renderslots", nullptr);
|
||||
|
||||
@@ -66,8 +66,6 @@ static void rna_gizmo_draw_cb(const bContext *C, wmGizmo *gz)
|
||||
RNA_parameter_set_lookup(&list, "context", &C);
|
||||
gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
|
||||
RNA_parameter_list_free(&list);
|
||||
/* This callback may have called bgl functions. */
|
||||
GPU_bgl_end();
|
||||
}
|
||||
|
||||
static void rna_gizmo_draw_select_cb(const bContext *C, wmGizmo *gz, int select_id)
|
||||
@@ -84,8 +82,6 @@ static void rna_gizmo_draw_select_cb(const bContext *C, wmGizmo *gz, int select_
|
||||
RNA_parameter_set_lookup(&list, "select_id", &select_id);
|
||||
gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
|
||||
RNA_parameter_list_free(&list);
|
||||
/* This callback may have called bgl functions. */
|
||||
GPU_bgl_end();
|
||||
}
|
||||
|
||||
static int rna_gizmo_test_select_cb(bContext *C, wmGizmo *gz, const int location[2])
|
||||
|
||||
@@ -12,7 +12,6 @@ set(INC_SYS
|
||||
)
|
||||
|
||||
set(SRC
|
||||
bgl.cc
|
||||
bl_math_py_api.cc
|
||||
blf_py_api.cc
|
||||
bpy_threads.cc
|
||||
@@ -22,7 +21,6 @@ set(SRC
|
||||
py_capi_rna.cc
|
||||
py_capi_utils.cc
|
||||
|
||||
bgl.hh
|
||||
bl_math_py_api.hh
|
||||
blf_py_api.hh
|
||||
idprop_py_api.hh
|
||||
|
||||
@@ -1,2727 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup pygen
|
||||
*
|
||||
* This file is the 'bgl' module which wraps OpenGL functions and constants,
|
||||
* allowing script writers to make OpenGL calls in their Python scripts.
|
||||
*
|
||||
* \note
|
||||
* This module is very similar to 'PyOpenGL' which could replace 'bgl' one day.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "GPU_context.hh"
|
||||
|
||||
#include "py_capi_utils.hh"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
/* Forward declare API's defines here. */
|
||||
#define USE_BGL_DEPRECATED_API
|
||||
#include "bgl.hh" /* Own include. */
|
||||
#undef USE_BGL_DEPRECATED_API
|
||||
|
||||
static CLG_LogRef LOG = {"bgl"};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Local utility defines for wrapping OpenGL
|
||||
* \{ */
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
static void report_deprecated_call(const char *function_name)
|
||||
{
|
||||
/* Only report first 10 deprecated calls. BGL is typically used inside an handler that is
|
||||
* triggered at refresh. */
|
||||
static int times = 0;
|
||||
while (times >= 10) {
|
||||
return;
|
||||
}
|
||||
char message[256];
|
||||
SNPRINTF(message,
|
||||
"'bgl.gl%s' is deprecated and will not work on all platforms. Report or update your "
|
||||
"script to use 'gpu' module.",
|
||||
function_name);
|
||||
CLOG_WARN(&LOG, "%s", message);
|
||||
PyErr_WarnEx(PyExc_DeprecationWarning, message, 1);
|
||||
times++;
|
||||
}
|
||||
|
||||
static void report_deprecated_call_to_user()
|
||||
{
|
||||
/* Only report the first deprecated usage. */
|
||||
if (G.opengl_deprecation_usage_detected) {
|
||||
return;
|
||||
}
|
||||
G.opengl_deprecation_usage_detected = true;
|
||||
PyC_FileAndNum(&G.opengl_deprecation_usage_filename, &G.opengl_deprecation_usage_lineno);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Local utility defines for wrapping OpenGL
|
||||
* \{ */
|
||||
|
||||
/* By golly George! It looks like fancy pants macro time! */
|
||||
|
||||
/* TYPE_str is the string to pass to Py_ArgParse (for the format) */
|
||||
/* TYPE_var is the name to pass to the GL function */
|
||||
/* TYPE_ref is the pointer to pass to Py_ArgParse (to store in) */
|
||||
/* TYPE_def is the C initialization of the variable */
|
||||
|
||||
#define void_str ""
|
||||
#define void_var(num)
|
||||
#define void_ref(num) &bgl_var##num
|
||||
#define void_def(num) char bgl_var##num
|
||||
|
||||
#if 0
|
||||
# define buffer_str "O!"
|
||||
# define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
# define buffer_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
# define buffer_def(number) Buffer *bgl_buffer##number
|
||||
#endif
|
||||
|
||||
/* GL Pointer fields, handled by buffer type */
|
||||
/* GLdoubleP, GLfloatP, GLintP, GLuintP, GLshortP, GLsizeiP, GLcharP */
|
||||
|
||||
#define GLbooleanP_str "O!"
|
||||
#define GLbooleanP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLbooleanP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLbooleanP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLbyteP_str "O!"
|
||||
#define GLbyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLbyteP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLbyteP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLubyteP_str "O!"
|
||||
#define GLubyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLubyteP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLubyteP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLintP_str "O!"
|
||||
#define GLintP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLintP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLintP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLint64P_str "O!"
|
||||
#define GLint64P_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLint64P_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLint64P_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLenumP_str "O!"
|
||||
#define GLenumP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLenumP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLenumP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLuintP_str "O!"
|
||||
#define GLuintP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLuintP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLuintP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#if 0
|
||||
# define GLuint64P_str "O!"
|
||||
# define GLuint64P_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
# define GLuint64P_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
# define GLuint64P_def(number) Buffer *bgl_buffer##number
|
||||
#endif
|
||||
|
||||
#define GLshortP_str "O!"
|
||||
#define GLshortP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLshortP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLshortP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLushortP_str "O!"
|
||||
#define GLushortP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLushortP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLushortP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLfloatP_str "O!"
|
||||
#define GLfloatP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLfloatP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLfloatP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLdoubleP_str "O!"
|
||||
#define GLdoubleP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLdoubleP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLdoubleP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#if 0
|
||||
# define GLclampfP_str "O!"
|
||||
# define GLclampfP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
# define GLclampfP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
# define GLclampfP_def(number) Buffer *bgl_buffer##number
|
||||
#endif
|
||||
|
||||
struct BufferOrOffset {
|
||||
Buffer *buffer;
|
||||
void *offset;
|
||||
};
|
||||
|
||||
#define GLvoidP_str "O&"
|
||||
#define GLvoidP_var(number) \
|
||||
((bgl_buffer##number.buffer) ? (bgl_buffer##number.buffer)->buf.asvoid : \
|
||||
(bgl_buffer##number.offset))
|
||||
#define GLvoidP_ref(number) BGL_BufferOrOffsetConverter, &bgl_buffer##number
|
||||
#define GLvoidP_def(number) BufferOrOffset bgl_buffer##number
|
||||
|
||||
#define GLsizeiP_str "O!"
|
||||
#define GLsizeiP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLsizeiP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLsizeiP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#define GLcharP_str "O!"
|
||||
#define GLcharP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
#define GLcharP_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
#define GLcharP_def(number) Buffer *bgl_buffer##number
|
||||
|
||||
#if 0
|
||||
# define buffer_str "O!"
|
||||
# define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
||||
# define buffer_ref(number) &BGL_bufferType, &bgl_buffer##number
|
||||
# define buffer_def(number) Buffer *bgl_buffer##number
|
||||
#endif
|
||||
|
||||
/* The standard GL typedefs are used as prototypes, we can't
|
||||
* use the GL type directly because Py_ArgParse expects normal
|
||||
* C types.
|
||||
*
|
||||
* Py_ArgParse doesn't grok writing into unsigned variables,
|
||||
* so we use signed everything (even stuff that should be unsigned.
|
||||
*/
|
||||
|
||||
/* Type: `typedef uint GLenum`. */
|
||||
#define GLenum_str "i"
|
||||
#define GLenum_var(num) bgl_var##num
|
||||
#define GLenum_ref(num) &bgl_var##num
|
||||
#define GLenum_def(num) /*unsigned*/ int GLenum_var(num)
|
||||
|
||||
/* Type: `typedef uint GLboolean`. */
|
||||
#define GLboolean_str "b"
|
||||
#define GLboolean_var(num) bgl_var##num
|
||||
#define GLboolean_ref(num) &bgl_var##num
|
||||
#define GLboolean_def(num) /*unsigned*/ char GLboolean_var(num)
|
||||
|
||||
/* Type: `typedef uint GLbitfield`. */
|
||||
#define GLbitfield_str "i"
|
||||
#define GLbitfield_var(num) bgl_var##num
|
||||
#define GLbitfield_ref(num) &bgl_var##num
|
||||
#define GLbitfield_def(num) /*unsigned*/ int GLbitfield_var(num)
|
||||
|
||||
#if 0
|
||||
/* Type: `typedef signed char GLbyte`. */
|
||||
# define GLbyte_str "b"
|
||||
# define GLbyte_var(num) bgl_var##num
|
||||
# define GLbyte_ref(num) &bgl_var##num
|
||||
# define GLbyte_def(num) signed char GLbyte_var(num)
|
||||
#endif
|
||||
|
||||
/* Type: `typedef short GLshort`. */
|
||||
#define GLshort_str "h"
|
||||
#define GLshort_var(num) bgl_var##num
|
||||
#define GLshort_ref(num) &bgl_var##num
|
||||
#define GLshort_def(num) short GLshort_var(num)
|
||||
|
||||
/* Type: `typedef int GLint`. */
|
||||
#define GLint_str "i"
|
||||
#define GLint_var(num) bgl_var##num
|
||||
#define GLint_ref(num) &bgl_var##num
|
||||
#define GLint_def(num) int GLint_var(num)
|
||||
|
||||
/* Type: `typedef int GLsizei`. */
|
||||
#define GLsizei_str "n"
|
||||
#define GLsizei_var(num) bgl_var##num
|
||||
#define GLsizei_ref(num) &bgl_var##num
|
||||
#define GLsizei_def(num) size_t GLsizei_var(num)
|
||||
|
||||
/* Type: `typedef int GLsizeiptr`. */
|
||||
#define GLsizeiptr_str "n"
|
||||
#define GLsizeiptr_var(num) bgl_var##num
|
||||
#define GLsizeiptr_ref(num) &bgl_var##num
|
||||
#define GLsizeiptr_def(num) size_t GLsizeiptr_var(num)
|
||||
|
||||
/* Type: `typedef int GLintptr`. */
|
||||
#define GLintptr_str "n"
|
||||
#define GLintptr_var(num) bgl_var##num
|
||||
#define GLintptr_ref(num) &bgl_var##num
|
||||
#define GLintptr_def(num) size_t GLintptr_var(num)
|
||||
|
||||
/* Type: `typedef uchar GLubyte`. */
|
||||
#define GLubyte_str "B"
|
||||
#define GLubyte_var(num) bgl_var##num
|
||||
#define GLubyte_ref(num) &bgl_var##num
|
||||
#define GLubyte_def(num) /*unsigned*/ char GLubyte_var(num)
|
||||
|
||||
#if 0
|
||||
/* Type: `typedef ushort GLushort`. */
|
||||
# define GLushort_str "H"
|
||||
# define GLushort_var(num) bgl_var##num
|
||||
# define GLushort_ref(num) &bgl_var##num
|
||||
# define GLushort_def(num) /*unsigned*/ short GLushort_var(num)
|
||||
#endif
|
||||
|
||||
/* Type: `typedef uint GLuint`. */
|
||||
#define GLuint_str "I"
|
||||
#define GLuint_var(num) bgl_var##num
|
||||
#define GLuint_ref(num) &bgl_var##num
|
||||
#define GLuint_def(num) /*unsigned*/ int GLuint_var(num)
|
||||
|
||||
/* Type: `typedef uint GLuint64`. */
|
||||
#if 0
|
||||
# define GLuint64_str "Q"
|
||||
# define GLuint64_var(num) bgl_var##num
|
||||
# define GLuint64_ref(num) &bgl_var##num
|
||||
# define GLuint64_def(num) /*unsigned*/ int GLuint64_var(num)
|
||||
#endif
|
||||
|
||||
/* Type: `typedef uint GLsync`. */
|
||||
#if 0
|
||||
# define GLsync_str "I"
|
||||
# define GLsync_var(num) bgl_var##num
|
||||
# define GLsync_ref(num) &bgl_var##num
|
||||
# define GLsync_def(num) /*unsigned*/ int GLsync_var(num)
|
||||
#endif
|
||||
|
||||
/* Type: `typedef float GLfloat`. */
|
||||
#define GLfloat_str "f"
|
||||
#define GLfloat_var(num) bgl_var##num
|
||||
#define GLfloat_ref(num) &bgl_var##num
|
||||
#define GLfloat_def(num) float GLfloat_var(num)
|
||||
|
||||
/* Type: `typedef char *GLstring`. */
|
||||
#define GLstring_str "s"
|
||||
#define GLstring_var(number) bgl_var##number
|
||||
#define GLstring_ref(number) &bgl_var##number
|
||||
#define GLstring_def(number) char *GLstring_var(number)
|
||||
|
||||
/* Type: `typedef float GLclampf`. */
|
||||
#if 0
|
||||
# define GLclampf_str "f"
|
||||
# define GLclampf_var(num) bgl_var##num
|
||||
# define GLclampf_ref(num) &bgl_var##num
|
||||
# define GLclampf_def(num) float GLclampf_var(num)
|
||||
#endif
|
||||
|
||||
/* Type: `typedef double GLdouble`. */
|
||||
#define GLdouble_str "d"
|
||||
#define GLdouble_var(num) bgl_var##num
|
||||
#define GLdouble_ref(num) &bgl_var##num
|
||||
#define GLdouble_def(num) double GLdouble_var(num)
|
||||
|
||||
/* Type: `typedef double GLclampd`. */
|
||||
#if 0
|
||||
# define GLclampd_str "d"
|
||||
# define GLclampd_var(num) bgl_var##num
|
||||
# define GLclampd_ref(num) &bgl_var##num
|
||||
# define GLclampd_def(num) double GLclampd_var(num)
|
||||
#endif
|
||||
|
||||
#define _arg_def1(a1) a1##_def(1)
|
||||
#define _arg_def2(a1, a2) \
|
||||
_arg_def1(a1); \
|
||||
a2##_def(2)
|
||||
#define _arg_def3(a1, a2, a3) \
|
||||
_arg_def2(a1, a2); \
|
||||
a3##_def(3)
|
||||
#define _arg_def4(a1, a2, a3, a4) \
|
||||
_arg_def3(a1, a2, a3); \
|
||||
a4##_def(4)
|
||||
#define _arg_def5(a1, a2, a3, a4, a5) \
|
||||
_arg_def4(a1, a2, a3, a4); \
|
||||
a5##_def(5)
|
||||
#define _arg_def6(a1, a2, a3, a4, a5, a6) \
|
||||
_arg_def5(a1, a2, a3, a4, a5); \
|
||||
a6##_def(6)
|
||||
#define _arg_def7(a1, a2, a3, a4, a5, a6, a7) \
|
||||
_arg_def6(a1, a2, a3, a4, a5, a6); \
|
||||
a7##_def(7)
|
||||
#define _arg_def8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
||||
_arg_def7(a1, a2, a3, a4, a5, a6, a7); \
|
||||
a8##_def(8)
|
||||
#define _arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||
_arg_def8(a1, a2, a3, a4, a5, a6, a7, a8); \
|
||||
a9##_def(9)
|
||||
#define _arg_def10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
|
||||
_arg_def9(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
|
||||
a10##_def(10)
|
||||
#define _arg_def11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
|
||||
_arg_def10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); \
|
||||
a11##_def(11)
|
||||
#define arg_def(...) VA_NARGS_CALL_OVERLOAD(_arg_def, __VA_ARGS__)
|
||||
|
||||
#define _arg_var1(a1) a1##_var(1)
|
||||
#define _arg_var2(a1, a2) _arg_var1(a1), a2##_var(2)
|
||||
#define _arg_var3(a1, a2, a3) _arg_var2(a1, a2), a3##_var(3)
|
||||
#define _arg_var4(a1, a2, a3, a4) _arg_var3(a1, a2, a3), a4##_var(4)
|
||||
#define _arg_var5(a1, a2, a3, a4, a5) _arg_var4(a1, a2, a3, a4), a5##_var(5)
|
||||
#define _arg_var6(a1, a2, a3, a4, a5, a6) _arg_var5(a1, a2, a3, a4, a5), a6##_var(6)
|
||||
#define _arg_var7(a1, a2, a3, a4, a5, a6, a7) _arg_var6(a1, a2, a3, a4, a5, a6), a7##_var(7)
|
||||
#define _arg_var8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
||||
_arg_var7(a1, a2, a3, a4, a5, a6, a7), a8##_var(8)
|
||||
#define _arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||
_arg_var8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_var(9)
|
||||
#define _arg_var10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
|
||||
_arg_var9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_var(10)
|
||||
#define _arg_var11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
|
||||
_arg_var10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10), a11##_var(11)
|
||||
#define arg_var(...) VA_NARGS_CALL_OVERLOAD(_arg_var, __VA_ARGS__)
|
||||
|
||||
#define _arg_ref1(a1) a1##_ref(1)
|
||||
#define _arg_ref2(a1, a2) _arg_ref1(a1), a2##_ref(2)
|
||||
#define _arg_ref3(a1, a2, a3) _arg_ref2(a1, a2), a3##_ref(3)
|
||||
#define _arg_ref4(a1, a2, a3, a4) _arg_ref3(a1, a2, a3), a4##_ref(4)
|
||||
#define _arg_ref5(a1, a2, a3, a4, a5) _arg_ref4(a1, a2, a3, a4), a5##_ref(5)
|
||||
#define _arg_ref6(a1, a2, a3, a4, a5, a6) _arg_ref5(a1, a2, a3, a4, a5), a6##_ref(6)
|
||||
#define _arg_ref7(a1, a2, a3, a4, a5, a6, a7) _arg_ref6(a1, a2, a3, a4, a5, a6), a7##_ref(7)
|
||||
#define _arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
||||
_arg_ref7(a1, a2, a3, a4, a5, a6, a7), a8##_ref(8)
|
||||
#define _arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||
_arg_ref8(a1, a2, a3, a4, a5, a6, a7, a8), a9##_ref(9)
|
||||
#define _arg_ref10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
|
||||
_arg_ref9(a1, a2, a3, a4, a5, a6, a7, a8, a9), a10##_ref(10)
|
||||
#define _arg_ref11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
|
||||
_arg_ref10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10), a11##_ref(11)
|
||||
#define arg_ref(...) VA_NARGS_CALL_OVERLOAD(_arg_ref, __VA_ARGS__)
|
||||
|
||||
#define _arg_str1(a1) a1##_str
|
||||
#define _arg_str2(a1, a2) _arg_str1(a1) a2##_str
|
||||
#define _arg_str3(a1, a2, a3) _arg_str2(a1, a2) a3##_str
|
||||
#define _arg_str4(a1, a2, a3, a4) _arg_str3(a1, a2, a3) a4##_str
|
||||
#define _arg_str5(a1, a2, a3, a4, a5) _arg_str4(a1, a2, a3, a4) a5##_str
|
||||
#define _arg_str6(a1, a2, a3, a4, a5, a6) _arg_str5(a1, a2, a3, a4, a5) a6##_str
|
||||
#define _arg_str7(a1, a2, a3, a4, a5, a6, a7) _arg_str6(a1, a2, a3, a4, a5, a6) a7##_str
|
||||
#define _arg_str8(a1, a2, a3, a4, a5, a6, a7, a8) _arg_str7(a1, a2, a3, a4, a5, a6, a7) a8##_str
|
||||
#define _arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||
_arg_str8(a1, a2, a3, a4, a5, a6, a7, a8) a9##_str
|
||||
#define _arg_str10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
|
||||
_arg_str9(a1, a2, a3, a4, a5, a6, a7, a8, a9) a10##_str
|
||||
#define _arg_str11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
|
||||
_arg_str10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) a11##_str
|
||||
#define arg_str(...) VA_NARGS_CALL_OVERLOAD(_arg_str, __VA_ARGS__)
|
||||
|
||||
#define ret_def_void
|
||||
#define ret_set_void
|
||||
#define ret_default_void
|
||||
#define ret_ret_void return Py_INCREF(Py_None), Py_None
|
||||
|
||||
#define ret_def_GLint int ret_int
|
||||
#define ret_set_GLint ret_int =
|
||||
#define ret_default_GLint -1
|
||||
#define ret_ret_GLint return PyLong_FromLong(ret_int)
|
||||
|
||||
#define ret_def_GLuint uint ret_uint
|
||||
#define ret_set_GLuint ret_uint =
|
||||
#define ret_default_GLuint 0
|
||||
#define ret_ret_GLuint return PyLong_FromLong(long(ret_uint))
|
||||
|
||||
#if 0
|
||||
# define ret_def_GLsizei size_t ret_size_t
|
||||
# define ret_set_GLsizei ret_size_t =
|
||||
# define ret_ret_GLsizei return PyLong_FromSsize_t(ret_size_t)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
# define ret_def_GLsync uint ret_sync
|
||||
# define ret_set_GLsync ret_sync =
|
||||
# define ret_ret_GLsync return PyLong_FromLong(long(ret_sync))
|
||||
#endif
|
||||
|
||||
#define ret_def_GLenum uint ret_uint
|
||||
#define ret_set_GLenum ret_uint =
|
||||
#define ret_default_GLenum 0
|
||||
#define ret_ret_GLenum return PyLong_FromLong(long(ret_uint))
|
||||
|
||||
#define ret_def_GLboolean uchar ret_bool
|
||||
#define ret_set_GLboolean ret_bool =
|
||||
#define ret_default_GLboolean GL_FALSE
|
||||
#define ret_ret_GLboolean return PyLong_FromLong(long(ret_bool))
|
||||
|
||||
#define ret_def_GLstring \
|
||||
const char *default_GLstring = ""; \
|
||||
const uchar *ret_str
|
||||
#define ret_set_GLstring ret_str =
|
||||
#define ret_default_GLstring (const uchar *)default_GLstring
|
||||
|
||||
#define ret_ret_GLstring \
|
||||
if (ret_str) { \
|
||||
return PyUnicode_FromString((const char *)ret_str); \
|
||||
} \
|
||||
\
|
||||
PyErr_SetString(PyExc_AttributeError, "could not get opengl string"); \
|
||||
return nullptr;
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Forward Declarations */
|
||||
|
||||
static PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
|
||||
static PyObject *Method_ShaderSource(PyObject *self, PyObject *args);
|
||||
|
||||
/* Buffer sequence methods */
|
||||
|
||||
static Py_ssize_t Buffer_len(Buffer *self);
|
||||
static PyObject *Buffer_item(Buffer *self, Py_ssize_t i);
|
||||
static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end);
|
||||
static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v);
|
||||
static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq);
|
||||
static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
|
||||
static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Utility Functions
|
||||
* \{ */
|
||||
|
||||
int BGL_typeSize(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case GL_BYTE:
|
||||
return sizeof(char);
|
||||
case GL_SHORT:
|
||||
return sizeof(short);
|
||||
case GL_INT:
|
||||
return sizeof(int);
|
||||
case GL_FLOAT:
|
||||
return sizeof(float);
|
||||
case GL_DOUBLE:
|
||||
return sizeof(double);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int gl_buffer_type_from_py_buffer(Py_buffer *pybuffer)
|
||||
{
|
||||
const char format = PyC_StructFmt_type_from_str(pybuffer->format);
|
||||
const Py_ssize_t itemsize = pybuffer->itemsize;
|
||||
|
||||
if (PyC_StructFmt_type_is_float_any(format)) {
|
||||
if (itemsize == 4) {
|
||||
return GL_FLOAT;
|
||||
}
|
||||
if (itemsize == 8) {
|
||||
return GL_DOUBLE;
|
||||
}
|
||||
}
|
||||
if (PyC_StructFmt_type_is_byte(format) || PyC_StructFmt_type_is_int_any(format)) {
|
||||
if (itemsize == 1) {
|
||||
return GL_BYTE;
|
||||
}
|
||||
if (itemsize == 2) {
|
||||
return GL_SHORT;
|
||||
}
|
||||
if (itemsize == 4) {
|
||||
return GL_INT;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; /* UNKNOWN */
|
||||
}
|
||||
|
||||
static bool compare_dimensions(int ndim, const int *dim1, const Py_ssize_t *dim2)
|
||||
{
|
||||
for (int i = 0; i < ndim; i++) {
|
||||
if (dim1[i] != dim2[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Buffer API
|
||||
* \{ */
|
||||
|
||||
static PySequenceMethods Buffer_SeqMethods = {
|
||||
/*sq_length*/ (lenfunc)Buffer_len,
|
||||
/*sq_concat*/ nullptr,
|
||||
/*sq_repeat*/ nullptr,
|
||||
/*sq_item*/ (ssizeargfunc)Buffer_item,
|
||||
/*was_sq_slice*/ nullptr, /* DEPRECATED. Handled by #Buffer_item. */
|
||||
/*sq_ass_item*/ (ssizeobjargproc)Buffer_ass_item,
|
||||
/*was_sq_ass_slice*/ nullptr, /* DEPRECATED. Handled by #Buffer_ass_item. */
|
||||
/*sq_contains*/ nullptr,
|
||||
/*sq_inplace_concat*/ nullptr,
|
||||
/*sq_inplace_repeat*/ nullptr,
|
||||
};
|
||||
|
||||
static PyMappingMethods Buffer_AsMapping = {
|
||||
/*mp_length*/ (lenfunc)Buffer_len,
|
||||
/*mp_subscript*/ (binaryfunc)Buffer_subscript,
|
||||
/*mp_ass_subscript*/ (objobjargproc)Buffer_ass_subscript,
|
||||
};
|
||||
|
||||
static void Buffer_dealloc(Buffer *self);
|
||||
static PyObject *Buffer_repr(Buffer *self);
|
||||
|
||||
static PyObject *Buffer_to_list(Buffer *self)
|
||||
{
|
||||
int i, len = self->dimensions[0];
|
||||
PyObject *list = PyList_New(len);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
PyList_SET_ITEM(list, i, Buffer_item(self, i));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static PyObject *Buffer_to_list_recursive(Buffer *self)
|
||||
{
|
||||
PyObject *list;
|
||||
|
||||
if (self->ndimensions > 1) {
|
||||
int i, len = self->dimensions[0];
|
||||
list = PyList_New(len);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
Buffer *sub = (Buffer *)Buffer_item(self, i);
|
||||
PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub));
|
||||
Py_DECREF(sub);
|
||||
}
|
||||
}
|
||||
else {
|
||||
list = Buffer_to_list(self);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static PyObject *Buffer_dimensions(Buffer *self, void * /*arg*/)
|
||||
{
|
||||
PyObject *list = PyList_New(self->ndimensions);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < self->ndimensions; i++) {
|
||||
PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i]));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
# ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wcast-function-type"
|
||||
# else
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static PyMethodDef Buffer_methods[] = {
|
||||
{"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS, "return the buffer as a list"},
|
||||
{nullptr, nullptr, 0, nullptr},
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
# ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
# else
|
||||
# pragma GCC diagnostic pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static PyGetSetDef Buffer_getseters[] = {
|
||||
{"dimensions", (getter)Buffer_dimensions, nullptr, nullptr, nullptr},
|
||||
{nullptr, nullptr, nullptr, nullptr, nullptr},
|
||||
};
|
||||
|
||||
PyTypeObject BGL_bufferType = {
|
||||
/*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
|
||||
/*tp_name*/ "bgl.Buffer",
|
||||
/*tp_basicsize*/ sizeof(Buffer),
|
||||
/*tp_itemsize*/ 0,
|
||||
/*tp_dealloc*/ (destructor)Buffer_dealloc,
|
||||
/*tp_vectorcall_offset*/ 0,
|
||||
/*tp_getattr*/ nullptr,
|
||||
/*tp_setattr*/ nullptr,
|
||||
/*tp_as_async*/ nullptr,
|
||||
/*tp_repr*/ (reprfunc)Buffer_repr,
|
||||
/*tp_as_number*/ nullptr,
|
||||
/*tp_as_sequence*/ &Buffer_SeqMethods,
|
||||
/*tp_as_mapping*/ &Buffer_AsMapping,
|
||||
/*tp_hash*/ nullptr,
|
||||
/*tp_call*/ nullptr,
|
||||
/*tp_str*/ nullptr,
|
||||
/*tp_getattro*/ nullptr,
|
||||
/*tp_setattro*/ nullptr,
|
||||
/*tp_as_buffer*/ nullptr,
|
||||
/*tp_flags*/ Py_TPFLAGS_DEFAULT,
|
||||
/*tp_doc*/ nullptr,
|
||||
/*tp_traverse*/ nullptr,
|
||||
/*tp_clear*/ nullptr,
|
||||
/*tp_richcompare*/ nullptr,
|
||||
/*tp_weaklistoffset*/ 0,
|
||||
/*tp_iter*/ nullptr,
|
||||
/*tp_iternext*/ nullptr,
|
||||
/*tp_methods*/ Buffer_methods,
|
||||
/*tp_members*/ nullptr,
|
||||
/*tp_getset*/ Buffer_getseters,
|
||||
/*tp_base*/ nullptr,
|
||||
/*tp_dict*/ nullptr,
|
||||
/*tp_descr_get*/ nullptr,
|
||||
/*tp_descr_set*/ nullptr,
|
||||
/*tp_dictoffset*/ 0,
|
||||
/*tp_init*/ nullptr,
|
||||
/*tp_alloc*/ nullptr,
|
||||
/*tp_new*/ Buffer_new,
|
||||
/*tp_free*/ nullptr,
|
||||
/*tp_is_gc*/ nullptr,
|
||||
/*tp_bases*/ nullptr,
|
||||
/*tp_mro*/ nullptr,
|
||||
/*tp_cache*/ nullptr,
|
||||
/*tp_subclasses*/ nullptr,
|
||||
/*tp_weaklist*/ nullptr,
|
||||
/*tp_del*/ nullptr,
|
||||
/*tp_version_tag*/ 0,
|
||||
/*tp_finalize*/ nullptr,
|
||||
/*tp_vectorcall*/ nullptr,
|
||||
};
|
||||
|
||||
static Buffer *BGL_MakeBuffer_FromData(
|
||||
PyObject *parent, int type, int ndimensions, const int *dimensions, void *buf)
|
||||
{
|
||||
Buffer *buffer = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
|
||||
|
||||
Py_XINCREF(parent);
|
||||
buffer->parent = parent;
|
||||
buffer->ndimensions = ndimensions;
|
||||
buffer->dimensions = MEM_malloc_arrayN<int>(size_t(ndimensions), "Buffer dimensions");
|
||||
memcpy(buffer->dimensions, dimensions, ndimensions * sizeof(int));
|
||||
buffer->type = type;
|
||||
buffer->buf.asvoid = buf;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
Buffer *BGL_MakeBuffer(int type, int ndimensions, const int *dimensions, const void *initbuffer)
|
||||
{
|
||||
Buffer *buffer;
|
||||
void *buf = nullptr;
|
||||
int i, size = BGL_typeSize(type);
|
||||
|
||||
for (i = 0; i < ndimensions; i++) {
|
||||
size *= dimensions[i];
|
||||
}
|
||||
|
||||
buf = MEM_mallocN(size, __func__);
|
||||
|
||||
buffer = BGL_MakeBuffer_FromData(nullptr, type, ndimensions, dimensions, buf);
|
||||
|
||||
if (initbuffer) {
|
||||
memcpy(buffer->buf.asvoid, initbuffer, size);
|
||||
}
|
||||
else {
|
||||
memset(buffer->buf.asvoid, 0, size);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
/* Custom converter function so we can support a buffer, an integer or nullptr.
|
||||
* Many OpenGL API functions can accept both an actual pointer or an offset
|
||||
* into a buffer that is already bound. */
|
||||
static int BGL_BufferOrOffsetConverter(PyObject *object, BufferOrOffset *buffer)
|
||||
{
|
||||
if (object == Py_None) {
|
||||
buffer->buffer = nullptr;
|
||||
buffer->offset = nullptr;
|
||||
return 1;
|
||||
}
|
||||
if (PyNumber_Check(object)) {
|
||||
const Py_ssize_t offset = PyNumber_AsSsize_t(object, PyExc_IndexError);
|
||||
if (offset == -1 && PyErr_Occurred()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
buffer->buffer = nullptr;
|
||||
buffer->offset = (void *)offset;
|
||||
return 1;
|
||||
}
|
||||
if (PyObject_TypeCheck(object, &BGL_bufferType)) {
|
||||
buffer->buffer = (Buffer *)object;
|
||||
buffer->offset = nullptr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "expected a bgl.Buffer or None");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MAX_DIMENSIONS 256
|
||||
static PyObject *Buffer_new(PyTypeObject * /*type*/, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject *length_ob = nullptr, *init = nullptr;
|
||||
Buffer *buffer = nullptr;
|
||||
int dimensions[MAX_DIMENSIONS];
|
||||
|
||||
int type;
|
||||
Py_ssize_t i, ndimensions = 0;
|
||||
|
||||
if (kwds && PyDict_Size(kwds)) {
|
||||
PyErr_SetString(PyExc_TypeError, "bgl.Buffer(): takes no keyword args");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args, "iO|O: bgl.Buffer", &type, &length_ob, &init)) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!ELEM(type, GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE)) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"invalid first argument type, should be one of "
|
||||
"GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (PyLong_Check(length_ob)) {
|
||||
ndimensions = 1;
|
||||
if ((dimensions[0] = PyLong_AsLong(length_ob)) < 1) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"dimensions must be between 1 and " STRINGIFY(MAX_DIMENSIONS));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else if (PySequence_Check(length_ob)) {
|
||||
ndimensions = PySequence_Size(length_ob);
|
||||
if (ndimensions > MAX_DIMENSIONS) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"too many dimensions, max is " STRINGIFY(MAX_DIMENSIONS));
|
||||
return nullptr;
|
||||
}
|
||||
if (ndimensions < 1) {
|
||||
PyErr_SetString(PyExc_AttributeError, "sequence must have at least one dimension");
|
||||
return nullptr;
|
||||
}
|
||||
for (i = 0; i < ndimensions; i++) {
|
||||
PyObject *ob = PySequence_GetItem(length_ob, i);
|
||||
|
||||
if (!PyLong_Check(ob)) {
|
||||
dimensions[i] = 1;
|
||||
}
|
||||
else {
|
||||
dimensions[i] = PyLong_AsLong(ob);
|
||||
}
|
||||
Py_DECREF(ob);
|
||||
|
||||
if (dimensions[i] < 1) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"dimensions must be between 1 and " STRINGIFY(MAX_DIMENSIONS));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"invalid second argument expected a sequence "
|
||||
"or an int, not a %.200s",
|
||||
Py_TYPE(length_ob)->tp_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (init && PyObject_CheckBuffer(init)) {
|
||||
Py_buffer pybuffer;
|
||||
|
||||
if (PyObject_GetBuffer(init, &pybuffer, PyBUF_ND | PyBUF_FORMAT) == -1) {
|
||||
/* PyObject_GetBuffer raise a PyExc_BufferError */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (type != gl_buffer_type_from_py_buffer(&pybuffer)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"`GL_TYPE` and `typestr` of object with buffer interface do not match. '%s'",
|
||||
pybuffer.format);
|
||||
}
|
||||
else if (ndimensions != pybuffer.ndim ||
|
||||
!compare_dimensions(ndimensions, dimensions, pybuffer.shape))
|
||||
{
|
||||
PyErr_Format(PyExc_TypeError, "array size does not match");
|
||||
}
|
||||
else {
|
||||
buffer = BGL_MakeBuffer_FromData(init, type, pybuffer.ndim, dimensions, pybuffer.buf);
|
||||
}
|
||||
|
||||
PyBuffer_Release(&pybuffer);
|
||||
}
|
||||
else {
|
||||
buffer = BGL_MakeBuffer(type, ndimensions, dimensions, nullptr);
|
||||
if (init && Buffer_ass_slice(buffer, 0, dimensions[0], init)) {
|
||||
Py_DECREF(buffer);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return (PyObject *)buffer;
|
||||
}
|
||||
|
||||
/* Buffer sequence methods */
|
||||
|
||||
static Py_ssize_t Buffer_len(Buffer *self)
|
||||
{
|
||||
return self->dimensions[0];
|
||||
}
|
||||
|
||||
static PyObject *Buffer_item(Buffer *self, Py_ssize_t i)
|
||||
{
|
||||
if (i >= self->dimensions[0] || i < 0) {
|
||||
PyErr_SetString(PyExc_IndexError, "array index out of range");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (self->ndimensions == 1) {
|
||||
switch (self->type) {
|
||||
case GL_BYTE:
|
||||
return Py_BuildValue("b", self->buf.asbyte[i]);
|
||||
case GL_SHORT:
|
||||
return Py_BuildValue("h", self->buf.asshort[i]);
|
||||
case GL_INT:
|
||||
return Py_BuildValue("i", self->buf.asint[i]);
|
||||
case GL_FLOAT:
|
||||
return PyFloat_FromDouble(self->buf.asfloat[i]);
|
||||
case GL_DOUBLE:
|
||||
return Py_BuildValue("d", self->buf.asdouble[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int j, offset = i * BGL_typeSize(self->type);
|
||||
|
||||
for (j = 1; j < self->ndimensions; j++) {
|
||||
offset *= self->dimensions[j];
|
||||
}
|
||||
|
||||
return (PyObject *)BGL_MakeBuffer_FromData((PyObject *)self,
|
||||
self->type,
|
||||
self->ndimensions - 1,
|
||||
self->dimensions + 1,
|
||||
self->buf.asbyte + offset);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end)
|
||||
{
|
||||
PyObject *list;
|
||||
|
||||
begin = std::max<Py_ssize_t>(begin, 0);
|
||||
end = std::min<Py_ssize_t>(end, self->dimensions[0]);
|
||||
begin = std::min(begin, end);
|
||||
|
||||
list = PyList_New(end - begin);
|
||||
|
||||
for (Py_ssize_t count = begin; count < end; count++) {
|
||||
PyList_SET_ITEM(list, count - begin, Buffer_item(self, count));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v)
|
||||
{
|
||||
if (i >= self->dimensions[0] || i < 0) {
|
||||
PyErr_SetString(PyExc_IndexError, "array assignment index out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (self->ndimensions != 1) {
|
||||
Buffer *row = (Buffer *)Buffer_item(self, i);
|
||||
|
||||
if (row) {
|
||||
const int ret = Buffer_ass_slice(row, 0, self->dimensions[1], v);
|
||||
Py_DECREF(row);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (self->type) {
|
||||
case GL_BYTE:
|
||||
return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0 : -1;
|
||||
case GL_SHORT:
|
||||
return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0 : -1;
|
||||
case GL_INT:
|
||||
return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0 : -1;
|
||||
case GL_FLOAT:
|
||||
return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0 : -1;
|
||||
case GL_DOUBLE:
|
||||
return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0 : -1;
|
||||
default:
|
||||
return 0; /* should never happen */
|
||||
}
|
||||
}
|
||||
|
||||
static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq)
|
||||
{
|
||||
PyObject *item;
|
||||
int err = 0;
|
||||
Py_ssize_t count;
|
||||
|
||||
begin = std::max<Py_ssize_t>(begin, 0);
|
||||
end = std::min<Py_ssize_t>(end, self->dimensions[0]);
|
||||
begin = std::min(begin, end);
|
||||
|
||||
if (!PySequence_Check(seq)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"buffer[:] = value, invalid assignment. "
|
||||
"Expected a sequence, not an %.200s type",
|
||||
Py_TYPE(seq)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Re-use count variable. */
|
||||
if ((count = PySequence_Size(seq)) != (end - begin)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"buffer[:] = value, size mismatch in assignment. "
|
||||
"Expected: %d (given: %d)",
|
||||
count,
|
||||
end - begin);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (count = begin; count < end; count++) {
|
||||
item = PySequence_GetItem(seq, count - begin);
|
||||
if (item) {
|
||||
err = Buffer_ass_item(self, count, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
else {
|
||||
err = -1;
|
||||
}
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
|
||||
{
|
||||
if (PyIndex_Check(item)) {
|
||||
Py_ssize_t i;
|
||||
i = PyNumber_AsSsize_t(item, PyExc_IndexError);
|
||||
if (i == -1 && PyErr_Occurred()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (i < 0) {
|
||||
i += self->dimensions[0];
|
||||
}
|
||||
return Buffer_item(self, i);
|
||||
}
|
||||
if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (slicelength <= 0) {
|
||||
return PyTuple_New(0);
|
||||
}
|
||||
if (step == 1) {
|
||||
return Buffer_slice(self, start, stop);
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_IndexError, "slice steps not supported with vectors");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyErr_Format(
|
||||
PyExc_TypeError, "buffer indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
|
||||
{
|
||||
if (PyIndex_Check(item)) {
|
||||
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
|
||||
if (i == -1 && PyErr_Occurred()) {
|
||||
return -1;
|
||||
}
|
||||
if (i < 0) {
|
||||
i += self->dimensions[0];
|
||||
}
|
||||
return Buffer_ass_item(self, i, value);
|
||||
}
|
||||
if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (step == 1) {
|
||||
return Buffer_ass_slice(self, start, stop, value);
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_IndexError, "slice steps not supported with vectors");
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyErr_Format(
|
||||
PyExc_TypeError, "buffer indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void Buffer_dealloc(Buffer *self)
|
||||
{
|
||||
if (self->parent) {
|
||||
Py_DECREF(self->parent);
|
||||
}
|
||||
else {
|
||||
MEM_freeN(self->buf.asvoid);
|
||||
}
|
||||
|
||||
MEM_freeN(self->dimensions);
|
||||
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
|
||||
static PyObject *Buffer_repr(Buffer *self)
|
||||
{
|
||||
PyObject *list = Buffer_to_list_recursive(self);
|
||||
PyObject *repr;
|
||||
const char *typestr;
|
||||
|
||||
switch (self->type) {
|
||||
case GL_BYTE:
|
||||
typestr = "GL_BYTE";
|
||||
break;
|
||||
case GL_SHORT:
|
||||
typestr = "GL_SHORT";
|
||||
break;
|
||||
case GL_INT:
|
||||
typestr = "GL_INT";
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
typestr = "GL_FLOAT";
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
typestr = "GL_DOUBLE";
|
||||
break;
|
||||
default:
|
||||
typestr = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
|
||||
repr = PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
|
||||
Py_DECREF(list);
|
||||
|
||||
return repr;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name OpenGL API Wrapping
|
||||
* \{ */
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
# define BGL_Wrap(funcname, ret, arg_list) \
|
||||
static PyObject *Method_##funcname(PyObject * /*self*/, PyObject *args) \
|
||||
{ \
|
||||
arg_def arg_list; \
|
||||
ret_def_##ret; \
|
||||
report_deprecated_call(#funcname); \
|
||||
if (!PyArg_ParseTuple(args, arg_str arg_list, arg_ref arg_list)) { \
|
||||
return nullptr; \
|
||||
} \
|
||||
const bool has_opengl_backend = GPU_backend_get_type() == GPU_BACKEND_OPENGL; \
|
||||
if (has_opengl_backend) { \
|
||||
GPU_bgl_start(); \
|
||||
ret_set_##ret gl##funcname(arg_var arg_list); \
|
||||
} \
|
||||
else { \
|
||||
report_deprecated_call_to_user(); \
|
||||
ret_set_##ret ret_default_##ret; \
|
||||
} \
|
||||
ret_ret_##ret; \
|
||||
}
|
||||
#else
|
||||
|
||||
static void bgl_no_opengl_error()
|
||||
{
|
||||
PyErr_SetString(PyExc_RuntimeError, "Built without OpenGL support");
|
||||
}
|
||||
|
||||
# define BGL_Wrap(funcname, ret, arg_list) \
|
||||
static PyObject *Method_##funcname(PyObject * /*self*/, PyObject *args) \
|
||||
{ \
|
||||
(void)args; \
|
||||
bgl_no_opengl_error(); \
|
||||
return nullptr; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* GL_VERSION_1_0 */
|
||||
BGL_Wrap(BlendFunc, void, (GLenum, GLenum));
|
||||
BGL_Wrap(Clear, void, (GLbitfield));
|
||||
BGL_Wrap(ClearColor, void, (GLfloat, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(ClearDepth, void, (GLdouble));
|
||||
BGL_Wrap(ClearStencil, void, (GLint));
|
||||
BGL_Wrap(ColorMask, void, (GLboolean, GLboolean, GLboolean, GLboolean));
|
||||
BGL_Wrap(CullFace, void, (GLenum));
|
||||
BGL_Wrap(DepthFunc, void, (GLenum));
|
||||
BGL_Wrap(DepthMask, void, (GLboolean));
|
||||
BGL_Wrap(DepthRange, void, (GLdouble, GLdouble));
|
||||
BGL_Wrap(Disable, void, (GLenum));
|
||||
BGL_Wrap(DrawBuffer, void, (GLenum));
|
||||
BGL_Wrap(Enable, void, (GLenum));
|
||||
BGL_Wrap(Finish, void, (void));
|
||||
BGL_Wrap(Flush, void, (void));
|
||||
BGL_Wrap(FrontFace, void, (GLenum));
|
||||
BGL_Wrap(GetBooleanv, void, (GLenum, GLbooleanP));
|
||||
BGL_Wrap(GetDoublev, void, (GLenum, GLdoubleP));
|
||||
BGL_Wrap(GetError, GLenum, (void));
|
||||
BGL_Wrap(GetFloatv, void, (GLenum, GLfloatP));
|
||||
BGL_Wrap(GetIntegerv, void, (GLenum, GLintP));
|
||||
BGL_Wrap(GetString, GLstring, (GLenum));
|
||||
BGL_Wrap(GetTexImage, void, (GLenum, GLint, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(GetTexLevelParameterfv, void, (GLenum, GLint, GLenum, GLfloatP));
|
||||
BGL_Wrap(GetTexLevelParameteriv, void, (GLenum, GLint, GLenum, GLintP));
|
||||
BGL_Wrap(GetTexParameterfv, void, (GLenum, GLenum, GLfloatP));
|
||||
BGL_Wrap(GetTexParameteriv, void, (GLenum, GLenum, GLintP));
|
||||
BGL_Wrap(Hint, void, (GLenum, GLenum));
|
||||
BGL_Wrap(IsEnabled, GLboolean, (GLenum));
|
||||
BGL_Wrap(LineWidth, void, (GLfloat));
|
||||
BGL_Wrap(LogicOp, void, (GLenum));
|
||||
BGL_Wrap(PixelStoref, void, (GLenum, GLfloat));
|
||||
BGL_Wrap(PixelStorei, void, (GLenum, GLint));
|
||||
BGL_Wrap(PointSize, void, (GLfloat));
|
||||
BGL_Wrap(PolygonMode, void, (GLenum, GLenum));
|
||||
BGL_Wrap(ReadBuffer, void, (GLenum));
|
||||
BGL_Wrap(ReadPixels, void, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(Scissor, void, (GLint, GLint, GLsizei, GLsizei));
|
||||
BGL_Wrap(StencilFunc, void, (GLenum, GLint, GLuint));
|
||||
BGL_Wrap(StencilMask, void, (GLuint));
|
||||
BGL_Wrap(StencilOp, void, (GLenum, GLenum, GLenum));
|
||||
BGL_Wrap(TexImage1D, void, (GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(TexImage2D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(TexParameterf, void, (GLenum, GLenum, GLfloat));
|
||||
BGL_Wrap(TexParameterfv, void, (GLenum, GLenum, GLfloatP));
|
||||
BGL_Wrap(TexParameteri, void, (GLenum, GLenum, GLint));
|
||||
BGL_Wrap(TexParameteriv, void, (GLenum, GLenum, GLintP));
|
||||
BGL_Wrap(Viewport, void, (GLint, GLint, GLsizei, GLsizei));
|
||||
|
||||
/* GL_VERSION_1_1 */
|
||||
BGL_Wrap(BindTexture, void, (GLenum, GLuint));
|
||||
BGL_Wrap(CopyTexImage1D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint));
|
||||
BGL_Wrap(CopyTexImage2D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint));
|
||||
BGL_Wrap(CopyTexSubImage1D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei));
|
||||
BGL_Wrap(CopyTexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei));
|
||||
BGL_Wrap(DeleteTextures, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(DrawArrays, void, (GLenum, GLint, GLsizei));
|
||||
BGL_Wrap(DrawElements, void, (GLenum, GLsizei, GLenum, GLvoidP));
|
||||
BGL_Wrap(GenTextures, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(IsTexture, GLboolean, (GLuint));
|
||||
BGL_Wrap(PolygonOffset, void, (GLfloat, GLfloat));
|
||||
BGL_Wrap(TexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(TexSubImage2D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
|
||||
|
||||
/* GL_VERSION_1_2 */
|
||||
BGL_Wrap(CopyTexSubImage3D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei));
|
||||
BGL_Wrap(DrawRangeElements, void, (GLenum, GLuint, GLuint, GLsizei, GLenum, GLvoidP));
|
||||
BGL_Wrap(TexImage3D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(TexSubImage3D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
|
||||
|
||||
/* GL_VERSION_1_3 */
|
||||
BGL_Wrap(ActiveTexture, void, (GLenum));
|
||||
BGL_Wrap(CompressedTexImage1D, void, (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, GLvoidP));
|
||||
BGL_Wrap(CompressedTexImage2D,
|
||||
void,
|
||||
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLvoidP));
|
||||
BGL_Wrap(CompressedTexImage3D,
|
||||
void,
|
||||
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, GLvoidP));
|
||||
BGL_Wrap(CompressedTexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, GLvoidP));
|
||||
BGL_Wrap(CompressedTexSubImage2D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP));
|
||||
BGL_Wrap(
|
||||
CompressedTexSubImage3D,
|
||||
void,
|
||||
(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP));
|
||||
BGL_Wrap(GetCompressedTexImage, void, (GLenum, GLint, GLvoidP));
|
||||
BGL_Wrap(SampleCoverage, void, (GLfloat, GLboolean));
|
||||
|
||||
/* GL_VERSION_1_4 */
|
||||
BGL_Wrap(BlendColor, void, (GLfloat, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(BlendEquation, void, (GLenum));
|
||||
|
||||
/* GL_VERSION_1_5 */
|
||||
BGL_Wrap(BeginQuery, void, (GLenum, GLuint));
|
||||
BGL_Wrap(BindBuffer, void, (GLenum, GLuint));
|
||||
BGL_Wrap(BufferData, void, (GLenum, GLsizeiptr, GLvoidP, GLenum));
|
||||
BGL_Wrap(BufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP));
|
||||
BGL_Wrap(DeleteBuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(DeleteQueries, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(EndQuery, void, (GLenum));
|
||||
BGL_Wrap(GenBuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(GenQueries, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(GetBufferParameteriv, void, (GLenum, GLenum, GLintP));
|
||||
BGL_Wrap(GetBufferPointerv, void, (GLenum, GLenum, GLvoidP));
|
||||
BGL_Wrap(GetBufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP));
|
||||
BGL_Wrap(GetQueryObjectiv, void, (GLuint, GLenum, GLintP));
|
||||
BGL_Wrap(GetQueryObjectuiv, void, (GLuint, GLenum, GLuintP));
|
||||
BGL_Wrap(GetQueryiv, void, (GLenum, GLenum, GLintP));
|
||||
BGL_Wrap(IsBuffer, GLboolean, (GLuint));
|
||||
BGL_Wrap(IsQuery, GLboolean, (GLuint));
|
||||
BGL_Wrap(MapBuffer, void, (GLenum, GLenum));
|
||||
BGL_Wrap(UnmapBuffer, GLboolean, (GLenum));
|
||||
|
||||
/* GL_VERSION_2_0 */
|
||||
BGL_Wrap(AttachShader, void, (GLuint, GLuint));
|
||||
BGL_Wrap(BindAttribLocation, void, (GLuint, GLuint, GLstring));
|
||||
BGL_Wrap(BlendEquationSeparate, void, (GLenum, GLenum));
|
||||
BGL_Wrap(CompileShader, void, (GLuint));
|
||||
BGL_Wrap(CreateProgram, GLuint, (void));
|
||||
BGL_Wrap(CreateShader, GLuint, (GLenum));
|
||||
BGL_Wrap(DeleteProgram, void, (GLuint));
|
||||
BGL_Wrap(DeleteShader, void, (GLuint));
|
||||
BGL_Wrap(DetachShader, void, (GLuint, GLuint));
|
||||
BGL_Wrap(DisableVertexAttribArray, void, (GLuint));
|
||||
BGL_Wrap(DrawBuffers, void, (GLsizei, GLenumP));
|
||||
BGL_Wrap(EnableVertexAttribArray, void, (GLuint));
|
||||
BGL_Wrap(GetActiveAttrib, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP));
|
||||
BGL_Wrap(GetActiveUniform, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP));
|
||||
BGL_Wrap(GetAttachedShaders, void, (GLuint, GLsizei, GLsizeiP, GLuintP));
|
||||
BGL_Wrap(GetAttribLocation, GLint, (GLuint, GLstring));
|
||||
BGL_Wrap(GetProgramInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
|
||||
BGL_Wrap(GetProgramiv, void, (GLuint, GLenum, GLintP));
|
||||
BGL_Wrap(GetShaderInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
|
||||
BGL_Wrap(GetShaderSource, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
|
||||
BGL_Wrap(GetShaderiv, void, (GLuint, GLenum, GLintP));
|
||||
BGL_Wrap(GetUniformLocation, GLint, (GLuint, GLstring));
|
||||
BGL_Wrap(GetUniformfv, void, (GLuint, GLint, GLfloatP));
|
||||
BGL_Wrap(GetUniformiv, void, (GLuint, GLint, GLintP));
|
||||
BGL_Wrap(GetVertexAttribPointerv, void, (GLuint, GLenum, GLvoidP));
|
||||
BGL_Wrap(GetVertexAttribdv, void, (GLuint, GLenum, GLdoubleP));
|
||||
BGL_Wrap(GetVertexAttribfv, void, (GLuint, GLenum, GLfloatP));
|
||||
BGL_Wrap(GetVertexAttribiv, void, (GLuint, GLenum, GLintP));
|
||||
BGL_Wrap(IsProgram, GLboolean, (GLuint));
|
||||
BGL_Wrap(IsShader, GLboolean, (GLuint));
|
||||
BGL_Wrap(LinkProgram, void, (GLuint));
|
||||
BGL_Wrap(StencilFuncSeparate, void, (GLenum, GLenum, GLint, GLuint));
|
||||
BGL_Wrap(StencilMaskSeparate, void, (GLenum, GLuint));
|
||||
BGL_Wrap(StencilOpSeparate, void, (GLenum, GLenum, GLenum, GLenum));
|
||||
BGL_Wrap(Uniform1f, void, (GLint, GLfloat));
|
||||
BGL_Wrap(Uniform1fv, void, (GLint, GLsizei, GLfloatP));
|
||||
BGL_Wrap(Uniform1i, void, (GLint, GLint));
|
||||
BGL_Wrap(Uniform1iv, void, (GLint, GLsizei, GLintP));
|
||||
BGL_Wrap(Uniform2f, void, (GLint, GLfloat, GLfloat));
|
||||
BGL_Wrap(Uniform2fv, void, (GLint, GLsizei, GLfloatP));
|
||||
BGL_Wrap(Uniform2i, void, (GLint, GLint, GLint));
|
||||
BGL_Wrap(Uniform2iv, void, (GLint, GLsizei, GLintP));
|
||||
BGL_Wrap(Uniform3f, void, (GLint, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(Uniform3fv, void, (GLint, GLsizei, GLfloatP));
|
||||
BGL_Wrap(Uniform3i, void, (GLint, GLint, GLint, GLint));
|
||||
BGL_Wrap(Uniform3iv, void, (GLint, GLsizei, GLintP));
|
||||
BGL_Wrap(Uniform4f, void, (GLint, GLfloat, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(Uniform4fv, void, (GLint, GLsizei, GLfloatP));
|
||||
BGL_Wrap(Uniform4i, void, (GLint, GLint, GLint, GLint, GLint));
|
||||
BGL_Wrap(Uniform4iv, void, (GLint, GLsizei, GLintP));
|
||||
BGL_Wrap(UniformMatrix2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UseProgram, void, (GLuint));
|
||||
BGL_Wrap(ValidateProgram, void, (GLuint));
|
||||
BGL_Wrap(VertexAttrib1d, void, (GLuint, GLdouble));
|
||||
BGL_Wrap(VertexAttrib1dv, void, (GLuint, GLdoubleP));
|
||||
BGL_Wrap(VertexAttrib1f, void, (GLuint, GLfloat));
|
||||
BGL_Wrap(VertexAttrib1fv, void, (GLuint, GLfloatP));
|
||||
BGL_Wrap(VertexAttrib1s, void, (GLuint, GLshort));
|
||||
BGL_Wrap(VertexAttrib1sv, void, (GLuint, GLshortP));
|
||||
BGL_Wrap(VertexAttrib2d, void, (GLuint, GLdouble, GLdouble));
|
||||
BGL_Wrap(VertexAttrib2dv, void, (GLuint, GLdoubleP));
|
||||
BGL_Wrap(VertexAttrib2f, void, (GLuint, GLfloat, GLfloat));
|
||||
BGL_Wrap(VertexAttrib2fv, void, (GLuint, GLfloatP));
|
||||
BGL_Wrap(VertexAttrib2s, void, (GLuint, GLshort, GLshort));
|
||||
BGL_Wrap(VertexAttrib2sv, void, (GLuint, GLshortP));
|
||||
BGL_Wrap(VertexAttrib3d, void, (GLuint, GLdouble, GLdouble, GLdouble));
|
||||
BGL_Wrap(VertexAttrib3dv, void, (GLuint, GLdoubleP));
|
||||
BGL_Wrap(VertexAttrib3f, void, (GLuint, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(VertexAttrib3fv, void, (GLuint, GLfloatP));
|
||||
BGL_Wrap(VertexAttrib3s, void, (GLuint, GLshort, GLshort, GLshort));
|
||||
BGL_Wrap(VertexAttrib3sv, void, (GLuint, GLshortP));
|
||||
BGL_Wrap(VertexAttrib4Nbv, void, (GLuint, GLbyteP));
|
||||
BGL_Wrap(VertexAttrib4Niv, void, (GLuint, GLintP));
|
||||
BGL_Wrap(VertexAttrib4Nsv, void, (GLuint, GLshortP));
|
||||
BGL_Wrap(VertexAttrib4Nub, void, (GLuint, GLubyte, GLubyte, GLubyte, GLubyte));
|
||||
BGL_Wrap(VertexAttrib4Nubv, void, (GLuint, GLubyteP));
|
||||
BGL_Wrap(VertexAttrib4Nuiv, void, (GLuint, GLuintP));
|
||||
BGL_Wrap(VertexAttrib4Nusv, void, (GLuint, GLushortP));
|
||||
BGL_Wrap(VertexAttrib4bv, void, (GLuint, GLbyteP));
|
||||
BGL_Wrap(VertexAttrib4d, void, (GLuint, GLdouble, GLdouble, GLdouble, GLdouble));
|
||||
BGL_Wrap(VertexAttrib4dv, void, (GLuint, GLdoubleP));
|
||||
BGL_Wrap(VertexAttrib4f, void, (GLuint, GLfloat, GLfloat, GLfloat, GLfloat));
|
||||
BGL_Wrap(VertexAttrib4fv, void, (GLuint, GLfloatP));
|
||||
BGL_Wrap(VertexAttrib4iv, void, (GLuint, GLintP));
|
||||
BGL_Wrap(VertexAttrib4s, void, (GLuint, GLshort, GLshort, GLshort, GLshort));
|
||||
BGL_Wrap(VertexAttrib4sv, void, (GLuint, GLshortP));
|
||||
BGL_Wrap(VertexAttrib4ubv, void, (GLuint, GLubyteP));
|
||||
BGL_Wrap(VertexAttrib4uiv, void, (GLuint, GLuintP));
|
||||
BGL_Wrap(VertexAttrib4usv, void, (GLuint, GLushortP));
|
||||
BGL_Wrap(VertexAttribPointer, void, (GLuint, GLint, GLenum, GLboolean, GLsizei, GLvoidP));
|
||||
|
||||
/* GL_VERSION_2_1 */
|
||||
BGL_Wrap(UniformMatrix2x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix2x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix3x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix3x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix4x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
BGL_Wrap(UniformMatrix4x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
|
||||
|
||||
/* GL_VERSION_3_0 */
|
||||
BGL_Wrap(BindFramebuffer, void, (GLenum, GLuint));
|
||||
BGL_Wrap(BindRenderbuffer, void, (GLenum, GLuint));
|
||||
BGL_Wrap(BindVertexArray, void, (GLuint));
|
||||
BGL_Wrap(BlitFramebuffer,
|
||||
void,
|
||||
(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum));
|
||||
BGL_Wrap(CheckFramebufferStatus, GLenum, (GLenum));
|
||||
BGL_Wrap(DeleteFramebuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(DeleteRenderbuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(DeleteVertexArrays, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(FramebufferRenderbuffer, void, (GLenum, GLenum, GLenum, GLuint));
|
||||
BGL_Wrap(GenFramebuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(GenRenderbuffers, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(GenVertexArrays, void, (GLsizei, GLuintP));
|
||||
BGL_Wrap(GetStringi, GLstring, (GLenum, GLuint));
|
||||
BGL_Wrap(IsVertexArray, GLboolean, (GLuint));
|
||||
BGL_Wrap(RenderbufferStorage, void, (GLenum, GLenum, GLsizei, GLsizei));
|
||||
BGL_Wrap(VertexAttribIPointer, void, (GLuint, GLint, GLenum, GLsizei, GLvoidP));
|
||||
|
||||
/* GL_VERSION_3_1 */
|
||||
BGL_Wrap(BindBufferBase, void, (GLenum, GLuint, GLuint));
|
||||
BGL_Wrap(BindBufferRange, void, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr));
|
||||
BGL_Wrap(GetActiveUniformBlockName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP));
|
||||
BGL_Wrap(GetActiveUniformBlockiv, void, (GLuint, GLuint, GLenum, GLintP));
|
||||
BGL_Wrap(GetActiveUniformName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP));
|
||||
BGL_Wrap(GetActiveUniformsiv, void, (GLuint, GLsizei, GLuintP, GLenum, GLintP));
|
||||
BGL_Wrap(GetIntegeri_v, void, (GLenum, GLuint, GLintP));
|
||||
BGL_Wrap(GetUniformBlockIndex, GLuint, (GLuint, GLstring));
|
||||
BGL_Wrap(GetUniformIndices, void, (GLuint, GLsizei, GLcharP, GLuintP));
|
||||
BGL_Wrap(UniformBlockBinding, void, (GLuint, GLuint, GLuint));
|
||||
|
||||
/* GL_VERSION_3_2 */
|
||||
BGL_Wrap(FramebufferTexture, void, (GLenum, GLenum, GLuint, GLint));
|
||||
BGL_Wrap(GetBufferParameteri64v, void, (GLenum, GLenum, GLint64P));
|
||||
BGL_Wrap(GetInteger64i_v, void, (GLenum, GLuint, GLint64P));
|
||||
BGL_Wrap(GetMultisamplefv, void, (GLenum, GLuint, GLfloatP));
|
||||
BGL_Wrap(SampleMaski, void, (GLuint, GLbitfield));
|
||||
BGL_Wrap(TexImage2DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean));
|
||||
BGL_Wrap(TexImage3DMultisample,
|
||||
void,
|
||||
(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean));
|
||||
|
||||
/* GL_VERSION_3_3 */
|
||||
/* no new functions besides packed immediate mode (not part of core profile) */
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Module Definition
|
||||
* \{ */
|
||||
|
||||
static PyModuleDef BGL_module_def = {
|
||||
/*m_base*/ PyModuleDef_HEAD_INIT,
|
||||
/*m_name*/ "bgl",
|
||||
/*m_doc*/ nullptr,
|
||||
/*m_size*/ 0,
|
||||
/*m_methods*/ nullptr,
|
||||
/*m_slots*/ nullptr,
|
||||
/*m_traverse*/ nullptr,
|
||||
/*m_clear*/ nullptr,
|
||||
/*m_free*/ nullptr,
|
||||
};
|
||||
|
||||
static void py_module_dict_add_int(PyObject *dict, const char *name, int value)
|
||||
{
|
||||
PyObject *item;
|
||||
PyDict_SetItemString(dict, name, item = PyLong_FromLong(value));
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
static void py_module_dict_add_int64(PyObject *dict, const char *name, int64_t value)
|
||||
{
|
||||
PyObject *item;
|
||||
PyDict_SetItemString(dict, name, item = PyLong_FromLongLong(value));
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
static void py_module_dict_add_method(PyObject *submodule,
|
||||
PyObject *dict,
|
||||
PyMethodDef *method_def,
|
||||
bool is_valid)
|
||||
{
|
||||
if (is_valid) {
|
||||
PyObject *m;
|
||||
m = PyCFunction_NewEx(method_def, nullptr, submodule);
|
||||
PyDict_SetItemString(dict, method_def->ml_name, m);
|
||||
Py_DECREF(m);
|
||||
}
|
||||
else {
|
||||
PyDict_SetItemString(dict, method_def->ml_name, Py_None);
|
||||
}
|
||||
}
|
||||
|
||||
/* needed since some function pointers won't be nullptr */
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Waddress"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
# define PY_MOD_ADD_METHOD(func) \
|
||||
{ \
|
||||
static PyMethodDef method_def = {"gl" #func, Method_##func, METH_VARARGS}; \
|
||||
py_module_dict_add_method(submodule, dict, &method_def, (gl##func != nullptr)); \
|
||||
} \
|
||||
((void)0)
|
||||
#else
|
||||
# define PY_MOD_ADD_METHOD(func) \
|
||||
{ \
|
||||
static PyMethodDef method_def = {"gl" #func, Method_##func, METH_VARARGS}; \
|
||||
py_module_dict_add_method(submodule, dict, &method_def, false); \
|
||||
} \
|
||||
((void)0)
|
||||
#endif
|
||||
|
||||
static void init_bgl_version_1_0_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_0 */
|
||||
PY_MOD_ADD_METHOD(BlendFunc);
|
||||
PY_MOD_ADD_METHOD(Clear);
|
||||
PY_MOD_ADD_METHOD(ClearColor);
|
||||
PY_MOD_ADD_METHOD(ClearDepth);
|
||||
PY_MOD_ADD_METHOD(ClearStencil);
|
||||
PY_MOD_ADD_METHOD(ColorMask);
|
||||
PY_MOD_ADD_METHOD(CullFace);
|
||||
PY_MOD_ADD_METHOD(DepthFunc);
|
||||
PY_MOD_ADD_METHOD(DepthMask);
|
||||
PY_MOD_ADD_METHOD(DepthRange);
|
||||
PY_MOD_ADD_METHOD(Disable);
|
||||
PY_MOD_ADD_METHOD(DrawBuffer);
|
||||
PY_MOD_ADD_METHOD(Enable);
|
||||
PY_MOD_ADD_METHOD(Finish);
|
||||
PY_MOD_ADD_METHOD(Flush);
|
||||
PY_MOD_ADD_METHOD(FrontFace);
|
||||
PY_MOD_ADD_METHOD(GetBooleanv);
|
||||
PY_MOD_ADD_METHOD(GetDoublev);
|
||||
PY_MOD_ADD_METHOD(GetError);
|
||||
PY_MOD_ADD_METHOD(GetFloatv);
|
||||
PY_MOD_ADD_METHOD(GetIntegerv);
|
||||
PY_MOD_ADD_METHOD(GetString);
|
||||
PY_MOD_ADD_METHOD(GetTexImage);
|
||||
PY_MOD_ADD_METHOD(GetTexLevelParameterfv);
|
||||
PY_MOD_ADD_METHOD(GetTexLevelParameteriv);
|
||||
PY_MOD_ADD_METHOD(GetTexParameterfv);
|
||||
PY_MOD_ADD_METHOD(GetTexParameteriv);
|
||||
PY_MOD_ADD_METHOD(Hint);
|
||||
PY_MOD_ADD_METHOD(IsEnabled);
|
||||
PY_MOD_ADD_METHOD(LineWidth);
|
||||
PY_MOD_ADD_METHOD(LogicOp);
|
||||
PY_MOD_ADD_METHOD(PixelStoref);
|
||||
PY_MOD_ADD_METHOD(PixelStorei);
|
||||
PY_MOD_ADD_METHOD(PointSize);
|
||||
PY_MOD_ADD_METHOD(PolygonMode);
|
||||
PY_MOD_ADD_METHOD(ReadBuffer);
|
||||
PY_MOD_ADD_METHOD(ReadPixels);
|
||||
PY_MOD_ADD_METHOD(Scissor);
|
||||
PY_MOD_ADD_METHOD(StencilFunc);
|
||||
PY_MOD_ADD_METHOD(StencilMask);
|
||||
PY_MOD_ADD_METHOD(StencilOp);
|
||||
PY_MOD_ADD_METHOD(TexImage1D);
|
||||
PY_MOD_ADD_METHOD(TexImage2D);
|
||||
PY_MOD_ADD_METHOD(TexParameterf);
|
||||
PY_MOD_ADD_METHOD(TexParameterfv);
|
||||
PY_MOD_ADD_METHOD(TexParameteri);
|
||||
PY_MOD_ADD_METHOD(TexParameteriv);
|
||||
PY_MOD_ADD_METHOD(Viewport);
|
||||
}
|
||||
static void init_bgl_version_1_1_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_1 */
|
||||
PY_MOD_ADD_METHOD(BindTexture);
|
||||
PY_MOD_ADD_METHOD(CopyTexImage1D);
|
||||
PY_MOD_ADD_METHOD(CopyTexImage2D);
|
||||
PY_MOD_ADD_METHOD(CopyTexSubImage1D);
|
||||
PY_MOD_ADD_METHOD(CopyTexSubImage2D);
|
||||
PY_MOD_ADD_METHOD(DeleteTextures);
|
||||
PY_MOD_ADD_METHOD(DrawArrays);
|
||||
PY_MOD_ADD_METHOD(DrawElements);
|
||||
PY_MOD_ADD_METHOD(GenTextures);
|
||||
PY_MOD_ADD_METHOD(IsTexture);
|
||||
PY_MOD_ADD_METHOD(PolygonOffset);
|
||||
PY_MOD_ADD_METHOD(TexSubImage1D);
|
||||
PY_MOD_ADD_METHOD(TexSubImage2D);
|
||||
}
|
||||
static void init_bgl_version_1_2_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_2 */
|
||||
PY_MOD_ADD_METHOD(CopyTexSubImage3D);
|
||||
PY_MOD_ADD_METHOD(DrawRangeElements);
|
||||
PY_MOD_ADD_METHOD(TexImage3D);
|
||||
PY_MOD_ADD_METHOD(TexSubImage3D);
|
||||
}
|
||||
static void init_bgl_version_1_3_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_3 */
|
||||
PY_MOD_ADD_METHOD(ActiveTexture);
|
||||
PY_MOD_ADD_METHOD(CompressedTexImage1D);
|
||||
PY_MOD_ADD_METHOD(CompressedTexImage2D);
|
||||
PY_MOD_ADD_METHOD(CompressedTexImage3D);
|
||||
PY_MOD_ADD_METHOD(CompressedTexSubImage1D);
|
||||
PY_MOD_ADD_METHOD(CompressedTexSubImage2D);
|
||||
PY_MOD_ADD_METHOD(CompressedTexSubImage3D);
|
||||
PY_MOD_ADD_METHOD(GetCompressedTexImage);
|
||||
PY_MOD_ADD_METHOD(SampleCoverage);
|
||||
}
|
||||
static void init_bgl_version_1_4_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_4 */
|
||||
PY_MOD_ADD_METHOD(BlendColor);
|
||||
PY_MOD_ADD_METHOD(BlendEquation);
|
||||
}
|
||||
static void init_bgl_version_1_5_methods(PyObject *submodule, PyObject *dict)
|
||||
/* GL_VERSION_1_5 */
|
||||
{
|
||||
PY_MOD_ADD_METHOD(BeginQuery);
|
||||
PY_MOD_ADD_METHOD(BindBuffer);
|
||||
PY_MOD_ADD_METHOD(BufferData);
|
||||
PY_MOD_ADD_METHOD(BufferSubData);
|
||||
PY_MOD_ADD_METHOD(DeleteBuffers);
|
||||
PY_MOD_ADD_METHOD(DeleteQueries);
|
||||
PY_MOD_ADD_METHOD(EndQuery);
|
||||
PY_MOD_ADD_METHOD(GenBuffers);
|
||||
PY_MOD_ADD_METHOD(GenQueries);
|
||||
PY_MOD_ADD_METHOD(GetBufferParameteriv);
|
||||
PY_MOD_ADD_METHOD(GetBufferPointerv);
|
||||
PY_MOD_ADD_METHOD(GetBufferSubData);
|
||||
PY_MOD_ADD_METHOD(GetQueryObjectiv);
|
||||
PY_MOD_ADD_METHOD(GetQueryObjectuiv);
|
||||
PY_MOD_ADD_METHOD(GetQueryiv);
|
||||
PY_MOD_ADD_METHOD(IsBuffer);
|
||||
PY_MOD_ADD_METHOD(IsQuery);
|
||||
PY_MOD_ADD_METHOD(MapBuffer);
|
||||
PY_MOD_ADD_METHOD(UnmapBuffer);
|
||||
}
|
||||
static void init_bgl_version_2_0_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_2_0 */
|
||||
PY_MOD_ADD_METHOD(AttachShader);
|
||||
PY_MOD_ADD_METHOD(BindAttribLocation);
|
||||
PY_MOD_ADD_METHOD(BlendEquationSeparate);
|
||||
PY_MOD_ADD_METHOD(CompileShader);
|
||||
PY_MOD_ADD_METHOD(CreateProgram);
|
||||
PY_MOD_ADD_METHOD(CreateShader);
|
||||
PY_MOD_ADD_METHOD(DeleteProgram);
|
||||
PY_MOD_ADD_METHOD(DeleteShader);
|
||||
PY_MOD_ADD_METHOD(DetachShader);
|
||||
PY_MOD_ADD_METHOD(DisableVertexAttribArray);
|
||||
PY_MOD_ADD_METHOD(DrawBuffers);
|
||||
PY_MOD_ADD_METHOD(EnableVertexAttribArray);
|
||||
PY_MOD_ADD_METHOD(GetActiveAttrib);
|
||||
PY_MOD_ADD_METHOD(GetActiveUniform);
|
||||
PY_MOD_ADD_METHOD(GetAttachedShaders);
|
||||
PY_MOD_ADD_METHOD(GetAttribLocation);
|
||||
PY_MOD_ADD_METHOD(GetProgramInfoLog);
|
||||
PY_MOD_ADD_METHOD(GetProgramiv);
|
||||
PY_MOD_ADD_METHOD(GetShaderInfoLog);
|
||||
PY_MOD_ADD_METHOD(GetShaderSource);
|
||||
PY_MOD_ADD_METHOD(GetShaderiv);
|
||||
PY_MOD_ADD_METHOD(GetUniformLocation);
|
||||
PY_MOD_ADD_METHOD(GetUniformfv);
|
||||
PY_MOD_ADD_METHOD(GetUniformiv);
|
||||
PY_MOD_ADD_METHOD(GetVertexAttribPointerv);
|
||||
PY_MOD_ADD_METHOD(GetVertexAttribdv);
|
||||
PY_MOD_ADD_METHOD(GetVertexAttribfv);
|
||||
PY_MOD_ADD_METHOD(GetVertexAttribiv);
|
||||
PY_MOD_ADD_METHOD(IsProgram);
|
||||
PY_MOD_ADD_METHOD(IsShader);
|
||||
PY_MOD_ADD_METHOD(LinkProgram);
|
||||
PY_MOD_ADD_METHOD(ShaderSource);
|
||||
PY_MOD_ADD_METHOD(StencilFuncSeparate);
|
||||
PY_MOD_ADD_METHOD(StencilMaskSeparate);
|
||||
PY_MOD_ADD_METHOD(StencilOpSeparate);
|
||||
PY_MOD_ADD_METHOD(Uniform1f);
|
||||
PY_MOD_ADD_METHOD(Uniform1fv);
|
||||
PY_MOD_ADD_METHOD(Uniform1i);
|
||||
PY_MOD_ADD_METHOD(Uniform1iv);
|
||||
PY_MOD_ADD_METHOD(Uniform2f);
|
||||
PY_MOD_ADD_METHOD(Uniform2fv);
|
||||
PY_MOD_ADD_METHOD(Uniform2i);
|
||||
PY_MOD_ADD_METHOD(Uniform2iv);
|
||||
PY_MOD_ADD_METHOD(Uniform3f);
|
||||
PY_MOD_ADD_METHOD(Uniform3fv);
|
||||
PY_MOD_ADD_METHOD(Uniform3i);
|
||||
PY_MOD_ADD_METHOD(Uniform3iv);
|
||||
PY_MOD_ADD_METHOD(Uniform4f);
|
||||
PY_MOD_ADD_METHOD(Uniform4fv);
|
||||
PY_MOD_ADD_METHOD(Uniform4i);
|
||||
PY_MOD_ADD_METHOD(Uniform4iv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix2fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix3fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix4fv);
|
||||
PY_MOD_ADD_METHOD(UseProgram);
|
||||
PY_MOD_ADD_METHOD(ValidateProgram);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1d);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1dv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1f);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1fv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1s);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib1sv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2d);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2dv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2f);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2fv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2s);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib2sv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3d);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3dv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3f);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3fv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3s);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib3sv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nbv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Niv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nsv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nub);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nubv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nuiv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4Nusv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4bv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4d);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4dv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4f);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4fv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4iv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4s);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4sv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4ubv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4uiv);
|
||||
PY_MOD_ADD_METHOD(VertexAttrib4usv);
|
||||
PY_MOD_ADD_METHOD(VertexAttribPointer);
|
||||
}
|
||||
static void init_bgl_version_2_1_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_2_1 */
|
||||
PY_MOD_ADD_METHOD(UniformMatrix2x3fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix2x4fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix3x2fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix3x4fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix4x2fv);
|
||||
PY_MOD_ADD_METHOD(UniformMatrix4x3fv);
|
||||
}
|
||||
static void init_bgl_version_3_0_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_0 */
|
||||
PY_MOD_ADD_METHOD(BindFramebuffer);
|
||||
PY_MOD_ADD_METHOD(BindRenderbuffer);
|
||||
PY_MOD_ADD_METHOD(BindVertexArray);
|
||||
PY_MOD_ADD_METHOD(BlitFramebuffer);
|
||||
PY_MOD_ADD_METHOD(CheckFramebufferStatus);
|
||||
PY_MOD_ADD_METHOD(DeleteFramebuffers);
|
||||
PY_MOD_ADD_METHOD(DeleteRenderbuffers);
|
||||
PY_MOD_ADD_METHOD(DeleteVertexArrays);
|
||||
PY_MOD_ADD_METHOD(FramebufferRenderbuffer);
|
||||
PY_MOD_ADD_METHOD(GenFramebuffers);
|
||||
PY_MOD_ADD_METHOD(GenRenderbuffers);
|
||||
PY_MOD_ADD_METHOD(GenVertexArrays);
|
||||
PY_MOD_ADD_METHOD(GetStringi);
|
||||
PY_MOD_ADD_METHOD(IsVertexArray);
|
||||
PY_MOD_ADD_METHOD(RenderbufferStorage);
|
||||
PY_MOD_ADD_METHOD(VertexAttribIPointer);
|
||||
}
|
||||
static void init_bgl_version_3_1_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_1 */
|
||||
PY_MOD_ADD_METHOD(BindBufferBase);
|
||||
PY_MOD_ADD_METHOD(BindBufferRange);
|
||||
PY_MOD_ADD_METHOD(GetActiveUniformBlockName);
|
||||
PY_MOD_ADD_METHOD(GetActiveUniformBlockiv);
|
||||
PY_MOD_ADD_METHOD(GetActiveUniformName);
|
||||
PY_MOD_ADD_METHOD(GetActiveUniformsiv);
|
||||
PY_MOD_ADD_METHOD(GetIntegeri_v);
|
||||
PY_MOD_ADD_METHOD(GetUniformBlockIndex);
|
||||
PY_MOD_ADD_METHOD(GetUniformIndices);
|
||||
PY_MOD_ADD_METHOD(UniformBlockBinding);
|
||||
}
|
||||
static void init_bgl_version_3_2_methods(PyObject *submodule, PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_2 */
|
||||
PY_MOD_ADD_METHOD(FramebufferTexture);
|
||||
PY_MOD_ADD_METHOD(GetBufferParameteri64v);
|
||||
PY_MOD_ADD_METHOD(GetInteger64i_v);
|
||||
PY_MOD_ADD_METHOD(GetMultisamplefv);
|
||||
PY_MOD_ADD_METHOD(SampleMaski);
|
||||
PY_MOD_ADD_METHOD(TexImage2DMultisample);
|
||||
PY_MOD_ADD_METHOD(TexImage3DMultisample);
|
||||
}
|
||||
static void init_bgl_version_3_3_methods(PyObject * /*submodule*/, PyObject * /*dict*/)
|
||||
{
|
||||
/* GL_VERSION_3_3 */
|
||||
}
|
||||
|
||||
#define PY_DICT_ADD_INT(x) py_module_dict_add_int(dict, #x, x)
|
||||
#define PY_DICT_ADD_INT64(x) py_module_dict_add_int64(dict, #x, x)
|
||||
|
||||
static void init_bgl_version_1_1_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_1 */
|
||||
PY_DICT_ADD_INT(GL_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_ALWAYS);
|
||||
PY_DICT_ADD_INT(GL_AND);
|
||||
PY_DICT_ADD_INT(GL_AND_INVERTED);
|
||||
PY_DICT_ADD_INT(GL_AND_REVERSE);
|
||||
PY_DICT_ADD_INT(GL_BACK);
|
||||
PY_DICT_ADD_INT(GL_BACK_LEFT);
|
||||
PY_DICT_ADD_INT(GL_BACK_RIGHT);
|
||||
PY_DICT_ADD_INT(GL_BLEND);
|
||||
PY_DICT_ADD_INT(GL_BLEND_DST);
|
||||
PY_DICT_ADD_INT(GL_BLEND_SRC);
|
||||
PY_DICT_ADD_INT(GL_BLUE);
|
||||
PY_DICT_ADD_INT(GL_BYTE);
|
||||
PY_DICT_ADD_INT(GL_CCW);
|
||||
PY_DICT_ADD_INT(GL_CLEAR);
|
||||
PY_DICT_ADD_INT(GL_COLOR);
|
||||
PY_DICT_ADD_INT(GL_COLOR_BUFFER_BIT);
|
||||
PY_DICT_ADD_INT(GL_COLOR_CLEAR_VALUE);
|
||||
PY_DICT_ADD_INT(GL_COLOR_LOGIC_OP);
|
||||
PY_DICT_ADD_INT(GL_COLOR_WRITEMASK);
|
||||
PY_DICT_ADD_INT(GL_COPY);
|
||||
PY_DICT_ADD_INT(GL_COPY_INVERTED);
|
||||
PY_DICT_ADD_INT(GL_CULL_FACE);
|
||||
PY_DICT_ADD_INT(GL_CULL_FACE_MODE);
|
||||
PY_DICT_ADD_INT(GL_CW);
|
||||
PY_DICT_ADD_INT(GL_DECR);
|
||||
PY_DICT_ADD_INT(GL_DEPTH);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_BUFFER_BIT);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_CLEAR_VALUE);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_COMPONENT);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_FUNC);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_RANGE);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_TEST);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_WRITEMASK);
|
||||
PY_DICT_ADD_INT(GL_DITHER);
|
||||
PY_DICT_ADD_INT(GL_DONT_CARE);
|
||||
PY_DICT_ADD_INT(GL_DOUBLE);
|
||||
PY_DICT_ADD_INT(GL_DOUBLEBUFFER);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_DST_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_DST_COLOR);
|
||||
PY_DICT_ADD_INT(GL_EQUAL);
|
||||
PY_DICT_ADD_INT(GL_EQUIV);
|
||||
PY_DICT_ADD_INT(GL_EXTENSIONS);
|
||||
PY_DICT_ADD_INT(GL_FALSE);
|
||||
PY_DICT_ADD_INT(GL_FASTEST);
|
||||
PY_DICT_ADD_INT(GL_FILL);
|
||||
PY_DICT_ADD_INT(GL_FLOAT);
|
||||
PY_DICT_ADD_INT(GL_FRONT);
|
||||
PY_DICT_ADD_INT(GL_FRONT_AND_BACK);
|
||||
PY_DICT_ADD_INT(GL_FRONT_FACE);
|
||||
PY_DICT_ADD_INT(GL_FRONT_LEFT);
|
||||
PY_DICT_ADD_INT(GL_FRONT_RIGHT);
|
||||
PY_DICT_ADD_INT(GL_GEQUAL);
|
||||
PY_DICT_ADD_INT(GL_GREATER);
|
||||
PY_DICT_ADD_INT(GL_GREEN);
|
||||
PY_DICT_ADD_INT(GL_INCR);
|
||||
PY_DICT_ADD_INT(GL_INT);
|
||||
PY_DICT_ADD_INT(GL_INVALID_ENUM);
|
||||
PY_DICT_ADD_INT(GL_INVALID_OPERATION);
|
||||
PY_DICT_ADD_INT(GL_INVALID_VALUE);
|
||||
PY_DICT_ADD_INT(GL_INVERT);
|
||||
PY_DICT_ADD_INT(GL_KEEP);
|
||||
PY_DICT_ADD_INT(GL_LEFT);
|
||||
PY_DICT_ADD_INT(GL_LEQUAL);
|
||||
PY_DICT_ADD_INT(GL_LESS);
|
||||
PY_DICT_ADD_INT(GL_LINE);
|
||||
PY_DICT_ADD_INT(GL_LINEAR);
|
||||
PY_DICT_ADD_INT(GL_LINEAR_MIPMAP_LINEAR);
|
||||
PY_DICT_ADD_INT(GL_LINEAR_MIPMAP_NEAREST);
|
||||
PY_DICT_ADD_INT(GL_LINES);
|
||||
PY_DICT_ADD_INT(GL_LINE_LOOP);
|
||||
PY_DICT_ADD_INT(GL_LINE_SMOOTH);
|
||||
PY_DICT_ADD_INT(GL_LINE_SMOOTH_HINT);
|
||||
PY_DICT_ADD_INT(GL_LINE_STRIP);
|
||||
PY_DICT_ADD_INT(GL_LINE_WIDTH);
|
||||
PY_DICT_ADD_INT(GL_LINE_WIDTH_GRANULARITY);
|
||||
PY_DICT_ADD_INT(GL_LINE_WIDTH_RANGE);
|
||||
PY_DICT_ADD_INT(GL_LOGIC_OP_MODE);
|
||||
PY_DICT_ADD_INT(GL_MAX_TEXTURE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_VIEWPORT_DIMS);
|
||||
PY_DICT_ADD_INT(GL_NAND);
|
||||
PY_DICT_ADD_INT(GL_NEAREST);
|
||||
PY_DICT_ADD_INT(GL_NEAREST_MIPMAP_LINEAR);
|
||||
PY_DICT_ADD_INT(GL_NEAREST_MIPMAP_NEAREST);
|
||||
PY_DICT_ADD_INT(GL_NEVER);
|
||||
PY_DICT_ADD_INT(GL_NICEST);
|
||||
PY_DICT_ADD_INT(GL_NONE);
|
||||
PY_DICT_ADD_INT(GL_NOOP);
|
||||
PY_DICT_ADD_INT(GL_NOR);
|
||||
PY_DICT_ADD_INT(GL_NOTEQUAL);
|
||||
PY_DICT_ADD_INT(GL_NO_ERROR);
|
||||
PY_DICT_ADD_INT(GL_ONE);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_DST_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_DST_COLOR);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_SRC_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_SRC_COLOR);
|
||||
PY_DICT_ADD_INT(GL_OR);
|
||||
PY_DICT_ADD_INT(GL_OR_INVERTED);
|
||||
PY_DICT_ADD_INT(GL_OR_REVERSE);
|
||||
PY_DICT_ADD_INT(GL_OUT_OF_MEMORY);
|
||||
PY_DICT_ADD_INT(GL_PACK_ALIGNMENT);
|
||||
PY_DICT_ADD_INT(GL_PACK_LSB_FIRST);
|
||||
PY_DICT_ADD_INT(GL_PACK_ROW_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_PACK_SKIP_PIXELS);
|
||||
PY_DICT_ADD_INT(GL_PACK_SKIP_ROWS);
|
||||
PY_DICT_ADD_INT(GL_PACK_SWAP_BYTES);
|
||||
PY_DICT_ADD_INT(GL_POINT);
|
||||
PY_DICT_ADD_INT(GL_POINTS);
|
||||
PY_DICT_ADD_INT(GL_POINT_SIZE);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_MODE);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_OFFSET_FACTOR);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_OFFSET_FILL);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_OFFSET_LINE);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_OFFSET_POINT);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_OFFSET_UNITS);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_SMOOTH);
|
||||
PY_DICT_ADD_INT(GL_POLYGON_SMOOTH_HINT);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_1D);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D);
|
||||
PY_DICT_ADD_INT(GL_R3_G3_B2);
|
||||
PY_DICT_ADD_INT(GL_READ_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_RED);
|
||||
PY_DICT_ADD_INT(GL_RENDERER);
|
||||
PY_DICT_ADD_INT(GL_REPEAT);
|
||||
PY_DICT_ADD_INT(GL_REPLACE);
|
||||
PY_DICT_ADD_INT(GL_RGB);
|
||||
PY_DICT_ADD_INT(GL_RGB10);
|
||||
PY_DICT_ADD_INT(GL_RGB10_A2);
|
||||
PY_DICT_ADD_INT(GL_RGB12);
|
||||
PY_DICT_ADD_INT(GL_RGB16);
|
||||
PY_DICT_ADD_INT(GL_RGB4);
|
||||
PY_DICT_ADD_INT(GL_RGB5);
|
||||
PY_DICT_ADD_INT(GL_RGB5_A1);
|
||||
PY_DICT_ADD_INT(GL_RGB8);
|
||||
PY_DICT_ADD_INT(GL_RGBA);
|
||||
PY_DICT_ADD_INT(GL_RGBA12);
|
||||
PY_DICT_ADD_INT(GL_RGBA16);
|
||||
PY_DICT_ADD_INT(GL_RGBA2);
|
||||
PY_DICT_ADD_INT(GL_RGBA4);
|
||||
PY_DICT_ADD_INT(GL_RGBA8);
|
||||
PY_DICT_ADD_INT(GL_RIGHT);
|
||||
PY_DICT_ADD_INT(GL_SCISSOR_BOX);
|
||||
PY_DICT_ADD_INT(GL_SCISSOR_TEST);
|
||||
PY_DICT_ADD_INT(GL_SET);
|
||||
PY_DICT_ADD_INT(GL_SHORT);
|
||||
PY_DICT_ADD_INT(GL_SRC_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_SRC_ALPHA_SATURATE);
|
||||
PY_DICT_ADD_INT(GL_SRC_COLOR);
|
||||
PY_DICT_ADD_INT(GL_STENCIL);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BUFFER_BIT);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_CLEAR_VALUE);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_FAIL);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_FUNC);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_INDEX);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_PASS_DEPTH_FAIL);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_PASS_DEPTH_PASS);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_REF);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_TEST);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_VALUE_MASK);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_WRITEMASK);
|
||||
PY_DICT_ADD_INT(GL_STEREO);
|
||||
PY_DICT_ADD_INT(GL_SUBPIXEL_BITS);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_1D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_2D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_ALPHA_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_1D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BLUE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BORDER_COLOR);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_GREEN_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_HEIGHT);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_INTERNAL_FORMAT);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_MAG_FILTER);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_MIN_FILTER);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_RED_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_WIDTH);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_WRAP_S);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_WRAP_T);
|
||||
PY_DICT_ADD_INT(GL_TRIANGLES);
|
||||
PY_DICT_ADD_INT(GL_TRIANGLE_FAN);
|
||||
PY_DICT_ADD_INT(GL_TRIANGLE_STRIP);
|
||||
PY_DICT_ADD_INT(GL_TRUE);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_ALIGNMENT);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_LSB_FIRST);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_ROW_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_SKIP_PIXELS);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_SKIP_ROWS);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_SWAP_BYTES);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_BYTE);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT);
|
||||
PY_DICT_ADD_INT(GL_VENDOR);
|
||||
PY_DICT_ADD_INT(GL_VERSION);
|
||||
PY_DICT_ADD_INT(GL_VIEWPORT);
|
||||
PY_DICT_ADD_INT(GL_XOR);
|
||||
PY_DICT_ADD_INT(GL_ZERO);
|
||||
}
|
||||
static void init_bgl_version_1_2_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_2 */
|
||||
PY_DICT_ADD_INT(GL_ALIASED_LINE_WIDTH_RANGE);
|
||||
PY_DICT_ADD_INT(GL_BGR);
|
||||
PY_DICT_ADD_INT(GL_BGRA);
|
||||
PY_DICT_ADD_INT(GL_CLAMP_TO_EDGE);
|
||||
PY_DICT_ADD_INT(GL_MAX_3D_TEXTURE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_ELEMENTS_INDICES);
|
||||
PY_DICT_ADD_INT(GL_MAX_ELEMENTS_VERTICES);
|
||||
PY_DICT_ADD_INT(GL_PACK_IMAGE_HEIGHT);
|
||||
PY_DICT_ADD_INT(GL_PACK_SKIP_IMAGES);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_3D);
|
||||
PY_DICT_ADD_INT(GL_SMOOTH_LINE_WIDTH_GRANULARITY);
|
||||
PY_DICT_ADD_INT(GL_SMOOTH_LINE_WIDTH_RANGE);
|
||||
PY_DICT_ADD_INT(GL_SMOOTH_POINT_SIZE_GRANULARITY);
|
||||
PY_DICT_ADD_INT(GL_SMOOTH_POINT_SIZE_RANGE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_3D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BASE_LEVEL);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_3D);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_DEPTH);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_MAX_LEVEL);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_MAX_LOD);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_MIN_LOD);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_WRAP_R);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_IMAGE_HEIGHT);
|
||||
PY_DICT_ADD_INT(GL_UNPACK_SKIP_IMAGES);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_BYTE_2_3_3_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_BYTE_3_3_2);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_10_10_10_2);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_2_10_10_10_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_8_8_8_8);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_8_8_8_8_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_1_5_5_5_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_4_4_4_4);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_4_4_4_4_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_5_5_5_1);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_5_6_5);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_SHORT_5_6_5_REV);
|
||||
}
|
||||
static void init_bgl_version_1_3_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_3 */
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_TEXTURE);
|
||||
PY_DICT_ADD_INT(GL_CLAMP_TO_BORDER);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RGB);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RGBA);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_TEXTURE_FORMATS);
|
||||
PY_DICT_ADD_INT(GL_MAX_CUBE_MAP_TEXTURE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_NUM_COMPRESSED_TEXTURE_FORMATS);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_CUBE_MAP);
|
||||
PY_DICT_ADD_INT(GL_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_ALPHA_TO_ONE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_BUFFERS);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_COVERAGE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_COVERAGE_INVERT);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_COVERAGE_VALUE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE0);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE1);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE10);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE11);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE12);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE13);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE14);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE15);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE16);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE17);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE18);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE19);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE2);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE20);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE21);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE22);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE23);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE24);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE25);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE26);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE27);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE28);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE29);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE3);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE30);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE31);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE4);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE5);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE6);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE7);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE8);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE9);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_CUBE_MAP);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_COMPRESSED);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_COMPRESSED_IMAGE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_COMPRESSION_HINT);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_NEGATIVE_X);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_POSITIVE_X);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_POSITIVE_Y);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_POSITIVE_Z);
|
||||
}
|
||||
static void init_bgl_version_1_4_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_4 */
|
||||
PY_DICT_ADD_INT(GL_BLEND_DST_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_BLEND_DST_RGB);
|
||||
PY_DICT_ADD_INT(GL_BLEND_SRC_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_BLEND_SRC_RGB);
|
||||
PY_DICT_ADD_INT(GL_CONSTANT_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_CONSTANT_COLOR);
|
||||
PY_DICT_ADD_INT(GL_DECR_WRAP);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_COMPONENT16);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_COMPONENT24);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_COMPONENT32);
|
||||
PY_DICT_ADD_INT(GL_FUNC_ADD);
|
||||
PY_DICT_ADD_INT(GL_FUNC_REVERSE_SUBTRACT);
|
||||
PY_DICT_ADD_INT(GL_FUNC_SUBTRACT);
|
||||
PY_DICT_ADD_INT(GL_INCR_WRAP);
|
||||
PY_DICT_ADD_INT(GL_MAX);
|
||||
PY_DICT_ADD_INT(GL_MAX_TEXTURE_LOD_BIAS);
|
||||
PY_DICT_ADD_INT(GL_MIN);
|
||||
PY_DICT_ADD_INT(GL_MIRRORED_REPEAT);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
PY_DICT_ADD_INT(GL_POINT_FADE_THRESHOLD_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_COMPARE_FUNC);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_COMPARE_MODE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_DEPTH_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_LOD_BIAS);
|
||||
}
|
||||
static void init_bgl_version_1_5_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_1_5 */
|
||||
PY_DICT_ADD_INT(GL_ARRAY_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_ARRAY_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_ACCESS);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_MAPPED);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_MAP_POINTER);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_SIZE);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_USAGE);
|
||||
PY_DICT_ADD_INT(GL_CURRENT_QUERY);
|
||||
PY_DICT_ADD_INT(GL_DYNAMIC_COPY);
|
||||
PY_DICT_ADD_INT(GL_DYNAMIC_DRAW);
|
||||
PY_DICT_ADD_INT(GL_DYNAMIC_READ);
|
||||
PY_DICT_ADD_INT(GL_ELEMENT_ARRAY_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_ELEMENT_ARRAY_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_QUERY_COUNTER_BITS);
|
||||
PY_DICT_ADD_INT(GL_QUERY_RESULT);
|
||||
PY_DICT_ADD_INT(GL_QUERY_RESULT_AVAILABLE);
|
||||
PY_DICT_ADD_INT(GL_READ_ONLY);
|
||||
PY_DICT_ADD_INT(GL_READ_WRITE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLES_PASSED);
|
||||
PY_DICT_ADD_INT(GL_STATIC_COPY);
|
||||
PY_DICT_ADD_INT(GL_STATIC_DRAW);
|
||||
PY_DICT_ADD_INT(GL_STATIC_READ);
|
||||
PY_DICT_ADD_INT(GL_STREAM_COPY);
|
||||
PY_DICT_ADD_INT(GL_STREAM_DRAW);
|
||||
PY_DICT_ADD_INT(GL_STREAM_READ);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_WRITE_ONLY);
|
||||
}
|
||||
static void init_bgl_version_2_0_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_2_0 */
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_ATTRIBUTES);
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_UNIFORMS);
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_UNIFORM_MAX_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_ATTACHED_SHADERS);
|
||||
PY_DICT_ADD_INT(GL_BLEND_EQUATION_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_BLEND_EQUATION_RGB);
|
||||
PY_DICT_ADD_INT(GL_BOOL);
|
||||
PY_DICT_ADD_INT(GL_BOOL_VEC2);
|
||||
PY_DICT_ADD_INT(GL_BOOL_VEC3);
|
||||
PY_DICT_ADD_INT(GL_BOOL_VEC4);
|
||||
PY_DICT_ADD_INT(GL_COMPILE_STATUS);
|
||||
PY_DICT_ADD_INT(GL_CURRENT_PROGRAM);
|
||||
PY_DICT_ADD_INT(GL_CURRENT_VERTEX_ATTRIB);
|
||||
PY_DICT_ADD_INT(GL_DELETE_STATUS);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER0);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER1);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER10);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER11);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER12);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER13);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER14);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER15);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER2);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER3);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER4);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER5);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER6);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER7);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER8);
|
||||
PY_DICT_ADD_INT(GL_DRAW_BUFFER9);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT2);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT3);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT4);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_VEC2);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_VEC3);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_VEC4);
|
||||
PY_DICT_ADD_INT(GL_FRAGMENT_SHADER);
|
||||
PY_DICT_ADD_INT(GL_FRAGMENT_SHADER_DERIVATIVE_HINT);
|
||||
PY_DICT_ADD_INT(GL_INFO_LOG_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_INT_VEC2);
|
||||
PY_DICT_ADD_INT(GL_INT_VEC3);
|
||||
PY_DICT_ADD_INT(GL_INT_VEC4);
|
||||
PY_DICT_ADD_INT(GL_LINK_STATUS);
|
||||
PY_DICT_ADD_INT(GL_LOWER_LEFT);
|
||||
PY_DICT_ADD_INT(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
||||
PY_DICT_ADD_INT(GL_MAX_DRAW_BUFFERS);
|
||||
PY_DICT_ADD_INT(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_TEXTURE_IMAGE_UNITS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VARYING_FLOATS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VERTEX_ATTRIBS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VERTEX_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_POINT_SPRITE_COORD_ORIGIN);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_1D);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_1D_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_3D);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_CUBE);
|
||||
PY_DICT_ADD_INT(GL_SHADER_SOURCE_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_SHADER_TYPE);
|
||||
PY_DICT_ADD_INT(GL_SHADING_LANGUAGE_VERSION);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_FAIL);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_FUNC);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_PASS_DEPTH_FAIL);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_PASS_DEPTH_PASS);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_REF);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_VALUE_MASK);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_BACK_WRITEMASK);
|
||||
PY_DICT_ADD_INT(GL_UPPER_LEFT);
|
||||
PY_DICT_ADD_INT(GL_VALIDATE_STATUS);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_ENABLED);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_NORMALIZED);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_POINTER);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_SIZE);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_STRIDE);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_TYPE);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_SHADER);
|
||||
}
|
||||
static void init_bgl_version_2_1_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_2_1 */
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_SRGB);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_SRGB_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT2x3);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT2x4);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT3x2);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT3x4);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT4x2);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_MAT4x3);
|
||||
PY_DICT_ADD_INT(GL_PIXEL_PACK_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_PIXEL_PACK_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_PIXEL_UNPACK_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_PIXEL_UNPACK_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_SRGB);
|
||||
PY_DICT_ADD_INT(GL_SRGB8);
|
||||
PY_DICT_ADD_INT(GL_SRGB8_ALPHA8);
|
||||
PY_DICT_ADD_INT(GL_SRGB_ALPHA);
|
||||
}
|
||||
static void init_bgl_version_3_0_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_0 */
|
||||
PY_DICT_ADD_INT(GL_BGRA_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_BGR_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_BLUE_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_ACCESS_FLAGS);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_MAP_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_BUFFER_MAP_OFFSET);
|
||||
PY_DICT_ADD_INT(GL_CLAMP_READ_COLOR);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE0);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE1);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE2);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE3);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE4);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE5);
|
||||
#if 0
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE6);
|
||||
PY_DICT_ADD_INT(GL_CLIP_DISTANCE7);
|
||||
#endif
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT0);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT1);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT2);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT3);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT4);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT5);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT6);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT7);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT8);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT9);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT10);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT11);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT12);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT13);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT14);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT15);
|
||||
#if 0
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT16);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT17);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT18);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT19);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT20);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT21);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT22);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT23);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT24);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT25);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT26);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT27);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT28);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT29);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT30);
|
||||
PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT31);
|
||||
#endif
|
||||
PY_DICT_ADD_INT(GL_COMPARE_REF_TO_TEXTURE);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RED);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RED_RGTC1);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RG);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_RG_RGTC2);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_SIGNED_RED_RGTC1);
|
||||
PY_DICT_ADD_INT(GL_COMPRESSED_SIGNED_RG_RGTC2);
|
||||
PY_DICT_ADD_INT(GL_CONTEXT_FLAGS);
|
||||
PY_DICT_ADD_INT(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT);
|
||||
PY_DICT_ADD_INT(GL_DEPTH24_STENCIL8);
|
||||
PY_DICT_ADD_INT(GL_DEPTH32F_STENCIL8);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_ATTACHMENT);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_COMPONENT32F);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_STENCIL);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_STENCIL_ATTACHMENT);
|
||||
PY_DICT_ADD_INT(GL_DRAW_FRAMEBUFFER);
|
||||
PY_DICT_ADD_INT(GL_DRAW_FRAMEBUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_FIXED_ONLY);
|
||||
PY_DICT_ADD_INT(GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_COMPLETE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_DEFAULT);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_SRGB);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_UNDEFINED);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_UNSUPPORTED);
|
||||
PY_DICT_ADD_INT(GL_GREEN_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_HALF_FLOAT);
|
||||
PY_DICT_ADD_INT(GL_INDEX);
|
||||
PY_DICT_ADD_INT(GL_INTERLEAVED_ATTRIBS);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_1D);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_2D);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_3D);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_CUBE);
|
||||
PY_DICT_ADD_INT(GL_INVALID_FRAMEBUFFER_OPERATION);
|
||||
PY_DICT_ADD_INT(GL_MAJOR_VERSION);
|
||||
PY_DICT_ADD_INT(GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAP_INVALIDATE_RANGE_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAP_READ_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAP_WRITE_BIT);
|
||||
PY_DICT_ADD_INT(GL_MAX_ARRAY_TEXTURE_LAYERS);
|
||||
PY_DICT_ADD_INT(GL_MAX_CLIP_DISTANCES);
|
||||
PY_DICT_ADD_INT(GL_MAX_COLOR_ATTACHMENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_PROGRAM_TEXEL_OFFSET);
|
||||
PY_DICT_ADD_INT(GL_MAX_RENDERBUFFER_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);
|
||||
PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VARYING_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MINOR_VERSION);
|
||||
PY_DICT_ADD_INT(GL_MIN_PROGRAM_TEXEL_OFFSET);
|
||||
PY_DICT_ADD_INT(GL_NUM_EXTENSIONS);
|
||||
PY_DICT_ADD_INT(GL_PRIMITIVES_GENERATED);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_QUERY_BY_REGION_NO_WAIT);
|
||||
PY_DICT_ADD_INT(GL_QUERY_BY_REGION_WAIT);
|
||||
PY_DICT_ADD_INT(GL_QUERY_NO_WAIT);
|
||||
PY_DICT_ADD_INT(GL_QUERY_WAIT);
|
||||
PY_DICT_ADD_INT(GL_R11F_G11F_B10F);
|
||||
PY_DICT_ADD_INT(GL_R16);
|
||||
PY_DICT_ADD_INT(GL_R16F);
|
||||
PY_DICT_ADD_INT(GL_R16I);
|
||||
PY_DICT_ADD_INT(GL_R16UI);
|
||||
PY_DICT_ADD_INT(GL_R32F);
|
||||
PY_DICT_ADD_INT(GL_R32I);
|
||||
PY_DICT_ADD_INT(GL_R32UI);
|
||||
PY_DICT_ADD_INT(GL_R8);
|
||||
PY_DICT_ADD_INT(GL_R8I);
|
||||
PY_DICT_ADD_INT(GL_R8UI);
|
||||
PY_DICT_ADD_INT(GL_RASTERIZER_DISCARD);
|
||||
PY_DICT_ADD_INT(GL_READ_FRAMEBUFFER);
|
||||
PY_DICT_ADD_INT(GL_READ_FRAMEBUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_RED_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_ALPHA_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_BLUE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_DEPTH_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_GREEN_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_HEIGHT);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_INTERNAL_FORMAT);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_RED_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_STENCIL_SIZE);
|
||||
PY_DICT_ADD_INT(GL_RENDERBUFFER_WIDTH);
|
||||
PY_DICT_ADD_INT(GL_RG);
|
||||
PY_DICT_ADD_INT(GL_RG16);
|
||||
PY_DICT_ADD_INT(GL_RG16F);
|
||||
PY_DICT_ADD_INT(GL_RG16I);
|
||||
PY_DICT_ADD_INT(GL_RG16UI);
|
||||
PY_DICT_ADD_INT(GL_RG32F);
|
||||
PY_DICT_ADD_INT(GL_RG32I);
|
||||
PY_DICT_ADD_INT(GL_RG32UI);
|
||||
PY_DICT_ADD_INT(GL_RG8);
|
||||
PY_DICT_ADD_INT(GL_RG8I);
|
||||
PY_DICT_ADD_INT(GL_RG8UI);
|
||||
PY_DICT_ADD_INT(GL_RGB16F);
|
||||
PY_DICT_ADD_INT(GL_RGB16I);
|
||||
PY_DICT_ADD_INT(GL_RGB16UI);
|
||||
PY_DICT_ADD_INT(GL_RGB32F);
|
||||
PY_DICT_ADD_INT(GL_RGB32I);
|
||||
PY_DICT_ADD_INT(GL_RGB32UI);
|
||||
PY_DICT_ADD_INT(GL_RGB8I);
|
||||
PY_DICT_ADD_INT(GL_RGB8UI);
|
||||
PY_DICT_ADD_INT(GL_RGB9_E5);
|
||||
PY_DICT_ADD_INT(GL_RGBA16F);
|
||||
PY_DICT_ADD_INT(GL_RGBA16I);
|
||||
PY_DICT_ADD_INT(GL_RGBA16UI);
|
||||
PY_DICT_ADD_INT(GL_RGBA32F);
|
||||
PY_DICT_ADD_INT(GL_RGBA32I);
|
||||
PY_DICT_ADD_INT(GL_RGBA32UI);
|
||||
PY_DICT_ADD_INT(GL_RGBA8I);
|
||||
PY_DICT_ADD_INT(GL_RGBA8UI);
|
||||
PY_DICT_ADD_INT(GL_RGBA_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_RGB_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_RG_INTEGER);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_1D_ARRAY_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_ARRAY_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_CUBE_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SEPARATE_ATTRIBS);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_ATTACHMENT);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_INDEX1);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_INDEX16);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_INDEX4);
|
||||
PY_DICT_ADD_INT(GL_STENCIL_INDEX8);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_ALPHA_TYPE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BLUE_TYPE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_DEPTH_TYPE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_GREEN_TYPE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_RED_TYPE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SHARED_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_STENCIL_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_MODE);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_START);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_VARYINGS);
|
||||
PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_10F_11F_11F_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_24_8);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_5_9_9_9_REV);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_1D);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_3D);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_CUBE);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC2);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC3);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC4);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_NORMALIZED);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ARRAY_BINDING);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_INTEGER);
|
||||
}
|
||||
static void init_bgl_version_3_1_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_1 */
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_UNIFORM_BLOCKS);
|
||||
PY_DICT_ADD_INT(GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_COPY_READ_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_COPY_WRITE_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_RECT);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_INVALID_INDEX);
|
||||
PY_DICT_ADD_INT(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_COMBINED_UNIFORM_BLOCKS);
|
||||
PY_DICT_ADD_INT(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_FRAGMENT_UNIFORM_BLOCKS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_UNIFORM_BLOCKS);
|
||||
PY_DICT_ADD_INT(GL_MAX_RECTANGLE_TEXTURE_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_TEXTURE_BUFFER_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_UNIFORM_BLOCK_SIZE);
|
||||
PY_DICT_ADD_INT(GL_MAX_UNIFORM_BUFFER_BINDINGS);
|
||||
PY_DICT_ADD_INT(GL_MAX_VERTEX_UNIFORM_BLOCKS);
|
||||
PY_DICT_ADD_INT(GL_PRIMITIVE_RESTART);
|
||||
PY_DICT_ADD_INT(GL_PRIMITIVE_RESTART_INDEX);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_RECTANGLE);
|
||||
PY_DICT_ADD_INT(GL_R16_SNORM);
|
||||
PY_DICT_ADD_INT(GL_R8_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RG16_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RG8_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RGB16_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RGB8_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RGBA16_SNORM);
|
||||
PY_DICT_ADD_INT(GL_RGBA8_SNORM);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_RECT);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_RECT_SHADOW);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_SIGNED_NORMALIZED);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_RECTANGLE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BUFFER_DATA_STORE_BINDING);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_RECTANGLE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_ARRAY_STRIDE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_BINDING);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_DATA_SIZE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_INDEX);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_NAME_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BUFFER);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BUFFER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BUFFER_SIZE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_BUFFER_START);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_IS_ROW_MAJOR);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_MATRIX_STRIDE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_NAME_LENGTH);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_OFFSET);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_SIZE);
|
||||
PY_DICT_ADD_INT(GL_UNIFORM_TYPE);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_RECT);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_BUFFER);
|
||||
}
|
||||
static void init_bgl_version_3_2_constants(PyObject *dict)
|
||||
/* GL_VERSION_3_2 */
|
||||
{
|
||||
PY_DICT_ADD_INT(GL_ALREADY_SIGNALED);
|
||||
PY_DICT_ADD_INT(GL_CONDITION_SATISFIED);
|
||||
PY_DICT_ADD_INT(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT);
|
||||
PY_DICT_ADD_INT(GL_CONTEXT_CORE_PROFILE_BIT);
|
||||
PY_DICT_ADD_INT(GL_CONTEXT_PROFILE_MASK);
|
||||
PY_DICT_ADD_INT(GL_DEPTH_CLAMP);
|
||||
PY_DICT_ADD_INT(GL_FIRST_VERTEX_CONVENTION);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_LAYERED);
|
||||
PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS);
|
||||
PY_DICT_ADD_INT(GL_GEOMETRY_INPUT_TYPE);
|
||||
PY_DICT_ADD_INT(GL_GEOMETRY_OUTPUT_TYPE);
|
||||
PY_DICT_ADD_INT(GL_GEOMETRY_SHADER);
|
||||
PY_DICT_ADD_INT(GL_GEOMETRY_VERTICES_OUT);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_LAST_VERTEX_CONVENTION);
|
||||
PY_DICT_ADD_INT(GL_LINES_ADJACENCY);
|
||||
PY_DICT_ADD_INT(GL_LINE_STRIP_ADJACENCY);
|
||||
PY_DICT_ADD_INT(GL_MAX_COLOR_TEXTURE_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_MAX_DEPTH_TEXTURE_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_MAX_FRAGMENT_INPUT_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_INPUT_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_OUTPUT_VERTICES);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_MAX_INTEGER_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_MAX_SAMPLE_MASK_WORDS);
|
||||
PY_DICT_ADD_INT(GL_MAX_SERVER_WAIT_TIMEOUT);
|
||||
PY_DICT_ADD_INT(GL_MAX_VERTEX_OUTPUT_COMPONENTS);
|
||||
PY_DICT_ADD_INT(GL_OBJECT_TYPE);
|
||||
PY_DICT_ADD_INT(GL_PROGRAM_POINT_SIZE);
|
||||
PY_DICT_ADD_INT(GL_PROVOKING_VERTEX);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_MASK);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_MASK_VALUE);
|
||||
PY_DICT_ADD_INT(GL_SAMPLE_POSITION);
|
||||
PY_DICT_ADD_INT(GL_SIGNALED);
|
||||
PY_DICT_ADD_INT(GL_SYNC_CONDITION);
|
||||
PY_DICT_ADD_INT(GL_SYNC_FENCE);
|
||||
PY_DICT_ADD_INT(GL_SYNC_FLAGS);
|
||||
PY_DICT_ADD_INT(GL_SYNC_FLUSH_COMMANDS_BIT);
|
||||
PY_DICT_ADD_INT(GL_SYNC_GPU_COMMANDS_COMPLETE);
|
||||
PY_DICT_ADD_INT(GL_SYNC_STATUS);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_FIXED_SAMPLE_LOCATIONS);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SAMPLES);
|
||||
PY_DICT_ADD_INT(GL_TIMEOUT_EXPIRED);
|
||||
PY_DICT_ADD_INT64(GL_TIMEOUT_IGNORED);
|
||||
PY_DICT_ADD_INT(GL_TRIANGLES_ADJACENCY);
|
||||
PY_DICT_ADD_INT(GL_TRIANGLE_STRIP_ADJACENCY);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNALED);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE);
|
||||
PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY);
|
||||
PY_DICT_ADD_INT(GL_WAIT_FAILED);
|
||||
}
|
||||
static void init_bgl_version_3_3_constants(PyObject *dict)
|
||||
{
|
||||
/* GL_VERSION_3_3 */
|
||||
PY_DICT_ADD_INT(GL_ANY_SAMPLES_PASSED);
|
||||
PY_DICT_ADD_INT(GL_INT_2_10_10_10_REV);
|
||||
PY_DICT_ADD_INT(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_SRC1_ALPHA);
|
||||
PY_DICT_ADD_INT(GL_ONE_MINUS_SRC1_COLOR);
|
||||
PY_DICT_ADD_INT(GL_RGB10_A2UI);
|
||||
PY_DICT_ADD_INT(GL_SAMPLER_BINDING);
|
||||
PY_DICT_ADD_INT(GL_SRC1_COLOR);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_A);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_B);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_G);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_R);
|
||||
PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_RGBA);
|
||||
PY_DICT_ADD_INT(GL_TIMESTAMP);
|
||||
PY_DICT_ADD_INT(GL_TIME_ELAPSED);
|
||||
PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_DIVISOR);
|
||||
}
|
||||
|
||||
PyObject *BPyInit_bgl()
|
||||
{
|
||||
PyObject *submodule, *dict;
|
||||
submodule = PyModule_Create(&BGL_module_def);
|
||||
dict = PyModule_GetDict(submodule);
|
||||
|
||||
if (PyType_Ready(&BGL_bufferType) < 0) {
|
||||
return nullptr; /* should never happen */
|
||||
}
|
||||
|
||||
/* Building as a Python module loads all modules
|
||||
* (see code comment around #PyImport_ExtendInittab usage).
|
||||
* The result of this is the `bgl` warning would always show when importing `bpy`.
|
||||
* In the case of Blender as a Python module, suppress the warning. */
|
||||
#ifndef WITH_PYTHON_MODULE
|
||||
if (GPU_backend_get_type() != GPU_BACKEND_OPENGL) {
|
||||
CLOG_WARN(&LOG,
|
||||
"'bgl' imported without an OpenGL backend. Please update your add-ons to use the "
|
||||
"'gpu' module.");
|
||||
}
|
||||
#else
|
||||
UNUSED_VARS(LOG);
|
||||
#endif
|
||||
|
||||
PyModule_AddObjectRef(submodule, "Buffer", (PyObject *)&BGL_bufferType);
|
||||
|
||||
init_bgl_version_1_0_methods(submodule, dict);
|
||||
init_bgl_version_1_1_methods(submodule, dict);
|
||||
init_bgl_version_1_2_methods(submodule, dict);
|
||||
init_bgl_version_1_3_methods(submodule, dict);
|
||||
init_bgl_version_1_4_methods(submodule, dict);
|
||||
init_bgl_version_1_5_methods(submodule, dict);
|
||||
init_bgl_version_2_0_methods(submodule, dict);
|
||||
init_bgl_version_2_1_methods(submodule, dict);
|
||||
init_bgl_version_3_0_methods(submodule, dict);
|
||||
init_bgl_version_3_1_methods(submodule, dict);
|
||||
init_bgl_version_3_2_methods(submodule, dict);
|
||||
init_bgl_version_3_3_methods(submodule, dict);
|
||||
|
||||
init_bgl_version_1_1_constants(dict);
|
||||
init_bgl_version_1_2_constants(dict);
|
||||
init_bgl_version_1_3_constants(dict);
|
||||
init_bgl_version_1_4_constants(dict);
|
||||
init_bgl_version_1_5_constants(dict);
|
||||
init_bgl_version_2_0_constants(dict);
|
||||
init_bgl_version_2_1_constants(dict);
|
||||
init_bgl_version_3_0_constants(dict);
|
||||
init_bgl_version_3_1_constants(dict);
|
||||
init_bgl_version_3_2_constants(dict);
|
||||
init_bgl_version_3_3_constants(dict);
|
||||
|
||||
return submodule;
|
||||
}
|
||||
|
||||
static PyObject *Method_ShaderSource(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
uint shader;
|
||||
const char *source;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "Is", &shader, &source)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENGL
|
||||
glShaderSource(shader, 1, (const char **)&source, nullptr);
|
||||
Py_RETURN_NONE;
|
||||
#else
|
||||
bgl_no_opengl_error();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -1,61 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup pygen
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_bgl();
|
||||
|
||||
/* This API is deprecated, currently these are only used in `bgl.cc`
|
||||
* and there should be no reason to make use of them in the future.
|
||||
* Use a define to indicate they are part of the public API which is being phased out. */
|
||||
#ifdef USE_BGL_DEPRECATED_API
|
||||
|
||||
/**
|
||||
* Buffer Object
|
||||
*
|
||||
* For Python access to OpenGL functions requiring a pointer.
|
||||
*/
|
||||
struct Buffer {
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *parent;
|
||||
|
||||
int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */
|
||||
int ndimensions;
|
||||
int *dimensions;
|
||||
|
||||
union {
|
||||
char *asbyte;
|
||||
short *asshort;
|
||||
int *asint;
|
||||
float *asfloat;
|
||||
double *asdouble;
|
||||
|
||||
void *asvoid;
|
||||
} buf;
|
||||
};
|
||||
|
||||
/** The type object. */
|
||||
extern PyTypeObject BGL_bufferType;
|
||||
|
||||
/**
|
||||
* Create a buffer object
|
||||
*
|
||||
* \param dimensions: An array of ndimensions integers representing the size of each dimension.
|
||||
* \param initbuffer: When not NULL holds a contiguous buffer
|
||||
* with the correct format from which the buffer will be initialized
|
||||
*/
|
||||
struct Buffer *BGL_MakeBuffer(int type,
|
||||
int ndimensions,
|
||||
const int *dimensions,
|
||||
const void *initbuffer);
|
||||
|
||||
int BGL_typeSize(int type);
|
||||
|
||||
#endif /* USE_BGL_DEPRECATED_API */
|
||||
@@ -351,19 +351,6 @@ static PyObject *pygpu_offscreen_height_get(BPyGPUOffScreen *self, void * /*type
|
||||
return PyLong_FromLong(GPU_offscreen_height(self->ofs));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
/* Wrap. */
|
||||
pygpu_offscreen_color_texture_doc,
|
||||
"OpenGL bindcode for the color texture.\n"
|
||||
"\n"
|
||||
":type: int");
|
||||
static PyObject *pygpu_offscreen_color_texture_get(BPyGPUOffScreen *self, void * /*type*/)
|
||||
{
|
||||
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
|
||||
GPUTexture *texture = GPU_offscreen_color_texture(self->ofs);
|
||||
return PyLong_FromLong(GPU_texture_opengl_bindcode(texture));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
/* Wrap. */
|
||||
pygpu_offscreen_texture_color_doc,
|
||||
@@ -477,12 +464,6 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
|
||||
|
||||
depsgraph = BKE_scene_ensure_depsgraph(G_MAIN, scene, view_layer);
|
||||
|
||||
/* Disable 'bgl' state since it interfere with off-screen drawing, see: #84402. */
|
||||
const bool is_bgl = GPU_bgl_get();
|
||||
if (is_bgl) {
|
||||
GPU_bgl_end();
|
||||
}
|
||||
|
||||
GPU_offscreen_bind(self->ofs, true);
|
||||
|
||||
/* Cache the #GPUViewport so the frame-buffers and associated textures are
|
||||
@@ -513,10 +494,6 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
|
||||
|
||||
GPU_offscreen_unbind(self->ofs, true);
|
||||
|
||||
if (is_bgl) {
|
||||
GPU_bgl_start();
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -555,11 +532,6 @@ static void BPyGPUOffScreen__tp_dealloc(BPyGPUOffScreen *self)
|
||||
}
|
||||
|
||||
static PyGetSetDef pygpu_offscreen__tp_getseters[] = {
|
||||
{"color_texture",
|
||||
(getter)pygpu_offscreen_color_texture_get,
|
||||
(setter) nullptr,
|
||||
pygpu_offscreen_color_texture_doc,
|
||||
nullptr},
|
||||
{"texture_color",
|
||||
(getter)pygpu_offscreen_texture_color_get,
|
||||
(setter) nullptr,
|
||||
|
||||
@@ -709,8 +709,6 @@ static PyObject *bpy_import_test(const char *modname)
|
||||
{
|
||||
PyObject *mod = PyImport_ImportModuleLevel(modname, nullptr, nullptr, nullptr, 0);
|
||||
|
||||
GPU_bgl_end();
|
||||
|
||||
if (mod) {
|
||||
Py_DECREF(mod);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
|
||||
/* `inittab` initialization functions. */
|
||||
#include "../bmesh/bmesh_py_api.hh"
|
||||
#include "../generic/bgl.hh"
|
||||
#include "../generic/bl_math_py_api.hh"
|
||||
#include "../generic/blf_py_api.hh"
|
||||
#include "../generic/idprop_py_api.hh"
|
||||
@@ -272,7 +271,6 @@ static _inittab bpy_internal_modules[] = {
|
||||
{"mathutils.kdtree", PyInit_mathutils_kdtree},
|
||||
#endif
|
||||
{"_bpy_path", BPyInit__bpy_path},
|
||||
{"bgl", BPyInit_bgl},
|
||||
{"blf", BPyInit_blf},
|
||||
{"bl_math", BPyInit_bl_math},
|
||||
{"imbuf", BPyInit_imbuf},
|
||||
|
||||
@@ -1185,9 +1185,6 @@ static void wm_draw_window(bContext *C, wmWindow *win)
|
||||
bScreen *screen = WM_window_get_active_screen(win);
|
||||
bool stereo = WM_stereo3d_enabled(win, false);
|
||||
|
||||
/* Avoid any BGL call issued before this to alter the window drawing. */
|
||||
GPU_bgl_end();
|
||||
|
||||
/* Draw area regions into their own frame-buffer. This way we can redraw
|
||||
* the areas that need it, and blit the rest from existing frame-buffers. */
|
||||
wm_draw_window_offscreen(C, win, stereo);
|
||||
|
||||
@@ -812,7 +812,6 @@ void wm_event_do_notifiers(bContext *C)
|
||||
/* Auto-run warning. */
|
||||
wm_test_autorun_warning(C);
|
||||
/* Deprecation warning. */
|
||||
wm_test_opengl_deprecation_warning(C);
|
||||
wm_test_gpu_backend_fallback(C);
|
||||
|
||||
GPU_render_end();
|
||||
|
||||
@@ -2134,12 +2134,6 @@ static uiBlock *block_create_opengl_usage_warning(bContext *C, ARegion *region,
|
||||
messages->label(message1, ICON_NONE);
|
||||
messages->label(message2, ICON_NONE);
|
||||
messages->label(message3, ICON_NONE);
|
||||
if (G.opengl_deprecation_usage_filename) {
|
||||
char location[1024];
|
||||
SNPRINTF(
|
||||
location, "%s:%d", G.opengl_deprecation_usage_filename, G.opengl_deprecation_usage_lineno);
|
||||
messages->label(location, ICON_NONE);
|
||||
}
|
||||
messages->label(message4, ICON_NONE);
|
||||
|
||||
col->separator(0.5f, LayoutSeparatorType::Space);
|
||||
@@ -2149,44 +2143,6 @@ static uiBlock *block_create_opengl_usage_warning(bContext *C, ARegion *region,
|
||||
return block;
|
||||
}
|
||||
|
||||
void wm_test_opengl_deprecation_warning(bContext *C)
|
||||
{
|
||||
static bool message_shown = false;
|
||||
|
||||
/* Exit when no failure detected. */
|
||||
if (!G.opengl_deprecation_usage_detected) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Have we already shown a message during this Blender session. `bgl` calls are done in a draw
|
||||
* handler that will run many times. */
|
||||
if (message_shown) {
|
||||
return;
|
||||
}
|
||||
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmWindow *win = static_cast<wmWindow *>((wm->winactive) ? wm->winactive : wm->windows.first);
|
||||
|
||||
BKE_report(&wm->runtime->reports,
|
||||
RPT_ERROR,
|
||||
"One of the add-ons or scripts is using OpenGL and will not work correct on Metal. "
|
||||
"Please contact the developer of the add-on to migrate to use 'gpu' module");
|
||||
|
||||
if (win) {
|
||||
/* We want this warning on the Main window, not a child window even if active. See #118765. */
|
||||
if (win->parent) {
|
||||
win = win->parent;
|
||||
}
|
||||
|
||||
wmWindow *prevwin = CTX_wm_window(C);
|
||||
CTX_wm_window_set(C, win);
|
||||
UI_popup_block_invoke(C, block_create_opengl_usage_warning, nullptr, nullptr);
|
||||
CTX_wm_window_set(C, prevwin);
|
||||
}
|
||||
|
||||
message_shown = true;
|
||||
}
|
||||
|
||||
static uiBlock *block_create_gpu_backend_fallback(bContext *C, ARegion *region, void * /*arg1*/)
|
||||
{
|
||||
uiBlock *block = UI_block_begin(
|
||||
|
||||
@@ -28,5 +28,4 @@ void WM_ghost_show_message_box(const char *title,
|
||||
|
||||
GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gpu_backend);
|
||||
|
||||
void wm_test_opengl_deprecation_warning(bContext *C);
|
||||
void wm_test_gpu_backend_fallback(bContext *C);
|
||||
|
||||
@@ -23,7 +23,6 @@ import rst_to_doctree_mini
|
||||
|
||||
# (file, module)
|
||||
modules = (
|
||||
("bgl.rst", "bgl", True),
|
||||
("gpu.rst", "gpu", False),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user