From: Sunil Mishra
Subject: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <efyyamr54t9.fsf@whizzy.cc.gatech.edu>
Hi,

I want to do something that is perhaps is dangerous to even consider (for
my mental health).

What I want to do is to write an interface that will allow me to browse and
annotate a quicktime movie on an SGI running lispworks. I want to write a
CLIM application to do this. I don't know if this is possible, but my
understanding is that it might be, so I decided to try and get some help.

To display a quicktime movie, I need an OpenGL window. Then, I can bind a
movie to this window, and render the frames. There are two ways in which
this *might* be possible.

1. I could start up a CLIM application, hand a sheet (a mirror?) over to a
   C routine that sets up OpenGL for this sheet and handles movie controls
   and events. I don't think OpenGL can do this with a part of an already
   open window, so this method may be impossble from the start.

2. Open a window set up for OpenGL, and use it to display a CLIM
   application. Then, since the window is already set up for OpenGL, I
   ought to be able to bind a movie to some section of this window more
   easily. I would have to make sure display works right, which might mean
   having to write a new output record or gadget or some such. (I'm not
   fluent in CLIM either. This will be a learning experience...) There is a
   CAPI interface to OpenGL, which gives me some hope. Now, if someone
   could help me out with the relationship between CAPI and CLIM on
   lispworks, I will probably be able to figure out how to get this thing
   working.

If this turns out to be possible, I might try it down the line. For now, I
have a workable solution already in mind. Use a C routine to handle the
movie, and poll it through a second thread which would post fake events to
a CLIM application. This does have the disadvantage of involving two
windows, which is why I would rather not use this in the long run.

Any advice?

Thanks,

Sunil

From: Mike McDonald
Subject: Re: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <78j1td$qci$1@spitting-spider.aracnet.com>
In article <···············@whizzy.cc.gatech.edu>,
	Sunil Mishra <·······@whizzy.cc.gatech.edu> writes:
> Hi,
> 
> I want to do something that is perhaps is dangerous to even consider (for
> my mental health).
> 
> What I want to do is to write an interface that will allow me to browse and
> annotate a quicktime movie on an SGI running lispworks. I want to write a
> CLIM application to do this. I don't know if this is possible, but my
> understanding is that it might be, so I decided to try and get some help.
> 
> To display a quicktime movie, I need an OpenGL window. Then, I can bind a
> movie to this window, and render the frames. There are two ways in which
> this *might* be possible.
> 
> 1. I could start up a CLIM application, hand a sheet (a mirror?) over to a
>    C routine that sets up OpenGL for this sheet and handles movie controls
>    and events. I don't think OpenGL can do this with a part of an already
>    open window, so this method may be impossble from the start.

  Sure you can. It's not that unusually for a C app to build an Xt UI, take
one of the windows and have OpenGL render in it. Richard Mann has a Lisp
interface to OpenGL, so you might be able to avoid C all together.

http://www.neci.nj.nec.com/homepages/mann/software-available.html

> 2. Open a window set up for OpenGL, and use it to display a CLIM
>    application. 

  I think this would be much hard than the first approach. CLIM really wants
to create and manage the windows itsself. You'd have to tap into the
realize-mirror method and do everything CLIM would have done to "register" the
window you created. Since that's not specified, it'd be difficult to ensure
you did everything.


  Mike McDonald
  ·······@mikemac.com
From: Sunil Mishra
Subject: Re: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <efysocy6bxo.fsf@whizzy.cc.gatech.edu>
·······@mikemac.com (Mike McDonald) writes:

> > 1. I could start up a CLIM application, hand a sheet (a mirror?) over to a
> >    C routine that sets up OpenGL for this sheet and handles movie controls
> >    and events. I don't think OpenGL can do this with a part of an already
> >    open window, so this method may be impossble from the start.
> 
>   Sure you can. It's not that unusually for a C app to build an Xt UI, take
> one of the windows and have OpenGL render in it. Richard Mann has a Lisp
> interface to OpenGL, so you might be able to avoid C all together.

I don't think I made myself entirely clear. Lispworks comes with an OpenGL
interface too. What I need to do is to share the window between OpenGL and
CLIM, so that *both* may use it simultaneously. That's what makes this
problem particularly messy, and probably impossible.

> > 2. Open a window set up for OpenGL, and use it to display a CLIM
> >    application. 
> 
>   I think this would be much hard than the first approach. CLIM really wants
> to create and manage the windows itsself. You'd have to tap into the
> realize-mirror method and do everything CLIM would have done to "register" the
> window you created. Since that's not specified, it'd be difficult to ensure
> you did everything.

Hmmm... My reasoning was that at some point CLIM must create a window, and
if it were possible to tell it *how* to create that window (create an
OpenGL window rather than a regular X one) I might have a shot. Since
Lispworks has CLIM built on their own interface manager, CAPI, and for CAPI
they have shown how to build an OpenGL interface, I was hoping to find some
way of doing this through CAPI. This would make it implementation
dependent, but oh well...

As far as implementation independence (and simplicity) goes, I might in
fact be better off sticking to my original design, with two windows for the
application - one for the movie and the other for CLIM.

Sunil
From: Robert Monfera
Subject: Re: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <36AF9FCA.DCEF5E7C@fisec.com>
> What I want to do is to write an interface that will allow me to browse and
> annotate a quicktime movie on an SGI running lispworks. I want to write a
> CLIM application to do this. I don't know if this is possible, but my
> understanding is that it might be, so I decided to try and get some help.
> 
> To display a quicktime movie, I need an OpenGL window. Then, I can bind a
> movie to this window, and render the frames. There are two ways in which
> this *might* be possible.
> 
> 1. I could start up a CLIM application, hand a sheet (a mirror?) over to a
>    C routine that sets up OpenGL for this sheet and handles movie controls
>    and events. I don't think OpenGL can do this with a part of an already
>    open window, so this method may be impossble from the start.

I vaguely remember that OpenGL handles things like events (mouseclicks
at certain points).  Probably you can not use CLIM context sensitive
pop-up menus, but there is a lightweight OpenGL menu utility out there.

BTW the OpenGL demo from LispWorks handles mouse input, e.g., you can
manipulate the object with the mouse.

> As far as implementation independence (and simplicity) goes, I might in
> fact be better off sticking to my original design, with two windows for the
> application - one for the movie and the other for CLIM.

Yes, this is what many multimedia applications do.  This way you may
even use dedicated displays if the Lisp environment allows you to do so.

Good luck and keep us informed!

Regards
Robert
From: Christopher R. Barry
Subject: Re: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <87pv7zbw9a.fsf@2xtreme.net>
Robert Monfera <·······@fisec.com> writes:


[...]

> I vaguely remember that OpenGL handles things like events (mouseclicks
> at certain points).  Probably you can not use CLIM context sensitive
> pop-up menus, but there is a lightweight OpenGL menu utility out there.

AFAICR from my toying with OpenGL, nearly all implementations include
glut, the OpenGL utility toolkit. This lets you raise windows and set
up signal and event handlers and do all that stuff that you would
expect a proper toolkit to provide. It's probably the most portable
way to do GUI programming, except for maybe Java[TM].

Christopher
From: Sunil Mishra
Subject: Re: Something ugly with OpenGL, movies and CLIM
Date: 
Message-ID: <efy1zkfwftt.fsf@cleon.cc.gatech.edu>
Robert Monfera <·······@fisec.com> writes:

> I vaguely remember that OpenGL handles things like events (mouseclicks
> at certain points).  Probably you can not use CLIM context sensitive
> pop-up menus, but there is a lightweight OpenGL menu utility out there.

OpenGL does not really handle mouse events. You have to use some kind of
toolkit on top of it, or set up X event handlers.

> BTW the OpenGL demo from LispWorks handles mouse input, e.g., you can
> manipulate the object with the mouse.

> > As far as implementation independence (and simplicity) goes, I might in
> > fact be better off sticking to my original design, with two windows for the
> > application - one for the movie and the other for CLIM.
> 
> Yes, this is what many multimedia applications do.  This way you may
> even use dedicated displays if the Lisp environment allows you to do so.
> 
> Good luck and keep us informed!

Well, I would have been mostly done with the movie controller, except
Lispworks 3.2 appears to have some fairly serious CLIM bugs. (Specifically
the wrong callbacks appear to be invoked for various events involving
gadgets.) I'm thinking of exploring presentation types for the same
functionality, but I don't know how well presentations handle things like
live scrolling (a drag-callback on a slider, for instance) or linking
output with another presentation type. My impression is that it ought to be
possible...

Sunil