diff --git a/__init__.py b/__init__.py index d1899f0..c8d791f 100644 --- a/__init__.py +++ b/__init__.py @@ -222,11 +222,21 @@ initialize.argtypes = ( _load_shader = _lib.rk_load_shader _load_shader.restype = ctypes.c_void_p _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): - print("Loading shader", str(name, 'utf-8')); - return _load_shader(name) +def load_shader(vert_lines, frag_lines): + vert_nlines = len(vert_lines) + 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.argtypes = (