[jitter] drawraw in jit.gl.lua
Wesley Smith
wesley.hoke at gmail.com
Fri Jul 13 20:34:32 MDT 2007
- Previous message: [jitter] drawraw in jit.gl.lua
- Next message: [jitter] Re: drawraw in jit.gl.lua
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
use jit.gl.bindtexture(texturename, textureunit)
example
tex = jit.new("jit.gl.texture", this.drawto)
jit.gl.bindtexture(tex.name, 0)
drawobject()
jit.gl.unbindtexture(tex.name, 0)
wes
On 7/14/07, Alexandre Quessy <alexandre at quessy.net> wrote:
>
> 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
>
>
> _______________________________________________
> jitter mailing list
> jitter at cycling74.com
> http://www.cycling74.com/mailman/listinfo/jitter
>
- Previous message: [jitter] drawraw in jit.gl.lua
- Next message: [jitter] Re: drawraw in jit.gl.lua
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
