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