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: marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
marius schebella wrote:
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
sorry, "opengl.so"
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: marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
marius schebella wrote:
marius schebella wrote:
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).
True, no opengl stuff in Lua, have to get an external library.
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
sorry, "opengl.so"
and I am not sure, if I can use them at all??
Then require("opengl") should work, if the opengl.so is in the Lua package path (including next to your .pd_lua file). At least I managed to load a test package into pdlua and list its contents..
function testgl1:in_1(sel, atoms) if sel == "gem_state" then testgl1:render(self) end end
could be replaced by
function testgl1:in_1_gem_state(atoms) self:render() end
with
function testgl1:render(myself) max = math.max(myself.max, 1)
replaced by
function testgl1:render() max = math.max(self.max, 1)
or so.
Thanks,
Claude Heiland-Allen wrote:
marius schebella wrote:
marius schebella wrote:
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).
True, no opengl stuff in Lua, have to get an external library.
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
sorry, "opengl.so"
and I am not sure, if I can use them at all??
Then require("opengl") should work, if the opengl.so is in the Lua package path (including next to your .pd_lua file). At least I managed to load a test package into pdlua and list its contents..
hi, thanks for the reply, I am confident to get it working, hoping, that it will not take too long. a short note here:
error: lua: error loading `msgltest1': [string "msgltest1"]:1: module 'opengl' not found: no field package.preload['opengl'] no file '/Users/marius/pd/pdlua/opengl' no file '/Users/marius/pd/pdlua/opengl.lua' no file './opengl.lua' no file '/usr/local/share/lua/5.1/opengl.lua' no file '/usr/local/share/lua/5.1/opengl/init.lua' no file '/usr/local/lib/lua/5.1/opengl.lua' no file '/usr/local/lib/lua/5.1/opengl/init.lua' no file './opengl.so' no file '/usr/local/lib/lua/5.1/opengl.so' no file '/usr/local/lib/lua/5.1/loadall.so'
it seems pdlua is only looking for the "so" extension in /usr/local/lib... creating a symlink without the extension solved this for now. marius.
Hallo, marius schebella hat gesagt: // marius schebella wrote:
thanks for the reply, I am confident to get it working, hoping, that it will not take too long. a short note here:
error: lua: error loading `msgltest1': [string "msgltest1"]:1: module 'opengl' not found: no field package.preload['opengl'] no file '/Users/marius/pd/pdlua/opengl' no file '/Users/marius/pd/pdlua/opengl.lua' no file './opengl.lua' no file '/usr/local/share/lua/5.1/opengl.lua' no file '/usr/local/share/lua/5.1/opengl/init.lua' no file '/usr/local/lib/lua/5.1/opengl.lua' no file '/usr/local/lib/lua/5.1/opengl/init.lua' no file './opengl.so' no file '/usr/local/lib/lua/5.1/opengl.so' no file '/usr/local/lib/lua/5.1/loadall.so'
it seems pdlua is only looking for the "so" extension in /usr/local/lib... creating a symlink without the extension solved this for now.
Are you using pd-0.40? Loading of lua-modules next to the pd_lua file requires pd-0.41 IIR.
Frank Barknecht _ ______footils.org__
marius schebella wrote:
error: lua: error loading `msgltest1': [string "msgltest1"]:1: module 'opengl' not found: no field package.preload['opengl'] no file '/Users/marius/pd/pdlua/opengl' no file '/Users/marius/pd/pdlua/opengl.lua' no file './opengl.lua' no file '/usr/local/share/lua/5.1/opengl.lua' no file '/usr/local/share/lua/5.1/opengl/init.lua' no file '/usr/local/lib/lua/5.1/opengl.lua' no file '/usr/local/lib/lua/5.1/opengl/init.lua' no file './opengl.so' no file '/usr/local/lib/lua/5.1/opengl.so' no file '/usr/local/lib/lua/5.1/loadall.so'
it seems pdlua is only looking for the "so" extension in /usr/local/lib... creating a symlink without the extension solved this for now. marius.
aha, many thanks for the additional info! - seems that this is a bug in pdlua after all:
when pdlua loads a script it sets Lua's package path like this:
/* package.path := path .. "/?;" .. path .. "/?.lua;" .. package.path */
I'm not sure the best way to fix this, the standalone 'lua' interpreter doesn't mention .so in the package path at all:
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio
print (package.path)
./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua
Any Lua experts know "the Lua way" to fix this?
I didn't notice it before because I got confused with another project of mine (not Pd related) - the complex-help.pd example loads a .lua package, not a .so package - sorry for the misleading information earlier.
Thanks again,
Hallo, Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:
marius schebella wrote:
error: lua: error loading `msgltest1': [string "msgltest1"]:1: module 'opengl' not found: no field package.preload['opengl'] no file '/Users/marius/pd/pdlua/opengl' no file '/Users/marius/pd/pdlua/opengl.lua' no file './opengl.lua' no file '/usr/local/share/lua/5.1/opengl.lua' no file '/usr/local/share/lua/5.1/opengl/init.lua' no file '/usr/local/lib/lua/5.1/opengl.lua' no file '/usr/local/lib/lua/5.1/opengl/init.lua' no file './opengl.so' no file '/usr/local/lib/lua/5.1/opengl.so' no file '/usr/local/lib/lua/5.1/loadall.so'
it seems pdlua is only looking for the "so" extension in /usr/local/lib... creating a symlink without the extension solved this for now. marius.
aha, many thanks for the additional info! - seems that this is a bug in pdlua after all:
when pdlua loads a script it sets Lua's package path like this:
/* package.path := path .. "/?;" .. path .. "/?.lua;" .. package.path */
I'm not sure the best way to fix this, the standalone 'lua' interpreter doesn't mention .so in the package path at all:
Lua's package has a different key for binary, C-modules called package.cpath, which corresponds to the environment variable LUA_CPATH.
I think, this is something which changed from Lua 5.0 to Lua 5.1, at least it isn't mentioned in the first edition of the Blue PiL (online on lua.org). If you don't have the second edition, you can get the rewritten chapter 15 as a pdf-excerpt here: http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf
Here's the relevant part:
If require cannot find a Lua file compatible with the module name, it looks for a C library. For this search, it gets the path from variable package.cpath (instead of package.path). This variable gets its initial value from the environment variable LUA_CPATH (instead of LUA_PATH). A typical value for this variable in Unix is like this:
./?.so;/usr/local/lib/lua/5.1/?.so
Note that the file extension is defined by the path (e.g., the previous example uses .so for all templates). In Windows, a typical path is more like this one:
.\?.dll;C:\Program Files\Lua501\dll\?.dll
Frank Barknecht _ ______footils.org__
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
I keep getting the same nil error, I think my code has errors, but I am not sure where/which.
require ("opengl")
local basicgl = pd.Class:new():register("basicgl")
function basicgl:initialize(name, atoms) self.inlets = 2 pd.post(tostring(self)) return true end
function basicgl:in_1_gem_state(atoms) self:render() end
function basicgl:render() gl.Begin(1) gl.Vertex(-1, 1, 0) gl.Vertex(1, 1, 0) gl.Vertex(1, -1, 0) gl.Vertex(-1, -1, 0) gl.End() end
error: lua: error in dispatcher: [string "basicgl"]:16: attempt to index global 'gl' (a nil value)
marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Hi all,
attached is the file gl.pd_lua (tested with 0.41-4) which uses some
special lua features to represent a generic opengl function for GEM.
GL objects can be created as e.g. [gl Color 1 1 0] or [gl Rect 0 0 400
300]
gr~~~
Am 25.07.2008 um 21:39 schrieb marius schebella:
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 interpreterI keep getting the same nil error, I think my code has errors, but I
am not sure where/which.require ("opengl")
local basicgl = pd.Class:new():register("basicgl")
function basicgl:initialize(name, atoms) self.inlets = 2 pd.post(tostring(self)) return true end
function basicgl:in_1_gem_state(atoms) self:render() end
function basicgl:render() gl.Begin(1) gl.Vertex(-1, 1, 0) gl.Vertex(1, 1, 0) gl.Vertex(1, -1, 0) gl.Vertex(-1, -1, 0) gl.End() end
error: lua: error in dispatcher: [string "basicgl"]:16: attempt to index global 'gl' (a nil value)
marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Thomas Grill http://grrrr.org
A more refined version which also supports symbolic OpenGL constants
as in
[gl MatrixMode TEXTURE]
and lists to the first inlet with all parameters as in
[1 0 0(
|
[gl Color 0 0 0]
gr~~~
Am 25.07.2008 um 23:37 schrieb Thomas Grill:
Hi all, attached is the file gl.pd_lua (tested with 0.41-4) which uses some
special lua features to represent a generic opengl function for GEM. GL objects can be created as e.g. [gl Color 1 1 0] or [gl Rect 0 0
400 300] gr~~~<gl.pd_lua>
Am 25.07.2008 um 21:39 schrieb marius schebella:
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 interpreterI keep getting the same nil error, I think my code has errors, but
I am not sure where/which.require ("opengl")
local basicgl = pd.Class:new():register("basicgl")
function basicgl:initialize(name, atoms) self.inlets = 2 pd.post(tostring(self)) return true end
function basicgl:in_1_gem_state(atoms) self:render() end
function basicgl:render() gl.Begin(1) gl.Vertex(-1, 1, 0) gl.Vertex(1, 1, 0) gl.Vertex(1, -1, 0) gl.Vertex(-1, -1, 0) gl.End() end
error: lua: error in dispatcher: [string "basicgl"]:16: attempt to index global 'gl' (a nil value)
marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Thomas Grill http://grrrr.org
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Thomas Grill wrote:
A more refined version which also supports symbolic OpenGL constants as in [gl MatrixMode TEXTURE] and lists to the first inlet with all parameters as in [1 0 0( | [gl Color 0 0 0]
gr~~~
Am 25.07.2008 um 23:37 schrieb Thomas Grill:
Hi all, attached is the file gl.pd_lua (tested with 0.41-4) which uses some special lua features to represent a generic opengl function for GEM. GL objects can be created as e.g. [gl Color 1 1 0] or [gl Rect 0 0 400 300] gr~~~
<gl.pd_lua>
Am 25.07.2008 um 21:39 schrieb marius schebella:
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
Maybe I should try this version, too. where did you get it? or could it be that there is a version problem with my pdlua version (latest)? I am still not able to load any of the gl scripts :( thanks, marius.
Am 26.07.2008 um 15:51 schrieb marius schebella:
Am 25.07.2008 um 21:39 schrieb marius schebella:
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
Maybe I should try this version, too. where did you get it? or could
it be that there is a version problem with my pdlua version
(latest)? I am still not able to load any of the gl scripts :(
I can't say anything about different versions - the lib loading
functionality (require) should only depend on the lua version, i would
think that any 5.1.x i should be ok.
I got my luagl from http://sourceforge.net/projects/luagl, but i had
to make some changes so that it compiles with the Apple OpenGL
framework and then build it manually (no make file). I'll send you the
OSX binary off-list.
gr~~~
-- Thomas Grill http://grrrr.org
Thomas Grill wrote:
Am 26.07.2008 um 15:51 schrieb marius schebella:
Am 25.07.2008 um 21:39 schrieb marius schebella:
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
Maybe I should try this version, too. where did you get it? or could it be that there is a version problem with my pdlua version (latest)? I am still not able to load any of the gl scripts :(
I can't say anything about different versions - the lib loading functionality (require) should only depend on the lua version, i would think that any 5.1.x i should be ok. I got my luagl from http://sourceforge.net/projects/luagl, but i had to make some changes so that it compiles with the Apple OpenGL framework and then build it manually (no make file). I'll send you the OSX binary off-list. gr~~~
thanks, this worked for me!! although I had to change my lua code; what was glColor3d(r,g,b) before is now gl.Color(r,g,b). just out of curiosity, do I ever need the library luaglut? anyway, I would like to be able to compile luagl myself, esp, since I would like to use a slightly branched version, which comes with wesley smith's luaAV package http://lua-av.mat.ucsb.edu/publications.html, in particular the rebuild branch. but that's for the future, right now, I am fine! thanks a lot, marius.
thanks, this worked for me!! although I had to change my lua code; what was glColor3d(r,g,b) before is now gl.Color(r,g,b). just out of curiosity, do I ever need the library luaglut?
You would need luaglut if you were not using GEM, but rather build
your standalone OpenGL app.
gr~~~
-- Thomas Grill http://grrrr.org
Thomas Grill wrote:
Am 26.07.2008 um 15:51 schrieb marius schebella:
Am 25.07.2008 um 21:39 schrieb marius schebella:
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
Maybe I should try this version, too. where did you get it? or could it be that there is a version problem with my pdlua version (latest)? I am still not able to load any of the gl scripts :(
I can't say anything about different versions - the lib loading functionality (require) should only depend on the lua version, i would think that any 5.1.x i should be ok. I got my luagl from http://sourceforge.net/projects/luagl, but i had to make some changes so that it compiles with the Apple OpenGL framework and then build it manually (no make file). I'll send you the OSX binary off-list.
I hope, it's ok, if I put this online, http://www.parasitaere-kapazitaeten.net/pdlua_binaries. pdlua and opengl for os x 10.5 (pd-0.40 and pd 0.41). marius.
Thomas Grill wrote:
A more refined version which also supports symbolic OpenGL constants as in [gl MatrixMode TEXTURE] and lists to the first inlet with all parameters as in [1 0 0( | [gl Color 0 0 0]
gr~~~
what is the difference/advantage between the lua version and the GEMgl objects? aren't the pd connections the one thing that make gem slower compared to lua? afaict lua is extremely fast with code loops, I thought that's because gem has this overhead of the pd messaging system? anyway, thanks for posting the code! marius.
Am 25.07.2008 um 23:37 schrieb Thomas Grill:
Hi all, attached is the file gl.pd_lua (tested with 0.41-4) which uses some special lua features to represent a generic opengl function for GEM. GL objects can be created as e.g. [gl Color 1 1 0] or [gl Rect 0 0 400 300] gr~~~
<gl.pd_lua>
Am 25.07.2008 um 21:39 schrieb marius schebella:
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
I keep getting the same nil error, I think my code has errors, but I am not sure where/which.
require ("opengl")
local basicgl = pd.Class:new():register("basicgl")
function basicgl:initialize(name, atoms) self.inlets = 2 pd.post(tostring(self)) return true end
function basicgl:in_1_gem_state(atoms) self:render() end
function basicgl:render() gl.Begin(1) gl.Vertex(-1, 1, 0) gl.Vertex(1, 1, 0) gl.Vertex(1, -1, 0) gl.Vertex(-1, -1, 0) gl.End() end
error: lua: error in dispatcher: [string "basicgl"]:16: attempt to index global 'gl' (a nil value)
marius.
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@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Thomas Grill http://grrrr.org
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thomas Grill http://grrrr.org
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list