Good. I wasn't sure if that was what you were looking for.

I believe, you could also use gs... routines. See some ramble below.

To put focus on session manager, try smfocusout_jijs_''.


--- Brian Schott <[EMAIL PROTECTED]> wrote:

> Oleg,
> 
>       Yes! Thank you. This is what I was looking for. The
> delay foreign works on the Mac as well. The key seems to be
> that the gl2 verb glpaint recognizes the J delays. (Notice
> that glpaint is distinct from gspaint.)

One thing I noticed about your example is that
it now better follows the pattern set by jzopengl:
_define_ in paint, but _call_ gspaint.
It's important to keep the separation
between your "business" calls (pure OpenGL),
from implementation, like alloc__, flush, etc.
They are on different levels and cannot be mixed.

I believe the recent OpenGL boiler plate API
did a better job in the recent update. Even
I was able to get it!

Although, it may be confusing: there are three kinds of 
"paint": glpaint legacy call to gl2, gspaint umbrella 
from jzopnegl and paint with user command definitions.

You were almost on the right track in the first
example. But you (1) cannot change gspaint, and
(2) put all rendering in paint, using if's or
functions, etc; and it should be surrounded with
gsinit/gsfini.

Another useful separation is to think of the
"go" verb not as "go paint", but as "go change my state"
(and update the canvas). So you can separate the
state from rendering. The go verb would only change
the state, but all the drawing is always done in paint.
Having this state designed, you can easily add
state manipulators, like rotate, move, etc.,
so that you combine them in short one-liners
and interact with the model from the keyboard.
Alternatively the same manipulators can be hooked up
to GUI controls. (Think of Alan Kay's jump from 
Logo to SmallTalk). Objects are about encapsulation
(of state).

This is done greatly in jzopenglutil to support
gschar manipulations. But it could be extended
to operate parameters of models (those that
are in comments in View Definition). Hooked up
to some known keys, they would mutate the models live
which would have a dynamic effect, than console edit 
and Redraw.

Next level would be to place touch sensors on the
model itself... Voice command, Hmm...


>       Your examples relied on the demo's gspaint verb. The
> demo's rely on several global nouns and a verb paint which
> manages rotation and position of the viewing camera relative
> to the modeled object(s). These demo verbs are very slick
> and greatly facilitate keystroke revisions of the camera
> viewing position.
> 
>       My verb go only changes the background color in this
> simple example, not the viewing angle. It could have
> controlled movements like forward (translation) and right
> rotation) of a modeled object. I am including below the
> revised script. To see it work do the following.
> 
> 0     Load the script in the .ijx window (I learned that is
> called the session manager from your post)
> 
> 1     run''
> 2     go go go''
> 
>       You should see the background color change and the
> triangle remain black and in its same position.
> 
> PS. I would like to know how the verb run could be altered
> to place the focus in the session manager at its exit.
> 
> (B=)
> 
> NB. delay.ijs for J601
> NB. patterned after:
> NB. system\examples\graphics\opengl\lab\ogl1.ijs
> 
> clear''     NB. clear base locale
> require 'opengl gl2 gl3'
> coinsert 'jgl2 jgl3'
> 
> delay =: 6!:3
> DELAY =: 1
> 
> GL3LAB=: 0 : 0
> pc gl3lab closeok;
> xywh 0 0 100 100;cc g isigraph rightmove bottommove;
> pas 0 0;
> rem form end;
> )
> 
> run=: 3 : 0
>   wd GL3LAB
>   ogl=: ''conew'jzopengl'
>   wd'pshow;'
>   HWNDC=: wd 'qhwndc g'
>   HW   =: glqwh''
>   alloc__ogl HW
>   CLEARCOLOR =. 4#1
>   glClearColor CLEARCOLOR
>   glClear GL_COLOR_BUFFER_BIT
>   draw__ogl''
>   empty''
> )
> 
> go =: 3 : 0
>   alloc__ogl HW
>   CLEARCOLOR =. ?4#2
>   glClearColor CLEARCOLOR
>   glClear GL_COLOR_BUFFER_BIT
>   glOrtho _1 1 _1 1 _1 1
>   glColor3d 0 0 0
>   glBegin GL_POLYGON
>   glVertex 1  ,0  ,0,1
>   glVertex 0  ,0.5  ,0,1
>   glVertex _1 ,0  ,0,1
>   glEnd ''
>   draw__ogl''
>   delay DELAY   NB. here is the delay
>   glsel HWNDC
>   glpaint''
> )
> 
> On Sun, 23 Apr 2006, Oleg Kobchenko wrote:
> 
> + Immediate steps without timer for j601 beta k or l:
> +
> + - Run the OpenGL demo, select desired model
> +
> + - Type or paste into session manager and execute line by line:
> +
> +    g_z_=: 2 : '(6!:3 bind n)@[EMAIL PROTECTED]'    NB. verb g delay
> +    cocurrent'jgldemo'
> +
> +    (0&gsrotate bind 2) g 0.2^:10''
> +
> +    go=: (0&gsrotate bind 5) g 0.5
> +    go go go''
> +
> +
> +  - Select Soccer Ball model
> +
> +    g1=: (gstranslate bind 0 0.5 0) g 0.5
> +    g2=: (0&gsrotate bind 5) g 0.5
> +    g3=: (gstranslate bind 0 _0.5 0) g 0.5
> +
> +    g1 g2^:3 g3^:2 g2^:3 g1''
> +
> +
> +
> +
> + This produces visible steps of changes.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to