lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


            local color_t = ffi.typeof('int[4]')
            print('color_t:', color_t, ffi.sizeof(color_t))
            local color = color_t()
            -- void glReadPixels (GLint x, GLint y, GLsizei width,
GLsizei height, GLenum format, GLenum type, GLvoid * pixels);
            gl.glReadPixels(x, y, 1, 1, gl.GL_RGB, gl.GL_INT, color)
            -- gl.glReadPixels(x, y, 1, 1, gl.GL_RGB, gl.GL_INT,
ffi.cast('void *', color))

Whichever of the two forms of glReadPixels I call above, I get the
same runtime error (Ubuntu 10.04):

Z:\home\mkg\Downloads\malkia-luajit-opencl-e559146\luajit:
../../scripts/ChordSpaceView.lua:488: cannot convert 'void *' to 'int'

It it possible to do this -- allow the C function to copy data into an
address pointed to by a void pointer, then type cast the copied data
back to an array of elementary types?

All the other OpenGL functions I use in this program work fine.

Regards,
Mike Gogins