Hmm... ok..

So perhaps 
https://code.jsoftware.com/wiki/Guides/Window_Driver/gl2_Command_Reference
should include a caution that use of these commands outside a drawing
context would crash?

That said, I am also puzzled that a small variation crashes J for me:

require'gl2'
coinsert'jgl2'
a_b_paint=:{{
  glfont'arial 15'
  glrgb 0 0 0
  gltextcolor ''
  glrgb 255 0 0
  glbrush''
  glrect 10 10 100 100
  gltextxy 50 50
  gltext 'hello'
  M=:glqtextmetrics''
}}

wd 'pc a closeok'
wd 'minwh 450 350'
wd 'cc b isigraph flush'
wd 'pshow'

What should I have known here, to prevent this crash?

Thanks,

-- 
Raul

On Fri, Nov 19, 2021 at 9:00 AM chris burke <[email protected]> wrote:
>
> I think this is because isigraph controls issue paint events, and the gl
> commands must be given in the paint event handler. For example:
>
> require'gl2'
>
>
> a_b_paint=: 3 : 0
>
> glrgb 0 0 0
>
> gltextcolor ''
>
> glrgb 255 0 0
>
> glbrush''
>
> glrect 10 10 100 100
>
> gltextxy 50 50
>
> gltext 'hello'
>
> )
>
>
> coinsert'jgl2'
>
> wd 'pc a closeok'
>
> wd 'minwh 450 350'
>
> wd 'cc b isigraph flush'
>
> wd 'pshow'
>
> On Thu, Nov 18, 2021 at 6:39 PM Raul Miller <[email protected]> wrote:
>
> > This crashes J for me:
> >
> >    require'gl2'
> >    coinsert'jgl2'
> >    wd 'pc a closeok'
> >    wd 'minwh 450 350'
> >    wd 'cc b isigraph flush'
> >    wd 'pshow'
> >    glrgb 0 0 0
> >    gltextcolor ''
> >
> > (Note to self, for later: I am trying to do is get glqtextmetrics to
> > function, but all my experiments so far have given me a domain error
> > or a crash.)
> >
> > FYI,
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to