Hi Brian - It sounds like it should work if you are evaluating a drawLines call after each ajax request and not refreshing the whole page.
Can you post the full code or at least the part that handles the ajax response to better diagnose? On Mar 8, 2014 2:18 PM, "Brian Schott" <[email protected]> wrote: > I have successfully drawn gl.LINES in my adaptation of Eric's demogl1.ijs, > but each time I draw a new line that the user's command produces (for > example, say `forward 2` produces a line from 0,0,0 to 0,2,0) all of the > graphics on the incumbent canvas are erased, and that line (from 0,0,0 to > 0,2,0) is all that shows. What can I do to keep the incumbent graphics to > stay and the new line to show, also? > > Eric's code executes the function drawPrimitve() (see below) multiple times > with multiple lines and they all draw. The only differences are that > > (1) when Eric does this, all of the calls to drawPrimitve() are in the same > function draw(), while my function is named drawLines(), and > > (2) my function drawLines() is called after ajax stuff is used to get the > new line. > > I have looked into lots of alternatives, but cannot see an answer myself. > > function drawLines(linecolor,vertices) { > gl.lineWidth(4); > drawPrimitive( gl.LINES, linecolor, vertices); > gl.lineWidth(1); > } > > // Copied directly from demogl1.ijs > function drawPrimitive( primitiveType, color, vertices ) { > gl.enableVertexAttribArray(aCoords); > gl.bindBuffer(gl.ARRAY_BUFFER,aCoordsBuffer); > gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), > gl.STREAM_DRAW); > gl.uniform4fv(uColor, color); > gl.vertexAttribPointer(aCoords, 3, gl.FLOAT, false, 0, 0); > gl.drawArrays(primitiveType, 0, vertices.length/3); > } > > Thanks, > > -- > (B=) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
