Fix ctypes binding for load_shader.
This commit is contained in:
parent
7e015fda86
commit
af25548752
18
__init__.py
18
__init__.py
@ -222,11 +222,21 @@ initialize.argtypes = (
|
|||||||
_load_shader = _lib.rk_load_shader
|
_load_shader = _lib.rk_load_shader
|
||||||
_load_shader.restype = ctypes.c_void_p
|
_load_shader.restype = ctypes.c_void_p
|
||||||
_load_shader.argtypes = (
|
_load_shader.argtypes = (
|
||||||
ctypes.c_char_p,) # name
|
ctypes.c_uint, # vert_nlines
|
||||||
|
ctypes.c_void_p, # vert_lines
|
||||||
|
ctypes.c_uint, # frag_nlines
|
||||||
|
ctypes.c_void_p) # frag_lines
|
||||||
|
|
||||||
def load_shader(name):
|
def load_shader(vert_lines, frag_lines):
|
||||||
print("Loading shader", str(name, 'utf-8'));
|
vert_nlines = len(vert_lines)
|
||||||
return _load_shader(name)
|
vert_type = ctypes.c_char_p * vert_nlines
|
||||||
|
vert_lines = vert_type(*map(ctypes.c_char_p, vert_lines))
|
||||||
|
frag_nlines = len(frag_lines)
|
||||||
|
frag_type = ctypes.c_char_p * frag_nlines
|
||||||
|
frag_lines = frag_type(*map(ctypes.c_char_p, frag_lines))
|
||||||
|
return _load_shader(
|
||||||
|
vert_nlines, ctypes.addressof(vert_lines),
|
||||||
|
frag_nlines, ctypes.addressof(frag_lines))
|
||||||
|
|
||||||
select_shader = _lib.rk_select_shader
|
select_shader = _lib.rk_select_shader
|
||||||
select_shader.argtypes = (
|
select_shader.argtypes = (
|
||||||
|
Loading…
Reference in New Issue
Block a user