mirror of https://github.com/kivy/kivy.git
stencilinstruction: add the possibility to configure the stencil glop code
This commit is contained in:
parent
a217c363bc
commit
71ac8e263d
|
@ -0,0 +1,11 @@
|
|||
from kivy.graphics.instructions cimport Instruction
|
||||
|
||||
cdef class StencilPush(Instruction):
|
||||
cdef void apply(self)
|
||||
cdef class StencilPop(Instruction):
|
||||
cdef void apply(self)
|
||||
cdef class StencilUse(Instruction):
|
||||
cdef unsigned int _op
|
||||
cdef void apply(self)
|
||||
cdef class StencilUnUse(Instruction):
|
||||
cdef void apply(self)
|
|
@ -147,11 +147,14 @@ cdef class StencilUse(Instruction):
|
|||
'''Use current stencil buffer as a mask. Check module documentation for more
|
||||
information.
|
||||
'''
|
||||
def __init__(self, **kwargs):
|
||||
super(StencilUse, self).__init__(**kwargs)
|
||||
self._op = kwargs.get('op') or GL_EQUAL
|
||||
cdef void apply(self):
|
||||
global _stencil_in_push
|
||||
_stencil_in_push = 0
|
||||
glColorMask(1, 1, 1, 1)
|
||||
glStencilFunc(GL_EQUAL, _stencil_level, 0xff)
|
||||
glStencilFunc(self._op, _stencil_level, 0xff)
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)
|
||||
|
||||
cdef class StencilUnUse(Instruction):
|
||||
|
|
Loading…
Reference in New Issue