XML Feeds

.

[jitter] drawraw in jit.gl.lua

Alexandre Quessy alexandre at quessy.net
Fri Jul 13 16:03:59 MDT 2007


Hi all, 
Drawing multiple gridshapes without the drawraw seems pretty slow, since it resets the openGL stack everytime it draws one. (as in position, color, rotation, etc.) Regarding this, I can say that a program closer to a scene graph (such as Gem, which I am used to) is easier on the CPU/GPU bus since it doesn't reset the OpenGL stack so open, and it is also easier to position and rotate elements relatively to each other. 

Anyways : now I want to drawraw some shapes using Lua. Here is a piece of code. There is the "BindTexture" that doesn't work (expects an integer, id of a texture ??) and some other stuff. Anyone has suggestions on how I could improve this and make it work ? With that, I will be able to create a little Lua library for creating gridshapes and such. Thanks a lot for any input. 


test = {}
test.videoplane = jit.new("jit.gl.videoplane", "output")
test.videoplane.automatic=0
test.texture_number = 1 -- how can i get the texture number ?

function draw()
  gl.Enable("BLEND")
  gl.BlendFunc(6,1)
  gl.Disable("DEPTH_TEST")
  gl.Color(1,1,1,0.3)
  gl.Scale(0.1,0.1,1)
  gl.BindTexture("TEXTURE_2D", test.texture_number)
  
  for i=1,100 do
  	gl.PushMatrix()
  	  gl.Translate(i/150.0,0,0)
      gl.Rotate(i,0,0,1)
      test.videoplane:drawraw()
    gl.PopMatrix()
  end
end




More information about the jitter mailing list