Strange behavior with gl.sketch and javascript

Oct 24, 2012 at 4:33pm

Strange behavior with gl.sketch and javascript

I have been working on converting some tutorials to javascript.

http://cycling74.com/docs/max5/tutorials/jit-tut/jitterchapter40.html

In the third example of the tutorial, it defines a triangle with different colored corners.
In my javascript version, only the last glcolor command shows. Which makes me think
that something is getting lost when sending commands to gl.sketch via javascript.

Anyone have any ideas?

autowatch = 1;
inlets = 1;

var windowout = new JitterObject(“jit.window”,”Sketchrender”);
windowout.depthbuffer = 0;
windowout.idlemouse = 1;
windowout.fsaa = 1;

var render = new JitterObject(“jit.gl.render”,”Sketchrender”);
render.ortho = 1;
render.erase_color = [0,0,0,1];

function bang()
{
render.erase();
render.drawclients();
render.swap();
}

function draw()
{
drawTriangle3();
}

function drawTriangle3()
{
var sketch = new JitterObject(“jit.gl.sketch”,”Sketchrender”);
with(sketch)
{
reset();
glbegin(“triangles”);
glcolor(1, 0, 0, 1);
glvertex(-0.5, -0.5);
glcolor(0, 1, 0, 1);
glvertex(0, 0.5);
glcolor(0, 0, 1, 1);
glvertex(0.5, -0.5);
glend();
}
bang();
}

#64907
Oct 24, 2012 at 4:51pm

Here is my test patch as well.

#234024

You must be logged in to reply to this topic.