[PD] new luagl

marius schebella marius.schebella at gmail.com
Fri Jul 25 18:06:15 CEST 2008

when I compiled the new pdlua version, the make process grabed the 
sources from http://www.lua.org/ftp/ and built a static lua library 
(which I don't think includes any opengl functionality).
the gl packet I am using comes from http://www.algonet.se/~afb/lua and 
contains a binary called luagl (and some other files). I put them into 
/usr/local/share/lua/5.1 which was one of the directories that seemed to 
be in the default lua search path.
I would be ok with any other version of luagl or opengl -- actually I 
would prefer the branch that wesley smith is working on for his luaAV 
project. wesley's opengl binaries get compiled as opengl.o and I am not 
sure, if I can use them at all??
something with my current setup is not working. I think require("luagl") 
is loading correctly. if I change it to require("opengl") the object 
does not get created: [string "msgltest1"]:1: module 'opengl' not found: 
no field package.preload['opengl']. but there is obviously not opengl 
madule that could be loaded. I will try your luagl version now...
btw using gl.Begin instead of glBegin gives me a similar error.
[string "msgltest1"]:25: attempt to index global 'gl' (a nil value)
error: lua: error in dispatcher:

Thomas Grill wrote:
> Hi Marius,
> which version of "luagl" are you referring to?
> I have the following here (version 1.01):
> *  LuaGL - an OpenGL binding for Lua
> *  2003-2004(c) Fabio Guerra, Cleyde Marlyse
> *  www.luagl.sourceforge.net
> as it's designed by default, lua scripts wouldn't require 'luagl' but 
> rather 'opengl', but this can be changed easily.
> Then, OpenGL functions reside in a lua library called gl, which means 
> that the are called via gl.Begin etc.
> I haven't tried from within pdlua, but it seems to basically work in the 
> lua interpreter
> gr~~~
> Am 19.07.2008 um 20:14 schrieb marius schebella:
>> 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.
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> 
>> http://lists.puredata.info/listinfo/pd-list
> Thomas Grill
> http://grrrr.org

More information about the Pd-list mailing list