hello cyrille, drawing squares now, I attach the pd-patch (msgltest2-test.pd) and the lua script (msgltest2.lua) that I used. with lua I can draw more than 10000 squares, with gem around 2000. I don't know exactly why lua is faster. maybe because in lua, I create one long gl command list (from glbegin to glend) and in gem I trigger gemhead everytime I draw a square. is there a way to make the gem part faster? marius.
cyrille henry wrote:
hello,
i have not try the test patch, but the curve object is very ineficient to draw line. can you try to draw as many square as possible in gem, and with luagl?
this 10:1 speed factor is surprising.
cyrille
marius schebella a écrit :
hey frank/list, somehow I managed to get luagl working. (I did a fink install lua51 and lua51-dev and the rest (luagl/opengl) was still there from one of my earlier attempts - I am still trying to reconstruct the installation process... running the patch, that you posted some time ago (with the colored lines) I get an amazing speed advantage for lua. is this a valid performance test? because with lua I can draw 20000 lines at a cpu usage of 80%, the gem part eats up 80% already with 2000 lines (10:1). cheers, marius.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
#N canvas 596 356 620 317 10; #X obj 314 59 gemwin; #X msg 315 34 create , 1; #X obj 102 60 gemhead; #X msg 394 33 0; #X floatatom 160 57 5 0 0 0 - - -; #X obj 104 84 msgltest2; #X floatatom 208 56 5 0 0 0 - - -; #X connect 1 0 0 0; #X connect 2 0 5 0; #X connect 3 0 0 0; #X connect 4 0 5 1; #X connect 6 0 5 2;
-- test code marius 02/08 -- marius.schebella@gmail.com
require 'luagl'
local msgltest2 = pd.Class:new():register("msgltest2")
function msgltest2:initialize(name, atoms) self.inlets = 3 self.max = 3 self.drawmode = 3 pd.post(tostring(self.drawmode)) pd.post(tostring(self)) return true end
function msgltest2:in_1(sel, atoms) if sel == "gem_state" then msgltest2:render(self) end end
function msgltest2:in_2_float(f) self.max = math.abs(f) pd.post(self.max) end
function msgltest2:in_3_float(g) self.drawmode = math.abs(g) end
function msgltest2:render(myself) max = math.max(myself.max, 1) glBegin(myself.drawmode) glColor3d(math.random(), math.random(), math.random()) for i=1,max do glVertex2d(math.random(-400,400)/100, math.random(-400,400)/100) end glEnd() end