[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: glLua question
- From: Waldemar Celes <celes@...>
- Date: Thu, 16 Sep 1999 10:25:44 -0400
Steve Dekorte wrote:
> I'm having problems using the gluUnProject and gluProject functions
> from lua on NT. I get a "0x0000 memory could not be read" error.
> The code looks like this: (written from what I remember(
>
> -- the viewport, and matrices are already setup
> local x = 0
> local y = 0
> local z = 0
> local rx = gllCreateBuffer(1, GL_DOUBLE)
> local ry = gllCreateBuffer(1, GL_DOUBLE)
> local rz = gllCreateBuffer(1, GL_DOUBLE)
>
> local model = gllCreateBuffer(1,GL_DOUBLE,{glGet(GL_MODEL_MATRIX))
> local proj = gllCreateBuffer(1,GL_DOUBLE,{glGet(GL_MODEL_MATRIX))
> local view = gllCreateBuffer(1,GL_DOUBLE,{glGet(GL_MODEL_MATRIX))
>
> gluProject(x, y, z, model, proj, view, rx, ry, rz)
>
> Can anyone see what I'm doing wrong?
you only need to create a buffer for a few functions like glReadPixels.
the correct code would be to use gluProject would be something like:
local model = {}
local proj = {}
local view = {}
glGet(GL_MODELVIEW_MATRIX,model)
glGet(GL_PROJECTION_MATRIX,proj)
glGet(GL_VIEWPORT,view)
local rx,ry,rz = gluProject(x,y,z,model,proj,view)
-- waldemar