lua-users home
lua-l archive

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


OK, that's good to know.  Btw, it seems like memarray isn't quite general enough to be used safely with OpenGL.  Here's the line from memarray.c where it lists the types.

const char * m_type_names[] = {
   "byte", "short", "int", "long", "float", "double" };

There isn't an entry for unsigned int or GLuint, which is what's required by glSelectBuffer, so I think I'm going to stick with my own wrapping function for now.  Would you be willing to include it in luaglut?

Issac


On 2/8/06, varol kaptan <varol.kaptan@gmail.com> wrote:
The last line should have been glSelectBuffer(BUFSIZE, selectBuf:ptr())

I'll see what I can do to make the error message make sense.

Varol Kaptan

On 2/8/06, Issac Trotts < issac.trotts@gmail.com> wrote:
> I'm running into some trouble with a lua interpreter linked statically with
> luaglut-0.4.  When I try to run a straightforward translation of the OpenGL
> Redbook demo select.c, it gives an error in this code
>
>  BUFSIZE=512
>  local selectBuf = memarray('int', BUFSIZE)
>  glSelectBuffer (BUFSIZE, selectBuf);
>
>  $ ./lua select.lua
>  ./lua: select.lua :148: bad argument #2 to `glSelectBuffer' (userdata
> expected, got userdata)
>  stack traceback:
>          [C]: in function `glSelectBuffer'
>          select.lua:148: in function `selectObjects'
>          select.lua:183: in function `display'
>          [C]: in function `glutMainLoop'
>          select.lua:201: in main chunk
>          [C]: ?
>
>  A Google search for "userdata expected, got userdata" came up empty, so I'm
> hoping someone here knows what's going on.
>
>  Issac
>
>
>