[Jprogramming] openGL stdpaintx
Cliff Reiter
reiterc at mail.lafayette.edu
Sat Jan 28 06:22:23 HKT 2006
Brian,
I encourage you to think about the timer events a bit more.
My vlife script uses very simple timer events, (OK for J504)
http://ww2.lafayette.edu/~reiterc/j/vector/vlife_index.html
and it is discussed a bit in
http://www.vector.org.uk/archive/v213/cliff213.htm
Look for the section "Timer for the Game of Life" almost at the
end in that vector note. Very simple event handlers gave me
what I needed.
Best,
Cliff
schott.brian at gmail.com wrote:
> Eric,
>
> I found the following excerpt in glview.ijs and
> suspect this is the wd timer to which you referred.
> Apparently the toggling is important to the .else clause and
> sys_timer_z_ is critical too. This appears to be beyond my
> abilities.
>
> opengl_slides_button=: 3 : 0
> GLSLIDES=: -. GLSLIDES
> wd 'set slides ',":GLSLIDES
> if. GLSLIDES do.
> wd 'timer 3000'
> sys_timer_z_=: gldemo_slides_jgldemo_
> else.
> wd 'timer 0'
> sys_timer_z_=: ]
> end.
> empty''
> )
>
> (B=)
>
> On Fri, 27 Jan 2006, Eric Iverson wrote:
>
> + I think you'll see that the solar system demo in the OpenGL demo uses timer
> + events this way and you might want to take a look at that code.
> +
> + ----- Original Message -----
> + From: "Eric Iverson" <eiverson at sympatico.ca>
> + To: "Programming forum" <programming at jsoftware.com>
> + Sent: Friday, January 27, 2006 9:42 AM
> + Subject: Re: [Jprogramming] openGL stdpaintx
> +
> +
> + >A quick stab at the problem:
> + > Currently Opengl only paints when the paint event handler is called. The
> + > paint event handler is only called when J (and the host) is idle. This
> + > means you must make J idle each time you'd like an update painted. I
> + > assume you currently drive the steps from a while loop with a 6!:3 delay
> + > and this is never idle so the paint handler never gets called. A possible
> + > workaround is to use a wd timer event. This way J is idle, the timer event
> + > runs J, J creates the new drawing and request the paint, goes idle, the
> + > paint event runs, ...
> + >
> + > The new J601 betas will allow opengl programming at a lower level (cd
> + > calls so you are programming directly at the opengl API rather than
> + > through the C++ wrapper wd provides. It may be possible in this
> + > environment down the road to do an immediate update (the way gl2 graphics
> + > can currently). But this won't help you for some time.
> + >
> + > ----- Original Message -----
> + > From: <schott.brian at gmail.com>
> + > To: <programming at jsoftware.com>
> + > Sent: Friday, January 27, 2006 7:26 AM
> + > Subject: [Jprogramming] openGL stdpaintx
> + >
> + >
> + >> I am revising my turtle graphics system in J to use
> + >> openGL. Much is now working, so that when I manually move
> + >> and turn the turtle with interactive instructions of forward
> + >> (fd) and right (rt), I see the resulting move immediately.
> + >>
> + >> But when I create a dynamic simulation by moving the
> + >> turtle with repeated forwards and rights using the "do" (see
> + >> below), I only see the final turtle position and path at the
> + >> end in a single screen refresh. The path-generating verb
> + >> named "drawpath" ends with "stdpaintx ''" and if I perform a
> + >> debug with a "dbss" (a stop) on the line containing
> + >> "stdpaintx ''", then after each stop at that line, after I
> + >> "dbrun ''" I see the desired intermediate path. (Btw, I have
> + >> added the commands "glFinish ''" and "glFlush ''" after the
> + >> "stdpaintx ''", producing no change.)
> + >>
> + >> ". 'rt 45[fd 13[rt 45[fd 13[rt 45[fd 13[rt 45[fd 13[rt 45[fd 13[rt
> + >> 45[fd 13'
> + >>
> + >> The script can be downloaded:
> + >> http://www.jsoftware.com/jwiki/BrianSchott/code/turtleGraphics/3Dogl
> + >>
> + >> Can anyone suggest a way to fix this?
> + >>
> + >> Thank you,
> + >>
> + >> (B=) <----------my "sig"
> + >>
> + >> Brian Schott
> + >> Atlanta, GA, USA
> + >> schott DOT bee are eye eh en AT gee em ae eye el DOT com
> + >> http://www.cpu-net.com/host/bschott/
> + >> ----------------------------------------------------------------------
> + >> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Clifford A. Reiter
Mathematics Department, Lafayette College
Easton, PA 18042 USA, 610-330-5277
http://www.lafayette.edu/~reiterc
More information about the Programming
mailing list