[PD] new luagl

marius schebella marius.schebella at gmail.com
Sat Jul 19 20:14:28 CEST 2008


hi,
here's the code that I am trying to run:
require 'luagl'

local testgl1 = pd.Class:new():register("testgl1")

function testgl1:initialize(name, atoms)
     self.inlets = 2
     self.max = 1
     pd.post(tostring(self))
     return true
end

function testgl1:in_1(sel, atoms)
     if sel == "gem_state" then
        testgl1:render(self)
     end
end

function testgl1:in_2_float(f)
     self.max = math.abs(f)
     pd.post(self.max)
end

function testgl1:render(myself)
     max = math.max(myself.max, 1)
     glBegin(GL_LINE_LOOP)
     for i=1,max do
     	r = math.random()
     	g = math.random()
     	b = math.random()
         glColor3d(r, g, b)
         glVertex2d(math.random(-400,400)/100, math.random(-400,400)/100)
     end
     glEnd()
end

here's the console printout:
error: lua: error in dispatcher:
[string "testgl1"]:25: attempt to call global 'glBegin' (a nil value)
I think this code was running in lua0.3..
thanks,
marius.




More information about the Pd-list mailing list