[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luajut ffi help?
- From: Mike Pall <mikelu-1109@...>
- Date: Tue, 13 Sep 2011 21:52:33 +0200
Tim Caswell wrote:
> I'm trying to use luajit's built-in ffi module to make OpenGL ES 2.0 calls
> using the GLESv2/gl2.h header. I have the header properly parsed and
> everything is working fine, but I can't seem to figure out how to pass in
> strings to functions that accept char*
Lua strings can only be converted to "const char *".
> local string = ffi.new("GLchar*[1]")
> string[0] = str
> GLESv2.glShaderSource(shader, 1, string, #str)
Umm, glShaderSource wants an array of "const GLchar *" and an
array of lengths. I.e. (untested):
local s = ffi.new("const GLchar *[1]", str)
local l = ffi.new("GLint[1]", #str)
GLESv2.glShaderSource(shader, 1, s, l)
--Mike