first commit

This commit is contained in:
Yura 2024-09-15 15:12:16 +03:00
commit 417e54da96
5696 changed files with 900003 additions and 0 deletions

View file

@ -0,0 +1,126 @@
'''
Graphics
========
This package assembles many low level functions used for drawing. The whole
graphics package is compatible with OpenGL ES 2.0 and has many rendering
optimizations.
The basics
----------
For drawing on a screen, you will need :
1. a :class:`~kivy.graphics.instructions.Canvas` object.
2. :class:`~kivy.graphics.instructions.Instruction` objects.
Each :class:`~kivy.uix.widget.Widget`
in Kivy already has a :class:`Canvas` by default. When you create
a widget, you can create all the instructions needed for drawing. If
`self` is your current widget, you can do::
from kivy.graphics import *
with self.canvas:
# Add a red color
Color(1., 0, 0)
# Add a rectangle
Rectangle(pos=(10, 10), size=(500, 500))
The instructions :class:`Color` and :class:`Rectangle` are automatically added
to the canvas object and will be used when the window is drawn.
.. note::
Kivy drawing instructions are not automatically relative to the position
or size of the widget. You, therefore, need to consider these factors when
drawing. In order to make your drawing instructions relative to the widget,
the instructions need either to be
declared in the :mod:`KvLang <kivy.lang>` or bound to pos and size changes.
Please see :ref:`adding_widget_background` for more detail.
GL Reloading mechanism
----------------------
.. versionadded:: 1.2.0
During the lifetime of the application, the OpenGL context might be lost. This
happens:
- when the window is resized on OS X or the Windows platform and you're
using pygame as a window provider. This is due to SDL 1.2. In the SDL 1.2
design, it needs to recreate a GL context everytime the window is
resized. This was fixed in SDL 1.3 but pygame is not yet available on it
by default.
- when Android releases the app resources: when your application goes to the
background, Android might reclaim your opengl context to give the
resource to another app. When the user switches back to your application, a
newly created gl context is given to your app.
Starting from 1.2.0, we have introduced a mechanism for reloading all the
graphics resources using the GPU: Canvas, FBO, Shader, Texture, VBO,
and VertexBatch:
- VBO and VertexBatch are constructed by our graphics instructions. We have all
the data needed to reconstruct when reloading.
- Shader: same as VBO, we store the source and values used in the
shader so we are able to recreate the vertex/fragment/program.
- Texture: if the texture has a source (an image file or atlas), the image
is reloaded from the source and reuploaded to the GPU.
You should cover these cases yourself:
- Textures without a source: if you manually created a texture and manually
blit data / a buffer to it, you must handle the reloading yourself. Check the
:doc:`api-kivy.graphics.texture` to learn how to manage that case. (The text
rendering already generates the texture and handles the reloading. You
don't need to reload text yourself.)
- FBO: if you added / removed / drew things multiple times on the FBO, we
can't reload it. We don't keep a history of the instructions put on it.
As for textures without a source, check the :doc:`api-kivy.graphics.fbo` to
learn how to manage that case.
'''
from kivy.graphics.instructions import Callback, Canvas, CanvasBase, \
ContextInstruction, Instruction, InstructionGroup, RenderContext, \
VertexInstruction
from kivy.graphics.context_instructions import BindTexture, Color, \
PushState, ChangeState, PopState, MatrixInstruction, ApplyContextMatrix, \
PopMatrix, PushMatrix, Rotate, Scale, Translate, LoadIdentity, \
UpdateNormalMatrix, gl_init_resources
from kivy.graphics.vertex_instructions import Bezier, BorderImage, Ellipse, \
GraphicException, Line, Mesh, Point, Quad, Rectangle, RoundedRectangle, \
Triangle, SmoothLine, SmoothRectangle, SmoothEllipse, \
SmoothRoundedRectangle, SmoothQuad, SmoothTriangle
from kivy.graphics.stencil_instructions import StencilPop, StencilPush, \
StencilUse, StencilUnUse
from kivy.graphics.gl_instructions import ClearColor, ClearBuffers
from kivy.graphics.fbo import Fbo
from kivy.graphics.boxshadow import BoxShadow
from kivy.graphics.scissor_instructions import ScissorPush, ScissorPop
# very hacky way to avoid pyflakes warning...
__all__ = (Bezier.__name__, BindTexture.__name__, BorderImage.__name__,
Callback.__name__, Canvas.__name__, CanvasBase.__name__,
Color.__name__, ContextInstruction.__name__,
Ellipse.__name__, Fbo.__name__, GraphicException.__name__,
Instruction.__name__, InstructionGroup.__name__,
Line.__name__, SmoothLine.__name__, MatrixInstruction.__name__,
Mesh.__name__, Point.__name__, PopMatrix.__name__,
PushMatrix.__name__, Quad.__name__, Rectangle.__name__,
RenderContext.__name__, Rotate.__name__, Scale.__name__,
StencilPop.__name__, StencilPush.__name__, StencilUse.__name__,
StencilUnUse.__name__, Translate.__name__, Triangle.__name__,
VertexInstruction.__name__, ClearColor.__name__,
ClearBuffers.__name__, gl_init_resources.__name__,
PushState.__name__, ChangeState.__name__, PopState.__name__,
ApplyContextMatrix.__name__, UpdateNormalMatrix.__name__,
LoadIdentity.__name__, BoxShadow.__name__, SmoothEllipse.__name__,
SmoothRoundedRectangle.__name__, SmoothRectangle.__name__,
SmoothQuad.__name__, SmoothTriangle.__name__,
)

View file

@ -0,0 +1,32 @@
from kivy.graphics.fbo cimport Fbo
from kivy.graphics.context_instructions cimport Translate, Scale
from kivy.graphics.vertex_instructions cimport VertexInstruction
from kivy.graphics.instructions cimport InstructionGroup
cdef class BoxShadow(InstructionGroup):
cdef bint _inset
cdef float _blur_radius
cdef tuple _pos
cdef tuple _size
cdef tuple _offset
cdef tuple _border_radius
cdef tuple _spread_radius
cdef VertexInstruction _fbo_rect
cdef VertexInstruction _texture_container
cdef Scale _fbo_scale
cdef Translate _fbo_translate
cdef Fbo _fbo
cdef void _init_texture(self)
cdef void _update_canvas(self)
cdef void _update_fbo(self)
cdef void _update_shadow(self)
cdef tuple _adjusted_pos(self)
cdef tuple _adjusted_size(self)
cdef object _bounded_value(self, object value, min_value=?, max_value=?)
cdef bint _check_bool(self, object value)
cdef float _check_float(self, str property_name, object value, str iter_text=?)
cdef tuple _check_iter(self, str property_name, object value, int components=?)

View file

@ -0,0 +1,17 @@
cdef class Buffer:
cdef void *data
cdef int *l_free
cdef int i_free
cdef long block_size
cdef long block_count
cdef void clear(self)
cdef void grow(self, long block_count)
cdef void add(self, void *blocks, unsigned short *indices, int count)
cdef void remove(self, unsigned short *indices, int count)
cdef int count(self)
cdef long size(self)
cdef void *pointer(self)
cdef void *offset_pointer(self, int offset)
cdef void update(self, int index, void* blocks, int count)

View file

@ -0,0 +1,59 @@
/* Generated by Cython 3.0.0 */
#ifndef __PYX_HAVE__kivy__graphics__cgl
#define __PYX_HAVE__kivy__graphics__cgl
#include "Python.h"
#ifndef __PYX_HAVE_API__kivy__graphics__cgl
#ifdef CYTHON_EXTERN_C
#undef __PYX_EXTERN_C
#define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
#ifdef _MSC_VER
#pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
#else
#warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
#endif
#else
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(_T) _T
#endif
__PYX_EXTERN_C int verify_gl_main_thread;
#endif /* !__PYX_HAVE_API__kivy__graphics__cgl */
/* WARNING: the interface of the module init function changed in CPython 3.5. */
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcgl(void);
#else
/* WARNING: Use PyImport_AppendInittab("cgl", PyInit_cgl) instead of calling PyInit_cgl directly from Python 3.5 */
PyMODINIT_FUNC PyInit_cgl(void);
#if PY_VERSION_HEX >= 0x03050000 && (defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 201402L))
#if defined(__cplusplus) && __cplusplus >= 201402L
[[deprecated("Use PyImport_AppendInittab(\"cgl\", PyInit_cgl) instead of calling PyInit_cgl directly.")]] inline
#elif defined(__GNUC__) || defined(__clang__)
__attribute__ ((__deprecated__("Use PyImport_AppendInittab(\"cgl\", PyInit_cgl) instead of calling PyInit_cgl directly."), __unused__)) __inline__
#elif defined(_MSC_VER)
__declspec(deprecated("Use PyImport_AppendInittab(\"cgl\", PyInit_cgl) instead of calling PyInit_cgl directly.")) __inline
#endif
static PyObject* __PYX_WARN_IF_PyInit_cgl_INIT_CALLED(PyObject* res) {
return res;
}
#define PyInit_cgl() __PYX_WARN_IF_PyInit_cgl_INIT_CALLED(PyInit_cgl())
#endif
#endif
#endif /* !__PYX_HAVE__kivy__graphics__cgl */

View file

@ -0,0 +1,650 @@
include "common.pxi"
include "../include/config.pxi"
cdef extern from "gl_redirect.h":
ctypedef void GLvoid
ctypedef char GLchar
ctypedef unsigned int GLenum
ctypedef unsigned char GLboolean
ctypedef unsigned int GLbitfield
ctypedef short GLshort
ctypedef int GLint
ctypedef int GLsizei
ctypedef unsigned short GLushort
ctypedef unsigned int GLuint
ctypedef signed char GLbyte
ctypedef unsigned char GLubyte
ctypedef float GLfloat
ctypedef float GLclampf
ctypedef int GLfixed
ctypedef signed long int GLintptr
ctypedef signed long int GLsizeiptr
int GL_DEPTH_BUFFER_BIT
int GL_STENCIL_BUFFER_BIT
int GL_COLOR_BUFFER_BIT
int GL_FALSE
int GL_TRUE
int GL_POINTS
int GL_LINES
int GL_LINE_LOOP
int GL_LINE_STRIP
int GL_TRIANGLES
int GL_TRIANGLE_STRIP
int GL_TRIANGLE_FAN
int GL_ZERO
int GL_ONE
int GL_SRC_COLOR
int GL_ONE_MINUS_SRC_COLOR
int GL_SRC_ALPHA
int GL_ONE_MINUS_SRC_ALPHA
int GL_DST_ALPHA
int GL_ONE_MINUS_DST_ALPHA
int GL_DST_COLOR
int GL_ONE_MINUS_DST_COLOR
int GL_SRC_ALPHA_SATURATE
int GL_FUNC_ADD
int GL_BLEND_EQUATION
int GL_BLEND_EQUATION_RGB
int GL_BLEND_EQUATION_ALPHA
int GL_FUNC_SUBTRACT
int GL_FUNC_REVERSE_SUBTRACT
int GL_BLEND_DST_RGB
int GL_BLEND_SRC_RGB
int GL_BLEND_DST_ALPHA
int GL_BLEND_SRC_ALPHA
int GL_ANT_COLOR
int GL_ONE_MINUS_ANT_COLOR
int GL_ANT_ALPHA
int GL_ONE_MINUS_ANT_ALPHA
int GL_BLEND_COLOR
int GL_ARRAY_BUFFER
int GL_ELEMENT_ARRAY_BUFFER
int GL_ARRAY_BUFFER_BINDING
int GL_ELEMENT_ARRAY_BUFFER_BINDING
int GL_STREAM_DRAW
int GL_STATIC_DRAW
int GL_DYNAMIC_DRAW
int GL_BUFFER_SIZE
int GL_BUFFER_USAGE
int GL_CURRENT_VERTEX_ATTRIB
int GL_FRONT
int GL_BACK
int GL_FRONT_AND_BACK
int GL_TEXTURE_2D
int GL_CULL_FACE
int GL_BLEND
int GL_DITHER
int GL_STENCIL_TEST
int GL_DEPTH_TEST
int GL_SCISSOR_TEST
int GL_POLYGON_OFFSET_FILL
int GL_SAMPLE_ALPHA_TO_COVERAGE
int GL_SAMPLE_COVERAGE
int GL_NO_ERROR
int GL_INVALID_ENUM
int GL_INVALID_VALUE
int GL_INVALID_OPERATION
int GL_OUT_OF_MEMORY
int GL_CW
int GL_CCW
int GL_LINE_WIDTH
int GL_ALIASED_POINT_SIZE_RANGE
int GL_ALIASED_LINE_WIDTH_RANGE
int GL_CULL_FACE_MODE
int GL_FRONT_FACE
int GL_DEPTH_RANGE
int GL_DEPTH_WRITEMASK
int GL_DEPTH_CLEAR_VALUE
int GL_DEPTH_FUNC
int GL_STENCIL_CLEAR_VALUE
int GL_STENCIL_FUNC
int GL_STENCIL_FAIL
int GL_STENCIL_PASS_DEPTH_FAIL
int GL_STENCIL_PASS_DEPTH_PASS
int GL_STENCIL_REF
int GL_STENCIL_VALUE_MASK
int GL_STENCIL_WRITEMASK
int GL_STENCIL_BACK_FUNC
int GL_STENCIL_BACK_FAIL
int GL_STENCIL_BACK_PASS_DEPTH_FAIL
int GL_STENCIL_BACK_PASS_DEPTH_PASS
int GL_STENCIL_BACK_REF
int GL_STENCIL_BACK_VALUE_MASK
int GL_STENCIL_BACK_WRITEMASK
int GL_VIEWPORT
int GL_SCISSOR_BOX
int GL_COLOR_CLEAR_VALUE
int GL_COLOR_WRITEMASK
int GL_UNPACK_ALIGNMENT
int GL_PACK_ALIGNMENT
int GL_MAX_TEXTURE_SIZE
int GL_MAX_VIEWPORT_DIMS
int GL_SUBPIXEL_BITS
int GL_RED_BITS
int GL_GREEN_BITS
int GL_BLUE_BITS
int GL_ALPHA_BITS
int GL_DEPTH_BITS
int GL_STENCIL_BITS
int GL_POLYGON_OFFSET_UNITS
int GL_POLYGON_OFFSET_FACTOR
int GL_TEXTURE_BINDING_2D
int GL_SAMPLE_BUFFERS
int GL_SAMPLES
int GL_SAMPLE_COVERAGE_VALUE
int GL_SAMPLE_COVERAGE_INVERT
int GL_NUM_COMPRESSED_TEXTURE_FORMATS
int GL_COMPRESSED_TEXTURE_FORMATS
int GL_DONT_CARE
int GL_FASTEST
int GL_NICEST
int GL_GENERATE_MIPMAP_HINT
int GL_BYTE
int GL_UNSIGNED_BYTE
int GL_SHORT
int GL_UNSIGNED_SHORT
int GL_INT
int GL_UNSIGNED_INT
int GL_FLOAT
int GL_DEPTH_COMPONENT
int GL_ALPHA
int GL_RGB
int GL_RGBA
int GL_LUMINANCE
int GL_LUMINANCE_ALPHA
int GL_UNSIGNED_SHORT_4_4_4_4
int GL_UNSIGNED_SHORT_5_5_5_1
int GL_UNSIGNED_SHORT_5_6_5
int GL_FRAGMENT_SHADER
int GL_VERTEX_SHADER
int GL_MAX_VERTEX_ATTRIBS
int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS
int GL_MAX_TEXTURE_IMAGE_UNITS
int GL_SHADER_TYPE
int GL_DELETE_STATUS
int GL_LINK_STATUS
int GL_VALIDATE_STATUS
int GL_ATTACHED_SHADERS
int GL_ACTIVE_UNIFORMS
int GL_ACTIVE_UNIFORM_MAX_LENGTH
int GL_ACTIVE_ATTRIBUTES
int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
int GL_SHADING_LANGUAGE_VERSION
int GL_CURRENT_PROGRAM
int GL_NEVER
int GL_LESS
int GL_EQUAL
int GL_LEQUAL
int GL_GREATER
int GL_NOTEQUAL
int GL_GEQUAL
int GL_ALWAYS
int GL_KEEP
int GL_REPLACE
int GL_INCR
int GL_DECR
int GL_INVERT
int GL_INCR_WRAP
int GL_DECR_WRAP
int GL_VENDOR
int GL_RENDERER
int GL_VERSION
int GL_EXTENSIONS
int GL_NEAREST
int GL_LINEAR
int GL_NEAREST_MIPMAP_NEAREST
int GL_LINEAR_MIPMAP_NEAREST
int GL_NEAREST_MIPMAP_LINEAR
int GL_LINEAR_MIPMAP_LINEAR
int GL_TEXTURE_MAG_FILTER
int GL_TEXTURE_MIN_FILTER
int GL_TEXTURE_WRAP_S
int GL_TEXTURE_WRAP_T
int GL_TEXTURE
int GL_TEXTURE_CUBE_MAP
int GL_TEXTURE_BINDING_CUBE_MAP
int GL_TEXTURE_CUBE_MAP_POSITIVE_X
int GL_TEXTURE_CUBE_MAP_NEGATIVE_X
int GL_TEXTURE_CUBE_MAP_POSITIVE_Y
int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
int GL_TEXTURE_CUBE_MAP_POSITIVE_Z
int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
int GL_MAX_CUBE_MAP_TEXTURE_SIZE
int GL_TEXTURE0
int GL_TEXTURE1
int GL_TEXTURE2
int GL_TEXTURE3
int GL_TEXTURE4
int GL_TEXTURE5
int GL_TEXTURE6
int GL_TEXTURE7
int GL_TEXTURE8
int GL_TEXTURE9
int GL_TEXTURE10
int GL_TEXTURE11
int GL_TEXTURE12
int GL_TEXTURE13
int GL_TEXTURE14
int GL_TEXTURE15
int GL_TEXTURE16
int GL_TEXTURE17
int GL_TEXTURE18
int GL_TEXTURE19
int GL_TEXTURE20
int GL_TEXTURE21
int GL_TEXTURE22
int GL_TEXTURE23
int GL_TEXTURE24
int GL_TEXTURE25
int GL_TEXTURE26
int GL_TEXTURE27
int GL_TEXTURE28
int GL_TEXTURE29
int GL_TEXTURE30
int GL_TEXTURE31
int GL_ACTIVE_TEXTURE
int GL_REPEAT
int GL_CLAMP_TO_EDGE
int GL_MIRRORED_REPEAT
int GL_FLOAT_VEC2
int GL_FLOAT_VEC3
int GL_FLOAT_VEC4
int GL_INT_VEC2
int GL_INT_VEC3
int GL_INT_VEC4
int GL_BOOL
int GL_BOOL_VEC2
int GL_BOOL_VEC3
int GL_BOOL_VEC4
int GL_FLOAT_MAT2
int GL_FLOAT_MAT3
int GL_FLOAT_MAT4
int GL_SAMPLER_2D
int GL_SAMPLER_CUBE
int GL_VERTEX_ATTRIB_ARRAY_ENABLED
int GL_VERTEX_ATTRIB_ARRAY_SIZE
int GL_VERTEX_ATTRIB_ARRAY_STRIDE
int GL_VERTEX_ATTRIB_ARRAY_TYPE
int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
int GL_VERTEX_ATTRIB_ARRAY_POINTER
int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
int GL_COMPILE_STATUS
int GL_INFO_LOG_LENGTH
int GL_SHADER_SOURCE_LENGTH
int GL_SHADER_BINARY_FORMATS
int GL_FRAMEBUFFER
int GL_RENDERBUFFER
int GL_RGBA4
int GL_RGB5_A1
int GL_RGB565
int GL_DEPTH_COMPONENT16
int GL_STENCIL_INDEX8
int GL_DEPTH24_STENCIL8_OES
int GL_RENDERBUFFER_WIDTH
int GL_RENDERBUFFER_HEIGHT
int GL_RENDERBUFFER_INTERNAL_FORMAT
int GL_RENDERBUFFER_RED_SIZE
int GL_RENDERBUFFER_GREEN_SIZE
int GL_RENDERBUFFER_BLUE_SIZE
int GL_RENDERBUFFER_ALPHA_SIZE
int GL_RENDERBUFFER_DEPTH_SIZE
int GL_RENDERBUFFER_STENCIL_SIZE
int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
int GL_COLOR_ATTACHMENT0
int GL_DEPTH_ATTACHMENT
int GL_STENCIL_ATTACHMENT
int GL_NONE
int GL_FRAMEBUFFER_COMPLETE
int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
int GL_FRAMEBUFFER_UNSUPPORTED
int GL_FRAMEBUFFER_BINDING
int GL_RENDERBUFFER_BINDING
int GL_MAX_RENDERBUFFER_SIZE
int GL_INVALID_FRAMEBUFFER_OPERATION
int GL_FIXED
int GL_MAX_VERTEX_UNIFORM_VECTORS
int GL_MAX_VARYING_VECTORS
int GL_MAX_FRAGMENT_UNIFORM_VECTORS
int GL_IMPLEMENTATION_COLOR_READ_TYPE
int GL_IMPLEMENTATION_COLOR_READ_FORMAT
int GL_SHADER_COMPILER
int GL_NUM_SHADER_BINARY_FORMATS
int GL_LOW_FLOAT
int GL_MEDIUM_FLOAT
int GL_HIGH_FLOAT
int GL_LOW_INT
int GL_MEDIUM_INT
int GL_HIGH_INT
int GL_FRAMEBUFFER_UNDEFINED_OES
ctypedef const GLubyte* (__stdcall *GLGETSTRINGPTR)(GLenum) nogil
ctypedef GLboolean (__stdcall *GLISBUFFERPTR)(GLuint buffer) nogil
ctypedef GLboolean (__stdcall *GLISENABLEDPTR)(GLenum cap) nogil
ctypedef GLboolean (__stdcall *GLISFRAMEBUFFERPTR)(GLuint framebuffer) nogil
ctypedef GLboolean (__stdcall *GLISPROGRAMPTR)(GLuint program) nogil
ctypedef GLboolean (__stdcall *GLISRENDERBUFFERPTR)(GLuint renderbuffer) nogil
ctypedef GLboolean (__stdcall *GLISSHADERPTR)(GLuint shader) nogil
ctypedef GLboolean (__stdcall *GLISTEXTUREPTR)(GLuint texture) nogil
ctypedef GLenum (__stdcall *GLCHECKFRAMEBUFFERSTATUSPTR)(GLenum) nogil
ctypedef GLenum (__stdcall *GLGETERRORPTR)() nogil
ctypedef GLint (__stdcall *GLGETATTRIBLOCATIONPTR)(GLuint, const GLchar *) nogil
ctypedef GLint (__stdcall *GLGETUNIFORMLOCATIONPTR)(GLuint, const char *) nogil
ctypedef GLuint (__stdcall *GLCREATEPROGRAMPTR)() nogil
ctypedef GLuint (__stdcall *GLCREATESHADERPTR)(GLenum) nogil
ctypedef void (__stdcall *GLACTIVETEXTUREPTR)(GLenum) nogil
ctypedef void (__stdcall *GLATTACHSHADERPTR)(GLuint, GLuint) nogil
ctypedef void (__stdcall *GLBINDATTRIBLOCATIONPTR)(GLuint, GLuint, const char *) nogil
ctypedef void (__stdcall *GLBINDBUFFERPTR)(GLenum, GLuint) nogil
ctypedef void (__stdcall *GLBINDFRAMEBUFFERPTR)(GLenum, GLuint) nogil
ctypedef void (__stdcall *GLBINDRENDERBUFFERPTR)(GLenum target, GLuint renderbuffer) nogil
ctypedef void (__stdcall *GLBINDTEXTUREPTR)(GLenum, GLuint) nogil
ctypedef void (__stdcall *GLBLENDCOLORPTR)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) nogil
ctypedef void (__stdcall *GLBLENDEQUATIONPTR)( GLenum mode ) nogil
ctypedef void (__stdcall *GLBLENDEQUATIONSEPARATEPTR)(GLenum modeRGB, GLenum modeAlpha) nogil
ctypedef void (__stdcall *GLBLENDFUNCPTR)(GLenum sfactor, GLenum dfactor) nogil
ctypedef void (__stdcall *GLBLENDFUNCSEPARATEPTR)(GLenum, GLenum, GLenum, GLenum) nogil
ctypedef void (__stdcall *GLBUFFERDATAPTR)(GLenum, GLsizeiptr, const GLvoid *, GLenum) nogil
ctypedef void (__stdcall *GLBUFFERSUBDATAPTR)(GLenum, GLintptr, GLsizeiptr, const GLvoid *) nogil
ctypedef void (__stdcall *GLCLEARCOLORPTR)(GLclampf, GLclampf, GLclampf, GLclampf) nogil
ctypedef void (__stdcall *GLCLEARPTR)(GLbitfield) nogil
ctypedef void (__stdcall *GLCLEARSTENCILPTR)(GLint s) nogil
ctypedef void (__stdcall *GLCOLORMASKPTR)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) nogil
ctypedef void (__stdcall *GLCOMPILESHADERPTR)(GLuint) nogil
ctypedef void (__stdcall *GLCOMPRESSEDTEXIMAGE2DPTR)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) nogil
ctypedef void (__stdcall *GLCOMPRESSEDTEXSUBIMAGE2DPTR)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) nogil
ctypedef void (__stdcall *GLCOPYTEXIMAGE2DPTR)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) nogil
ctypedef void (__stdcall *GLCOPYTEXSUBIMAGE2DPTR)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) nogil
ctypedef void (__stdcall *GLCULLFACEPTR)(GLenum mode) nogil
ctypedef void (__stdcall *GLDELETEBUFFERSPTR)(GLsizei n, const GLuint* buffers) nogil
ctypedef void (__stdcall *GLDELETEFRAMEBUFFERSPTR)(GLsizei, const GLuint *) nogil
ctypedef void (__stdcall *GLDELETEPROGRAMPTR)(GLuint) nogil
ctypedef void (__stdcall *GLDELETERENDERBUFFERSPTR)(GLsizei n, const GLuint* renderbuffers) nogil
ctypedef void (__stdcall *GLDELETESHADERPTR)(GLuint) nogil
ctypedef void (__stdcall *GLDELETETEXTURESPTR)(GLsizei, const GLuint *) nogil
ctypedef void (__stdcall *GLDEPTHFUNCPTR)(GLenum func) nogil
ctypedef void (__stdcall *GLDEPTHMASKPTR)(GLboolean flag) nogil
ctypedef void (__stdcall *GLDETACHSHADERPTR)(GLuint program, GLuint shader) nogil
ctypedef void (__stdcall *GLDISABLEPTR)(GLenum) nogil
ctypedef void (__stdcall *GLDISABLEVERTEXATTRIBARRAYPTR)(GLuint) nogil
ctypedef void (__stdcall *GLDRAWARRAYSPTR)(GLenum, GLint, GLsizei) nogil
ctypedef void (__stdcall *GLDRAWELEMENTSPTR)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) nogil
ctypedef void (__stdcall *GLENABLEPTR)(GLenum) nogil
ctypedef void (__stdcall *GLENABLEVERTEXATTRIBARRAYPTR)(GLuint) nogil
ctypedef void (__stdcall *GLFINISHPTR)() nogil
ctypedef void (__stdcall *GLFLUSHPTR)() nogil
ctypedef void (__stdcall *GLFRAMEBUFFERRENDERBUFFERPTR)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) nogil
ctypedef void (__stdcall *GLFRAMEBUFFERTEXTURE2DPTR)(GLenum, GLenum, GLenum, GLuint, GLint) nogil
ctypedef void (__stdcall *GLFRONTFACEPTR)(GLenum mode) nogil
ctypedef void (__stdcall *GLGENBUFFERSPTR)(GLsizei, GLuint *) nogil
ctypedef void (__stdcall *GLGENERATEMIPMAPPTR)(GLenum target) nogil
ctypedef void (__stdcall *GLGENFRAMEBUFFERSPTR)(GLsizei, GLuint *) nogil
ctypedef void (__stdcall *GLGENRENDERBUFFERSPTR)(GLsizei n, GLuint* renderbuffers) nogil
ctypedef void (__stdcall *GLGENTEXTURESPTR)(GLsizei, GLuint *) nogil
ctypedef void (__stdcall *GLGETACTIVEATTRIBPTR)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) nogil
ctypedef void (__stdcall *GLGETACTIVEUNIFORMPTR)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) nogil
ctypedef void (__stdcall *GLGETATTACHEDSHADERSPTR)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) nogil
ctypedef void (__stdcall *GLGETBOOLEANVPTR)(GLenum, GLboolean *) nogil
ctypedef void (__stdcall *GLGETBUFFERPARAMETERIVPTR)(GLenum target, GLenum pname, GLint* params) nogil
ctypedef void (__stdcall *GLGETFLOATVPTR)(GLenum pname, GLfloat* params) nogil
ctypedef void (__stdcall *GLGETFRAMEBUFFERATTACHMENTPARAMETERIVPTR)(GLenum target, GLenum attachment, GLenum pname, GLint* params) nogil
ctypedef void (__stdcall *GLGETINTEGERVPTR)(GLenum, GLint *) nogil
ctypedef void (__stdcall *GLGETPROGRAMINFOLOGPTR)(GLuint, GLsizei, GLsizei*, GLchar*) nogil
ctypedef void (__stdcall *GLGETPROGRAMIVPTR)(GLuint, GLenum, GLint *) nogil
ctypedef void (__stdcall *GLGETRENDERBUFFERPARAMETERIVPTR)(GLenum target, GLenum pname, GLint* params) nogil
ctypedef void (__stdcall *GLGETSHADERINFOLOGPTR)(GLuint, GLsizei, GLsizei *, char *) nogil
ctypedef void (__stdcall *GLGETSHADERIVPTR)(GLuint, GLenum, GLint *) nogil
ctypedef void (__stdcall *GLGETSHADERSOURCEPTR)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) nogil
ctypedef void (__stdcall *GLGETTEXPARAMETERFVPTR)(GLenum target, GLenum pname, GLfloat* params) nogil
ctypedef void (__stdcall *GLGETTEXPARAMETERIVPTR)(GLenum target, GLenum pname, GLint* params) nogil
ctypedef void (__stdcall *GLGETUNIFORMFVPTR)(GLuint program, GLint location, GLfloat* params) nogil
ctypedef void (__stdcall *GLGETUNIFORMIVPTR)(GLuint program, GLint location, GLint* params) nogil
ctypedef void (__stdcall *GLGETVERTEXATTRIBFVPTR)(GLuint index, GLenum pname, GLfloat* params) nogil
ctypedef void (__stdcall *GLGETVERTEXATTRIBIVPTR)(GLuint index, GLenum pname, GLint* params) nogil
ctypedef void (__stdcall *GLHINTPTR)(GLenum target, GLenum mode) nogil
ctypedef void (__stdcall *GLLINEWIDTHPTR)(GLfloat width) nogil
ctypedef void (__stdcall *GLLINKPROGRAMPTR)(GLuint) nogil
ctypedef void (__stdcall *GLPIXELSTOREIPTR)(GLenum, GLint) nogil
ctypedef void (__stdcall *GLPOLYGONOFFSETPTR)(GLfloat factor, GLfloat units) nogil
ctypedef void (__stdcall *GLREADPIXELSPTR)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*) nogil
ctypedef void (__stdcall *GLRENDERBUFFERSTORAGEPTR)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) nogil
ctypedef void (__stdcall *GLSAMPLECOVERAGEPTR)(GLclampf value, GLboolean invert) nogil
ctypedef void (__stdcall *GLSCISSORPTR)(GLint, GLint, GLsizei, GLsizei) nogil
ctypedef void (__stdcall *GLSHADERBINARYPTR)(GLsizei, const GLuint *, GLenum, const void *, GLsizei) nogil
ctypedef void (__stdcall *GLSHADERSOURCEPTR)(GLuint, GLsizei, const GLchar**, const GLint *) nogil
ctypedef void (__stdcall *GLSTENCILFUNCPTR)(GLenum func, GLint ref, GLuint mask) nogil
ctypedef void (__stdcall *GLSTENCILFUNCSEPARATEPTR)(GLenum face, GLenum func, GLint ref, GLuint mask) nogil
ctypedef void (__stdcall *GLSTENCILMASKPTR)(GLuint mask) nogil
ctypedef void (__stdcall *GLSTENCILMASKSEPARATEPTR)(GLenum face, GLuint mask) nogil
ctypedef void (__stdcall *GLSTENCILOPPTR)(GLenum fail, GLenum zfail, GLenum zpass) nogil
ctypedef void (__stdcall *GLSTENCILOPSEPARATEPTR)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) nogil
ctypedef void (__stdcall *GLTEXIMAGE2DPTR)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) nogil
ctypedef void (__stdcall *GLTEXPARAMETERFPTR)(GLenum target, GLenum pname, GLfloat param) nogil
ctypedef void (__stdcall *GLTEXPARAMETERIPTR)(GLenum, GLenum, GLint) nogil
ctypedef void (__stdcall *GLTEXSUBIMAGE2DPTR)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) nogil
ctypedef void (__stdcall *GLUNIFORM1FPTR)(GLint location, GLfloat x) nogil
ctypedef void (__stdcall *GLUNIFORM1FVPTR)(GLint location, GLsizei count, const GLfloat* v) nogil
ctypedef void (__stdcall *GLUNIFORM1IPTR)(GLint, GLint) nogil
ctypedef void (__stdcall *GLUNIFORM1IVPTR)(GLint location, GLsizei count, const GLint* v) nogil
ctypedef void (__stdcall *GLUNIFORM2FPTR)(GLint location, GLfloat x, GLfloat y) nogil
ctypedef void (__stdcall *GLUNIFORM2FVPTR)(GLint location, GLsizei count, const GLfloat* v) nogil
ctypedef void (__stdcall *GLUNIFORM2IPTR)(GLint location, GLint x, GLint y) nogil
ctypedef void (__stdcall *GLUNIFORM2IVPTR)(GLint location, GLsizei count, const GLint* v) nogil
ctypedef void (__stdcall *GLUNIFORM3FPTR)(GLint location, GLfloat x, GLfloat y, GLfloat z) nogil
ctypedef void (__stdcall *GLUNIFORM3FVPTR)(GLint location, GLsizei count, const GLfloat* v) nogil
ctypedef void (__stdcall *GLUNIFORM3IPTR)(GLint location, GLint x, GLint y, GLint z) nogil
ctypedef void (__stdcall *GLUNIFORM3IVPTR)(GLint location, GLsizei count, const GLint* v) nogil
ctypedef void (__stdcall *GLUNIFORM4FPTR)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) nogil
ctypedef void (__stdcall *GLUNIFORM4FVPTR)(GLint location, GLsizei count, const GLfloat* v) nogil
ctypedef void (__stdcall *GLUNIFORM4IPTR)(GLint location, GLint x, GLint y, GLint z, GLint w) nogil
ctypedef void (__stdcall *GLUNIFORM4IVPTR)(GLint location, GLsizei count, const GLint* v) nogil
ctypedef void (__stdcall *GLUNIFORMMATRIX4FVPTR)(GLint, GLsizei, GLboolean, const GLfloat *) nogil
ctypedef void (__stdcall *GLUSEPROGRAMPTR)(GLuint) nogil
ctypedef void (__stdcall *GLVALIDATEPROGRAMPTR)(GLuint program) nogil
ctypedef void (__stdcall *GLVERTEXATTRIB1FPTR)(GLuint indx, GLfloat x) nogil
ctypedef void (__stdcall *GLVERTEXATTRIB2FPTR)(GLuint indx, GLfloat x, GLfloat y) nogil
ctypedef void (__stdcall *GLVERTEXATTRIB3FPTR)(GLuint indx, GLfloat x, GLfloat y, GLfloat z) nogil
ctypedef void (__stdcall *GLVERTEXATTRIB4FPTR)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) nogil
ctypedef void (__stdcall *GLVERTEXATTRIBPOINTERPTR)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) nogil
ctypedef void (__stdcall *GLVIEWPORTPTR)(GLint, GLint, GLsizei, GLsizei) nogil
ctypedef struct GLES2_Context:
const GLubyte* (__stdcall *glGetString)(GLenum) nogil
GLboolean (__stdcall *glIsBuffer)(GLuint buffer) nogil
GLboolean (__stdcall *glIsEnabled)(GLenum cap) nogil
GLboolean (__stdcall *glIsFramebuffer)(GLuint framebuffer) nogil
GLboolean (__stdcall *glIsProgram)(GLuint program) nogil
GLboolean (__stdcall *glIsRenderbuffer)(GLuint renderbuffer) nogil
GLboolean (__stdcall *glIsShader)(GLuint shader) nogil
GLboolean (__stdcall *glIsTexture)(GLuint texture) nogil
GLenum (__stdcall *glCheckFramebufferStatus)(GLenum) nogil
GLenum (__stdcall *glGetError)() nogil
GLint (__stdcall *glGetAttribLocation)(GLuint, const GLchar *) nogil
GLint (__stdcall *glGetUniformLocation)(GLuint, const char *) nogil
GLuint (__stdcall *glCreateProgram)() nogil
GLuint (__stdcall *glCreateShader)(GLenum) nogil
void (__stdcall *glActiveTexture)(GLenum) nogil
void (__stdcall *glAttachShader)(GLuint, GLuint) nogil
void (__stdcall *glBindAttribLocation)(GLuint, GLuint, const char *) nogil
void (__stdcall *glBindBuffer)(GLenum, GLuint) nogil
void (__stdcall *glBindFramebuffer)(GLenum, GLuint) nogil
void (__stdcall *glBindRenderbuffer)(GLenum target, GLuint renderbuffer) nogil
void (__stdcall *glBindTexture)(GLenum, GLuint) nogil
void (__stdcall *glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) nogil
void (__stdcall *glBlendEquation)( GLenum mode ) nogil
void (__stdcall *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) nogil
void (__stdcall *glBlendFunc)(GLenum sfactor, GLenum dfactor) nogil
void (__stdcall *glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) nogil
void (__stdcall *glBufferData)(GLenum, GLsizeiptr, const GLvoid *, GLenum) nogil
void (__stdcall *glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid *) nogil
void (__stdcall *glClear)(GLbitfield) nogil
void (__stdcall *glClearColor)(GLclampf, GLclampf, GLclampf, GLclampf) nogil
void (__stdcall *glClearStencil)(GLint s) nogil
void (__stdcall *glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) nogil
void (__stdcall *glCompileShader)(GLuint) nogil
void (__stdcall *glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) nogil
void (__stdcall *glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) nogil
void (__stdcall *glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) nogil
void (__stdcall *glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) nogil
void (__stdcall *glCullFace)(GLenum mode) nogil
void (__stdcall *glDeleteBuffers)(GLsizei n, const GLuint* buffers) nogil
void (__stdcall *glDeleteFramebuffers)(GLsizei, const GLuint *) nogil
void (__stdcall *glDeleteProgram)(GLuint) nogil
void (__stdcall *glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers) nogil
void (__stdcall *glDeleteShader)(GLuint) nogil
void (__stdcall *glDeleteTextures)(GLsizei, const GLuint *) nogil
void (__stdcall *glDepthFunc)(GLenum func) nogil
void (__stdcall *glDepthMask)(GLboolean flag) nogil
void (__stdcall *glDetachShader)(GLuint program, GLuint shader) nogil
void (__stdcall *glDisable)(GLenum) nogil
void (__stdcall *glDisableVertexAttribArray)(GLuint) nogil
void (__stdcall *glDrawArrays)(GLenum, GLint, GLsizei) nogil
void (__stdcall *glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) nogil
void (__stdcall *glEnable)(GLenum) nogil
void (__stdcall *glEnableVertexAttribArray)(GLuint) nogil
void (__stdcall *glFinish)() nogil
void (__stdcall *glFlush)() nogil
void (__stdcall *glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) nogil
void (__stdcall *glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint) nogil
void (__stdcall *glFrontFace)(GLenum mode) nogil
void (__stdcall *glGenBuffers)(GLsizei, GLuint *) nogil
void (__stdcall *glGenerateMipmap)(GLenum target) nogil
void (__stdcall *glGenFramebuffers)(GLsizei, GLuint *) nogil
void (__stdcall *glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers) nogil
void (__stdcall *glGenTextures)(GLsizei, GLuint *) nogil
void (__stdcall *glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) nogil
void (__stdcall *glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) nogil
void (__stdcall *glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) nogil
void (__stdcall *glGetBooleanv)(GLenum, GLboolean *) nogil
void (__stdcall *glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params) nogil
void (__stdcall *glGetFloatv)(GLenum pname, GLfloat* params) nogil
void (__stdcall *glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params) nogil
void (__stdcall *glGetIntegerv)(GLenum, GLint *) nogil
void (__stdcall *glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*) nogil
void (__stdcall *glGetProgramiv)(GLuint, GLenum, GLint *) nogil
void (__stdcall *glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params) nogil
void (__stdcall *glGetShaderInfoLog)(GLuint, GLsizei, GLsizei *, char *) nogil
void (__stdcall *glGetShaderiv)(GLuint, GLenum, GLint *) nogil
void (__stdcall *glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) nogil
void (__stdcall *glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params) nogil
void (__stdcall *glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params) nogil
void (__stdcall *glGetUniformfv)(GLuint program, GLint location, GLfloat* params) nogil
void (__stdcall *glGetUniformiv)(GLuint program, GLint location, GLint* params) nogil
void (__stdcall *glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) nogil
void (__stdcall *glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params) nogil
void (__stdcall *glHint)(GLenum target, GLenum mode) nogil
void (__stdcall *glLineWidth)(GLfloat width) nogil
void (__stdcall *glLinkProgram)(GLuint) nogil
void (__stdcall *glPixelStorei)(GLenum, GLint) nogil
void (__stdcall *glPolygonOffset)(GLfloat factor, GLfloat units) nogil
void (__stdcall *glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*) nogil
void (__stdcall *glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) nogil
void (__stdcall *glSampleCoverage)(GLclampf value, GLboolean invert) nogil
void (__stdcall *glScissor)(GLint, GLint, GLsizei, GLsizei) nogil
void (__stdcall *glShaderBinary)(GLsizei, const GLuint *, GLenum, const void *, GLsizei) nogil
void (__stdcall *glShaderSource)(GLuint, GLsizei, const GLchar**, const GLint *) nogil
void (__stdcall *glStencilFunc)(GLenum func, GLint ref, GLuint mask) nogil
void (__stdcall *glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) nogil
void (__stdcall *glStencilMask)(GLuint mask) nogil
void (__stdcall *glStencilMaskSeparate)(GLenum face, GLuint mask) nogil
void (__stdcall *glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) nogil
void (__stdcall *glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) nogil
void (__stdcall *glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) nogil
void (__stdcall *glTexParameterf)(GLenum target, GLenum pname, GLfloat param) nogil
void (__stdcall *glTexParameteri)(GLenum, GLenum, GLint) nogil
void (__stdcall *glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) nogil
void (__stdcall *glUniform1f)(GLint location, GLfloat x) nogil
void (__stdcall *glUniform1fv)(GLint location, GLsizei count, const GLfloat* v) nogil
void (__stdcall *glUniform1i)(GLint, GLint) nogil
void (__stdcall *glUniform1iv)(GLint location, GLsizei count, const GLint* v) nogil
void (__stdcall *glUniform2f)(GLint location, GLfloat x, GLfloat y) nogil
void (__stdcall *glUniform2fv)(GLint location, GLsizei count, const GLfloat* v) nogil
void (__stdcall *glUniform2i)(GLint location, GLint x, GLint y) nogil
void (__stdcall *glUniform2iv)(GLint location, GLsizei count, const GLint* v) nogil
void (__stdcall *glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z) nogil
void (__stdcall *glUniform3fv)(GLint location, GLsizei count, const GLfloat* v) nogil
void (__stdcall *glUniform3i)(GLint location, GLint x, GLint y, GLint z) nogil
void (__stdcall *glUniform3iv)(GLint location, GLsizei count, const GLint* v) nogil
void (__stdcall *glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) nogil
void (__stdcall *glUniform4fv)(GLint location, GLsizei count, const GLfloat* v) nogil
void (__stdcall *glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w) nogil
void (__stdcall *glUniform4iv)(GLint location, GLsizei count, const GLint* v) nogil
void (__stdcall *glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat *) nogil
void (__stdcall *glUseProgram)(GLuint) nogil
void (__stdcall *glValidateProgram)(GLuint program) nogil
void (__stdcall *glVertexAttrib1f)(GLuint indx, GLfloat x) nogil
void (__stdcall *glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y) nogil
void (__stdcall *glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z) nogil
void (__stdcall *glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) nogil
void (__stdcall *glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) nogil
void (__stdcall *glViewport)(GLint, GLint, GLsizei, GLsizei) nogil
cdef GLES2_Context *cgl
cdef int kivy_opengl_es2
cdef unsigned long initialized_tid
cdef public int verify_gl_main_thread
cpdef cgl_init(allowed=*, ignored=*)
cdef GLES2_Context *cgl_get_context()
cdef void cgl_set_context(GLES2_Context* ctx)
cpdef cgl_get_backend_name(allowed=*, ignored=*)
cpdef cgl_get_initialized_backend_name()

View file

@ -0,0 +1,32 @@
#
# Common definition
#
DEF PI2 = 1.5707963267948966
DEF PI = 3.1415926535897931
cdef extern from *:
ctypedef char* const_char_ptr "const char*"
cdef double pi = PI
cdef extern from "math.h":
double cos(double) nogil
double acos(double) nogil
double sin(double) nogil
double sqrt(double) nogil
double pow(double x, double y) nogil
double atan2(double y, double x) nogil
double tan(double) nogil
double fabs(double) nogil
cdef extern from "stdlib.h":
ctypedef unsigned long size_t
void free(void *ptr) nogil
void *realloc(void *ptr, size_t size) nogil
void *malloc(size_t size) nogil
void *calloc(size_t nmemb, size_t size) nogil
cdef extern from "string.h":
void *memcpy(void *dest, void *src, size_t n) nogil
void *memset(void *dest, int c, size_t len)

View file

@ -0,0 +1,6 @@
cdef class GraphicsCompiler
from .instructions cimport InstructionGroup
cdef class GraphicsCompiler:
cdef InstructionGroup compile(self, InstructionGroup group)

View file

@ -0,0 +1,36 @@
from kivy.graphics.instructions cimport Instruction, Canvas
from kivy.graphics.texture cimport Texture
from kivy.graphics.vbo cimport VBO, VertexBatch
from kivy.graphics.shader cimport Shader
from kivy.graphics.fbo cimport Fbo
cdef class Context:
cdef list observers
cdef list observers_before
cdef list l_texture
cdef list l_canvas
cdef list l_fbo
cdef object lr_texture
cdef list lr_canvas
cdef object lr_vbo
cdef object lr_fbo_rb
cdef object lr_fbo_fb
cdef object lr_shadersource
cdef list lr_shader
cdef void register_texture(self, Texture texture)
cdef void register_canvas(self, Canvas canvas)
cdef void register_fbo(self, Fbo fbo)
cdef void dealloc_texture(self, Texture texture)
cdef void dealloc_vbo(self, VBO vbo)
cdef void dealloc_vertexbatch(self, VertexBatch vbo)
cdef void dealloc_shader(self, Shader shader)
cdef void dealloc_shader_source(self, int shader)
cdef void dealloc_fbo(self, Fbo fbo)
cdef object trigger_gl_dealloc
cpdef void flush(self)
cpdef Context get_context()

View file

@ -0,0 +1,77 @@
cdef class LineWidth
cdef class Color
cdef class BindTexture
from .transformation cimport Matrix
from .instructions cimport ContextInstruction
from .texture cimport Texture
cdef class PushState(ContextInstruction):
pass
cdef class ChangeState(ContextInstruction):
pass
cdef class PopState(ContextInstruction):
pass
cdef class LineWidth(ContextInstruction):
cdef int apply(self) except -1
cdef class Color(ContextInstruction):
cdef int apply(self) except -1
cdef class BindTexture(ContextInstruction):
cdef int _index
cdef object _source
cdef Texture _texture
cdef int apply(self) except -1
cdef class LoadIdentity(ContextInstruction):
pass
cdef class PushMatrix(ContextInstruction):
cdef int apply(self) except -1
cdef class PopMatrix(ContextInstruction):
cdef int apply(self) except -1
cdef class ApplyContextMatrix(ContextInstruction):
cdef object _target_stack
cdef object _source_stack
cdef int apply(self) except -1
cdef class UpdateNormalMatrix(ContextInstruction):
cdef int apply(self) except -1
cdef class MatrixInstruction(ContextInstruction):
cdef object _stack
cdef Matrix _matrix
cdef int apply(self) except -1
cdef class Transform(MatrixInstruction):
cpdef transform(self, Matrix trans)
cpdef translate(self, float tx, float ty, float tz)
cpdef rotate(self, float angle, float ax, float ay, float az)
cpdef scale(self, float s)
cpdef identity(self)
cdef class Rotate(Transform):
cdef float _angle
cdef tuple _axis
cdef tuple _origin
cdef int apply(self) except -1
cdef void compute(self)
cdef class Scale(Transform):
cdef tuple _origin
cdef double _x, _y, _z
cdef int apply(self) except -1
cdef set_scale(self, double x, double y, double z)
cdef class Translate(Transform):
cdef double _x, _y, _z
cdef int apply(self) except -1
cdef set_translate(self, double x, double y, double z)

View file

@ -0,0 +1,31 @@
from kivy.graphics.cgl cimport GLuint, GLint
from kivy.graphics.instructions cimport RenderContext, Canvas
from kivy.graphics.texture cimport Texture
cdef class Fbo(RenderContext):
cdef int _width
cdef int _height
cdef int _depthbuffer_attached
cdef int _stencilbuffer_attached
cdef int _push_viewport
cdef float _clear_color[4]
cdef GLuint buffer_id
cdef GLuint depthbuffer_id
cdef GLuint stencilbuffer_id
cdef GLint _viewport[4]
cdef Texture _texture
cdef int _is_bound
cdef object _stencil_state
cdef list observers
cpdef clear_buffer(self)
cpdef bind(self)
cpdef release(self)
cpdef get_pixel_color(self, int wx, int wy)
cdef void create_fbo(self)
cdef void delete_fbo(self)
cdef int apply(self) except -1
cdef void raise_exception(self, str message, int status=?)
cdef str resolve_status(self, int status)
cdef void reload(self) except *

View file

@ -0,0 +1,13 @@
from kivy.logger import Logger
include "../include/config.pxi"
from kivy.graphics.cgl cimport cgl
import os
cdef int env_debug_gl = "DEBUG_GL" in os.environ
cdef inline void log_gl_error(str note):
if env_debug_gl:
ret = cgl.glGetError()
if ret:
Logger.error("OpenGL Error: {note} {ret1} / {ret2}".format(
note=note, ret1=ret, ret2=hex(ret)))

View file

@ -0,0 +1,114 @@
from kivy.graphics.opengl_utils cimport (gl_has_texture_native_format,
gl_has_texture_conversion)
cimport cython
from cython cimport view as cyview
from cpython.array cimport array, clone
@cython.boundscheck(False)
@cython.wraparound(False)
cdef inline convert_to_gl_format(data, fmt, width, height):
''' Takes data as a bytes object or an instance that implements the python
buffer interface. If the data format is supported by opengl, the data
is returned unchanged. Otherwise, the data is converted to a supported
format, when possible, and returned as a python array object.
Note that conversion is currently only supported for bytes data.
'''
cdef array ret_array
cdef char *src_buffer
cdef char *dst_buffer
cdef char [::1] view
cdef int datasize
cdef str ret_format
cdef int i, k
cdef char c, c2
cdef int pitch, rowlen
cdef int pitchalign = 0
# if native support of this format is available, use it
if gl_has_texture_native_format(fmt):
return data, fmt
# no native support, can we at least convert it ?
if not gl_has_texture_conversion(fmt):
raise Exception('Unimplemented texture conversion for {}'.format(fmt))
# do appropriate conversion, since we accepted it
if isinstance(data, bytes):
datasize = <int>len(data)
ret_array = clone(array('b'), datasize, False)
src_buffer = <char *>data
else:
view = data
datasize = view.nbytes
ret_array = clone(array('b'), datasize, False)
src_buffer = &view[0]
dst_buffer = ret_array.data.as_chars
# BGR -> RGB
if fmt == 'bgr':
ret_format = 'rgb'
memcpy(dst_buffer, src_buffer, datasize)
i = 0
rowlen = width * 3
pitch = (rowlen + 3) & ~3
if rowlen * height < datasize:
# FIXME: warn/fail if pitch * height != datasize:
pitchalign = pitch - rowlen
rowlen -= 1 # to match 0-based k below
# note, this is the fastest copying method. copying element by element
# from a memoryview is slower then copying the whole buffer and then
# properly modifying the elements
with nogil:
while i < datasize:
c = dst_buffer[i]
k = i + 2
dst_buffer[i] = dst_buffer[k]
dst_buffer[k] = c
if pitchalign and k % rowlen == 0:
i += pitchalign
i += 3
# BGRA -> RGBA
elif fmt == 'bgra':
ret_format = 'rgba'
memcpy(dst_buffer, src_buffer, datasize)
with nogil:
for i in range(0, datasize, 4):
c = dst_buffer[i]
dst_buffer[i] = dst_buffer[i + 2]
dst_buffer[i + 2] = c
# ARGB -> RGBA
elif fmt == 'argb':
ret_format = 'rgba'
memcpy(dst_buffer, &src_buffer[1], datasize-1)
c2 = src_buffer[0]
with nogil:
for i in range(0, datasize, 4):
c = dst_buffer[i+3]
dst_buffer[i+3] = c2
c2 = c
# ABGR -> RGBA
elif fmt == 'abgr':
ret_format = 'rgba'
memcpy(dst_buffer, &src_buffer[1], datasize-1)
c2 = src_buffer[0]
with nogil:
for i in range(0, datasize, 4):
c = dst_buffer[i+3]
dst_buffer[i+3] = c2
c2 = c
c = dst_buffer[i]
dst_buffer[i] = dst_buffer[i + 2]
dst_buffer[i + 2] = c
else:
assert False, 'Non implemented texture conversion {}'.format(fmt)
return ret_array, ret_format

View file

@ -0,0 +1,129 @@
include "../include/config.pxi"
cdef class Instruction
cdef class InstructionGroup
cdef class ContextInstruction
cdef class VertexInstruction
cdef class CanvasBase
cdef class Canvas
cdef class RenderContext
from .vbo cimport *
from .compiler cimport *
from .shader cimport *
from .texture cimport Texture
from kivy._event cimport ObjectWithUid
cdef void reset_gl_context()
cdef class Instruction
cdef class InstructionGroup(Instruction)
cdef class Instruction(ObjectWithUid):
cdef int flags
cdef public str group
cdef InstructionGroup parent
cdef object __weakref__
cdef object __proxy_ref
cdef int apply(self) except -1
IF DEBUG:
cpdef flag_update(self, int do_parent=?, list _instrs=?)
ELSE:
cpdef flag_update(self, int do_parent=?)
cpdef flag_data_update(self)
cdef void flag_update_done(self)
cdef void set_parent(self, Instruction parent)
cdef void reload(self) except *
cdef void radd(self, InstructionGroup ig)
cdef void rinsert(self, InstructionGroup ig, int index)
cdef void rremove(self, InstructionGroup ig)
cdef class InstructionGroup(Instruction):
cdef public list children
cdef InstructionGroup compiled_children
cdef GraphicsCompiler compiler
cdef void build(self)
cdef void reload(self) except *
cpdef add(self, Instruction c)
cpdef insert(self, int index, Instruction c)
cpdef remove(self, Instruction c)
cpdef clear(self)
cpdef remove_group(self, str groupname)
cpdef get_group(self, str groupname)
cdef class ContextInstruction(Instruction):
cdef dict context_state
cdef list context_push
cdef list context_pop
cdef RenderContext get_context(self)
cdef int set_state(self, str name, value) except -1
cdef int push_state(self, str name) except -1
cdef int pop_state(self, str name) except -1
from .context_instructions cimport BindTexture
cdef class VertexInstruction(Instruction):
cdef BindTexture texture_binding
cdef VertexBatch batch
cdef float _tex_coords[8]
cdef void radd(self, InstructionGroup ig)
cdef void rinsert(self, InstructionGroup ig, int index)
cdef void rremove(self, InstructionGroup ig)
cdef void build(self)
cdef class Callback(Instruction):
cdef Shader _shader
cdef object func
cdef int _reset_context
cdef int apply(self) except -1
cdef int enter(self) except -1
cdef CanvasBase getActiveCanvas()
cdef class CanvasBase(InstructionGroup):
pass
cdef class Canvas(CanvasBase):
cdef float _opacity
cdef CanvasBase _before
cdef CanvasBase _after
cdef void reload(self) except *
cpdef clear(self)
cpdef add(self, Instruction c)
cpdef remove(self, Instruction c)
cpdef draw(self)
cdef int apply(self) except -1
cdef class RenderContext(Canvas):
cdef Shader _shader
cdef dict state_stacks
cdef Texture default_texture
cdef dict bind_texture
cdef int _use_parent_projection
cdef int _use_parent_modelview
cdef int _use_parent_frag_modelview
cdef void set_texture(self, int index, Texture texture)
cdef void set_state(self, str name, value, int apply_now=?)
cdef get_state(self, str name)
cdef int set_states(self, dict states) except -1
cdef int push_state(self, str name) except -1
cdef int push_states(self, list names) except -1
cdef int pop_state(self, str name) except -1
cdef int pop_states(self, list names) except -1
cdef int enter(self) except -1
cdef int leave(self) except -1
cdef int apply(self) except -1
cpdef draw(self)
cdef void reload(self) except *
cdef RenderContext getActiveContext()

View file

@ -0,0 +1,74 @@
from cpython.array cimport array, clone
'''
These functions below, take a data element; if the data implements the
buffer interface, the data is returned unchanged, otherwise, a python
array is created from the data and returned.
in both cases, the second parameter is initialized with a pointer to the
starting address of the returned buffer
The return value is a tuple, of (original data, array), where in the first
case, array is None.
The method used below (a untyped python array + array.data.as_floats pointer)
results in the fastest list to array creation and usage. Even malloc isn't
faster. Note, using memoryview (which we avoided for this case) is relatively
slow in cython.
When the user passes in a memoryview type, we have no choice but to use the
memoryview passed in, though.
'''
cdef inline _ensure_float_view(data, float **f):
cdef array arr
cdef list src
cdef int i
cdef float [::1] memview
# do if/else instead of straight try/except because its faster for list
if not isinstance(data, (tuple, list)):
try:
memview = data
f[0] = &memview[0]
return data, None
except Exception as e:
import traceback; traceback.print_exc()
src = list(data)
arr = clone(array('f'), len(src), False)
f[0] = arr.data.as_floats
for i in range(len(src)):
f[0][i] = src[i]
else:
src = list(data)
arr = clone(array('f'), len(src), False)
f[0] = arr.data.as_floats
for i in range(len(src)):
f[0][i] = src[i]
return src, arr
cdef inline _ensure_ushort_view(data, unsigned short **f):
cdef array arr
cdef list src
cdef int i
cdef unsigned short [::1] memview
# do if/else instead of straight try/except because its faster for list
if not isinstance(data, (tuple, list)):
try:
memview = data
f[0] = &memview[0]
return data, None
except:
src = list(data)
arr = clone(array('H'), len(src), False)
f[0] = arr.data.as_ushorts
for i in range(len(src)):
f[0][i] = src[i]
else:
src = list(data)
arr = clone(array('H'), len(src), False)
f[0] = arr.data.as_ushorts
for i in range(len(src)):
f[0][i] = src[i]
return src, arr

View file

@ -0,0 +1,10 @@
cdef int GI_NOOP = 1 << 0
cdef int GI_IGNORE = 1 << 1
cdef int GI_NEEDS_UPDATE = 1 << 2
cdef int GI_GROUP = 1 << 3
cdef int GI_CONTEXT_MOD = 1 << 4
cdef int GI_VERTEX_DATA = 1 << 5
cdef int GI_COMPILER = 1 << 6
cdef int GI_NO_APPLY_ONCE = 1 << 7
cdef int GI_NO_REMOVE = 1 << 8

View file

@ -0,0 +1,11 @@
cpdef list gl_get_extensions()
cpdef int gl_has_extension(name)
cpdef gl_register_get_size(int constid, int size)
cpdef int gl_has_capability(int cap)
cpdef tuple gl_get_texture_formats()
cpdef int gl_has_texture_native_format(fmt)
cpdef int gl_has_texture_conversion(fmt)
cpdef int gl_has_texture_format(fmt)
cpdef tuple gl_get_version()
cpdef int gl_get_version_major()
cpdef int gl_get_version_minor()

View file

@ -0,0 +1,17 @@
# c definition
cdef int c_GLCAP_BGRA = 0x0001
cdef int c_GLCAP_NPOT = 0x0002
cdef int c_GLCAP_S3TC = 0x0003
cdef int c_GLCAP_DXT1 = 0x0004
cdef int c_GLCAP_PVRTC = 0x0005
cdef int c_GLCAP_ETC1 = 0x0006
cdef int c_GLCAP_UNPACK_SUBIMAGE = 0x0007
# for python export
GLCAP_BGRA = c_GLCAP_NPOT
GLCAP_NPOT = c_GLCAP_NPOT
GLCAP_S3TC = c_GLCAP_S3TC
GLCAP_DXT1 = c_GLCAP_DXT1
GLCAP_PVRTC = c_GLCAP_PVRTC
GLCAP_ETC1 = c_GLCAP_ETC1
GLCAP_UNPACK_SUBIMAGE = c_GLCAP_UNPACK_SUBIMAGE

View file

@ -0,0 +1,42 @@
from kivy.graphics.cgl cimport GLuint, GLint
from kivy.graphics.transformation cimport Matrix
from kivy.graphics.vertex cimport VertexFormat
cdef class ShaderSource:
cdef int shader
cdef int shadertype
cdef set_source(self, char *source)
cdef get_shader_log(self, int shader)
cdef void process_message(self, str ctype, message)
cdef int is_compiled(self)
cdef class Shader:
cdef object __weakref__
cdef int _success
cdef VertexFormat _current_vertex_format
cdef GLint program
cdef ShaderSource vertex_shader
cdef ShaderSource fragment_shader
cdef object _source
cdef object vert_src
cdef object frag_src
cdef dict uniform_locations
cdef dict uniform_values
cdef void use(self)
cdef void stop(self)
cdef int set_uniform(self, str name, value) except -1
cdef int upload_uniform(self, str name, value) except -1
cdef void upload_uniform_matrix(self, int loc, Matrix value)
cdef int get_uniform_loc(self, str name) except *
cdef int build(self) except -1
cdef int build_vertex(self, int link=*) except -1
cdef int build_fragment(self, int link=*) except -1
cdef int link_program(self) except -1
cdef int is_linked(self)
cdef ShaderSource compile_shader(self, str source, int shadertype)
cdef get_program_log(self, shader)
cdef void process_message(self, str ctype, message)
cdef void reload(self)
cdef void bind_vertex_format(self, VertexFormat vertex_format)

View file

@ -0,0 +1,20 @@
from kivy.graphics.instructions cimport Instruction
cdef get_stencil_state()
cdef void restore_stencil_state(dict state)
cdef void reset_stencil_state()
cdef class StencilPush(Instruction):
cdef bint _clear_stencil
cdef bint _check_bool(self, object value)
cdef int apply(self) except -1
cdef class StencilPop(Instruction):
cdef int apply(self) except -1
cdef class StencilUse(Instruction):
cdef int _op
cdef int apply(self) except -1
cdef class StencilUnUse(Instruction):
cdef int apply(self) except -1

View file

@ -0,0 +1,80 @@
cdef class Matrix
cdef class Svg
from cython cimport view
from kivy.graphics.instructions cimport RenderContext
from kivy.graphics.texture cimport Texture
from kivy.graphics.vertex cimport VertexFormat
from kivy.graphics.vertex_instructions cimport StripMesh
from cpython cimport array
from array import array
cdef set COMMANDS
cdef set UPPERCASE
cdef object RE_LIST
cdef object RE_COMMAND
cdef object RE_FLOAT
cdef object RE_POLYLINE
cdef object RE_TRANSFORM
cdef VertexFormat VERTEX_FORMAT
ctypedef double matrix_t[6]
cdef list kv_color_to_int_color(color)
cdef float parse_float(txt)
cdef list parse_list(string)
cdef dict parse_style(string)
cdef parse_color(c, current_color=?)
cdef class Matrix:
cdef matrix_t mat
cdef void transform(self, float ox, float oy, float *x, float *y)
cpdef Matrix inverse(self)
cdef class Svg(RenderContext):
cdef public double width
cdef public double height
cdef float line_width
cdef list paths
cdef object transform
cdef object fill
cdef object tree
cdef public object current_color
cdef object stroke
cdef float opacity
cdef float x
cdef float y
cdef int close_index
cdef list path
cdef array.array loop
cdef int bezier_points
cdef int circle_points
cdef public object gradients
cdef view.array bezier_coefficients
cdef float anchor_x
cdef float anchor_y
cdef double last_cx
cdef double last_cy
cdef Texture line_texture
cdef StripMesh last_mesh
cdef bint closed
cdef float vbox_x, vbox_y, vbox_width, vbox_height
cdef str _source
cdef void reload(self) except *
cdef parse_tree(self, tree)
cdef parse_element(self, e)
cdef list parse_transform(self, transform_def)
cdef parse_path(self, pathdef)
cdef void new_path(self)
cdef void close_path(self)
cdef void set_position(self, double x, double y, int absolute=*)
cdef arc_to(self, double rx, double ry, double phi, double large_arc,
double sweep, double x, double y)
cdef void quadratic_bezier_curve_to(self, float cx, float cy, float x, float y)
cdef void curve_to(self, float x1, float y1, float x2, float y2,
float x, float y)
cdef void end_path(self)
cdef void push_mesh(self, float[:] path, fill, Matrix transform, mode)
cdef void push_strip_mesh(self, float *vertices, int vindex, int count,
int mode=*)
cdef void push_line_mesh(self, float[:] path, fill, Matrix transform, float width)
cdef void render(self)

View file

@ -0,0 +1,9 @@
cdef class Tesselator:
cdef void *tess
cdef int element_type
cdef int polysize
cdef void add_contour_data(self, void *cdata, int count)
cdef iterate_vertices(self, int mode)
cpdef int tesselate(
self, int winding_rule=?,
int element_type=?, int polysize=?)

View file

@ -0,0 +1,49 @@
from kivy.graphics.cgl cimport GLuint
cdef class Texture:
cdef object __weakref__
cdef unsigned int flags
cdef object _source
cdef float _tex_coords[8]
cdef int _width
cdef int _height
cdef GLuint _target
cdef GLuint _id
cdef int _mipmap
cdef object _wrap
cdef object _min_filter
cdef object _mag_filter
cdef int _rectangle
cdef object _colorfmt
cdef object _icolorfmt
cdef object _bufferfmt
cdef float _uvx
cdef float _uvy
cdef float _uvw
cdef float _uvh
cdef int _is_allocated
cdef int _nofree
cdef list observers
cdef object _proxyimage
cdef object _callback
cdef void update_tex_coords(self)
cdef void set_min_filter(self, x)
cdef void set_mag_filter(self, x)
cdef void set_wrap(self, x)
cdef void reload(self)
cdef void _reload_propagate(self, Texture texture)
cdef void allocate(self)
cpdef flip_vertical(self)
cpdef flip_horizontal(self)
cpdef get_region(self, x, y, width, height)
cpdef bind(self)
cdef class TextureRegion(Texture):
cdef int x
cdef int y
cdef Texture owner
cdef void reload(self)
cpdef bind(self)

View file

@ -0,0 +1,38 @@
ctypedef double matrix_t[16]
cdef class Matrix:
cdef matrix_t mat
cpdef Matrix identity(self)
cpdef Matrix inverse(self)
cpdef Matrix transpose(self)
cpdef Matrix multiply(Matrix self, Matrix mb)
cpdef Matrix scale(Matrix self, double x, double y, double z)
cpdef Matrix translate(Matrix self, double x, double y, double z)
cpdef Matrix rotate(Matrix self,
double angle, double x, double y, double z)
cpdef Matrix view_clip(Matrix self, double left, double right,
double bottom, double top,
double near, double far, int perspective)
cpdef Matrix perspective(Matrix self, double fovy, double aspect,
double zNear, double zFar)
cpdef look_at(Matrix self, double eyex, double eyey, double eyez,
double centerx, double centery, double centerz,
double upx, double upy, double upz)
cpdef Matrix normal_matrix(self)
cpdef tuple transform_point(Matrix self, double x, double y, double z,
t=?)
cpdef project(Matrix self, double objx, double objy, double objz, Matrix model, Matrix proj,
double vx, double vy, double vw, double vh)

View file

@ -0,0 +1,54 @@
from kivy.graphics.buffer cimport Buffer
from kivy.graphics.vertex cimport vertex_t, vertex_attr_t, VertexFormat
from kivy.graphics.cgl cimport GLuint
cdef VertexFormat default_vertex
cdef class VBO:
cdef object __weakref__
cdef GLuint id
cdef int usage
cdef int target
cdef vertex_attr_t *format
cdef long format_count
cdef long format_size
cdef Buffer data
cdef short flags
cdef long vbo_size
cdef VertexFormat vertex_format
cdef void update_buffer(self)
cdef void bind(self)
cdef void unbind(self)
cdef void add_vertex_data(self, void *v, unsigned short* indices, int count)
cdef void update_vertex_data(self, int index, void* v, int count)
cdef void remove_vertex_data(self, unsigned short* indices, int count)
cdef void reload(self)
cdef int have_id(self)
cdef class VertexBatch:
cdef object __weakref__
cdef VBO vbo
cdef Buffer elements
cdef Buffer vbo_index
cdef GLuint mode
cdef str mode_str
cdef GLuint id
cdef int usage
cdef short flags
cdef long elements_size
cdef void clear_data(self)
cdef void set_data(self, void *vertices, int vertices_count,
unsigned short *indices, int indices_count)
cdef void append_data(self, void *vertices, int vertices_count,
unsigned short *indices, int indices_count)
cdef void draw(self)
cdef void set_mode(self, str mode)
cdef str get_mode(self)
cdef int count(self)
cdef void reload(self)
cdef int have_id(self)

View file

@ -0,0 +1,20 @@
from kivy.graphics.cgl cimport GLuint
cdef struct vertex_t:
float x, y
float s0, t0
ctypedef struct vertex_attr_t:
char *name
unsigned int index
unsigned int size
GLuint type
unsigned int bytesize
int per_vertex
cdef class VertexFormat:
cdef vertex_attr_t *vattr
cdef long vattr_count
cdef unsigned int vsize
cdef unsigned int vbytesize
cdef object last_shader

View file

@ -0,0 +1,34 @@
from kivy.graphics.instructions cimport VertexInstruction
from kivy.graphics.vertex cimport VertexFormat
cdef class Bezier(VertexInstruction):
cdef list _points
cdef int _segments
cdef bint _loop
cdef int _dash_offset, _dash_length
cdef void build(self)
cdef class StripMesh(VertexInstruction):
cdef int icount
cdef int li, lic
cdef int add_triangle_strip(self, float *vertices, int vcount, int icount,
int mode)
cdef class Mesh(VertexInstruction):
cdef int is_built
cdef object _vertices # the object the user passed in
cdef object _indices
cdef object _fvertices # a buffer interface passed by user, or created
cdef object _lindices
cdef float *_pvertices # the pointer to the start of buffer interface data
cdef unsigned short *_pindices
cdef VertexFormat vertex_format
cdef long vcount # the length of last set _vertices
cdef long icount # the length of last set _indices
cdef void build_triangle_fan(self, float *vertices, int vcount, int icount)
cdef void build(self)

File diff suppressed because it is too large Load diff