OpenGL morphic issue with "embedd in window"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenGL morphic issue with "embedd in window"

LawsonEnglish
Jeroen has been helping me more than a bit with learning how to use
OpenGL with squeak, but I've hit a stumbling block I can't quite get
around and Jereon has been busy lately:


when I put an OGLMoprh in a window via the menu, the close box
apparently doesn't delete the morph the same way as it does via using
the x-halo (without embedding)

The x-halo sends a delete directly to the OGLMorph which sends
OpenGL>>destroy.


However, the window's close box AND the window's x-halo apparently do
things a tiny bit differently.

The window disappears, and the OpenGL context becomes unselectable, but
stays around.

If I send openInWorld to the original OGLMorph, it becomes active again
and the x-halo of  OGLMorph will still do the OpenGL>>destroy on the
context.


I've tried to trace what is happining, but I am missing something. The
messages I expect to be called are not being called, so I can't figure
out where to put the reference to OpenGL>>destroy to tidy things up.


The procedure for installing OpenGL class in squeak 4.1 is:

(Installer repository: 'http://source.squeak.org/FFI')
    install: 'FFI-Pools';
    install: 'FFI-Kernel';
    install: 'FFI-Tests'.

(Installer repository: 'http://www.squeaksource.com/CroquetGL')
    install: '3DTransform';
    install: 'OpenGL-Pools';
    install: 'OpenGL-Core'.

and then install thelatest  OpenGL-Tutorial package via monticello from

'http://croquet-src-01.oit.duke.edu:8886/Contributions'


myMorph := OGLMorph new openInWorld.

menu>> Put in window

will show the behavior I'm talking about.


Thanks for any advice.


Lawson







Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

Ross Boylan
On Sun, 2010-04-18 at 18:28 -0700, Lawson English wrote:

> Jeroen has been helping me more than a bit with learning how to use
> OpenGL with squeak, but I've hit a stumbling block I can't quite get
> around and Jereon has been busy lately:
>
>
> when I put an OGLMoprh in a window via the menu, the close box
> apparently doesn't delete the morph the same way as it does via using
> the x-halo (without embedding)
>
> The x-halo sends a delete directly to the OGLMorph which sends
> OpenGL>>destroy.
>
>
> However, the window's close box AND the window's x-halo apparently do
> things a tiny bit differently.
>
> The window disappears, and the OpenGL context becomes unselectable, but
> stays around.
>
> If I send openInWorld to the original OGLMorph, it becomes active again
> and the x-halo of  OGLMorph will still do the OpenGL>>destroy on the
> context.
I just ran into a similar situation; whether it is similar enough is for
you to judge.  I have a manager class that opens 2 Morphs; when one of
them (a SystemWindow) is killed I wanted the other one killed as well.

I made my manager the model of the SystemWindow morph.  When the
SystemWindow is destroyed, it sends #windowIsClosing to its model (i.e.,
my manager).  The manager can implement #windowIsClosing to delete the
other Morph.

This may or may not be an advisable use of the model mechanism, but it
seems to work.

Ross



Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

LawsonEnglish
Ross Boylan wrote:

> On Sun, 2010-04-18 at 18:28 -0700, Lawson English wrote:
>  
>> Jeroen has been helping me more than a bit with learning how to use
>> OpenGL with squeak, but I've hit a stumbling block I can't quite get
>> around and Jereon has been busy lately:
>>
>>
>> when I put an OGLMoprh in a window via the menu, the close box
>> apparently doesn't delete the morph the same way as it does via using
>> the x-halo (without embedding)
>>
>> The x-halo sends a delete directly to the OGLMorph which sends
>> OpenGL>>destroy.
>>
>>
>> However, the window's close box AND the window's x-halo apparently do
>> things a tiny bit differently.
>>
>> The window disappears, and the OpenGL context becomes unselectable, but
>> stays around.
>>
>> If I send openInWorld to the original OGLMorph, it becomes active again
>> and the x-halo of  OGLMorph will still do the OpenGL>>destroy on the
>> context.
>>    
> I just ran into a similar situation; whether it is similar enough is for
> you to judge.  I have a manager class that opens 2 Morphs; when one of
> them (a SystemWindow) is killed I wanted the other one killed as well.
>
> I made my manager the model of the SystemWindow morph.  When the
> SystemWindow is destroyed, it sends #windowIsClosing to its model (i.e.,
> my manager).  The manager can implement #windowIsClosing to delete the
> other Morph.
>
> This may or may not be an advisable use of the model mechanism, but it
> seems to work.
>  

It sounds like it would work, but it feels "wrong" somehow. :-/

Thanks for the suggestion. I'll use it for now, but I certainly hope
there's a better mechanism available.

Lawson (loving the documentation of Squeak, as always)

Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

LawsonEnglish
In reply to this post by Ross Boylan
Ross Boylan wrote:

> On Sun, 2010-04-18 at 18:28 -0700, Lawson English wrote:
>  
>> Jeroen has been helping me more than a bit with learning how to use
>> OpenGL with squeak, but I've hit a stumbling block I can't quite get
>> around and Jereon has been busy lately:
>>
>>
>> when I put an OGLMoprh in a window via the menu, the close box
>> apparently doesn't delete the morph the same way as it does via using
>> the x-halo (without embedding)
>>
>> The x-halo sends a delete directly to the OGLMorph which sends
>> OpenGL>>destroy.
>>
>>
>> However, the window's close box AND the window's x-halo apparently do
>> things a tiny bit differently.
>>
>> The window disappears, and the OpenGL context becomes unselectable, but
>> stays around.
>>
>> If I send openInWorld to the original OGLMorph, it becomes active again
>> and the x-halo of  OGLMorph will still do the OpenGL>>destroy on the
>> context.
>>    
> I just ran into a similar situation; whether it is similar enough is for
> you to judge.  I have a manager class that opens 2 Morphs; when one of
> them (a SystemWindow) is killed I wanted the other one killed as well.
>
> I made my manager the model of the SystemWindow morph.  When the
> SystemWindow is destroyed, it sends #windowIsClosing to its model (i.e.,
> my manager).  The manager can implement #windowIsClosing to delete the
> other Morph.
>
> This may or may not be an advisable use of the model mechanism, but it
> seems to work.
>
> Ross
>
>
>  

OK, so still confused. I had hoped I could figure out what you meant
concerning adding a morph to the SystemWindow but I can't figure out
where/how to do so.

bertf on #squeak pointed this out to me

http://www.lazarevic.de/download/squeak/OpenGLMorph37.3.cs


tried to do things via >>outOfWorld and >>intoWorld   but of course, not
sure what I'm doing there, either...


Lawson


Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

LawsonEnglish

>
> OK, so still confused. I had hoped I could figure out what you meant
> concerning adding a morph to the SystemWindow but I can't figure out
> where/how to do so.
adding model, not morph...

L

Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

Andreas.Raab
In reply to this post by LawsonEnglish
On 4/19/2010 4:21 PM, Lawson English wrote:

> OK, so still confused. I had hoped I could figure out what you meant
> concerning adding a morph to the SystemWindow but I can't figure out
> where/how to do so.
>
> bertf on #squeak pointed this out to me
>
> http://www.lazarevic.de/download/squeak/OpenGLMorph37.3.cs
>
>
> tried to do things via >>outOfWorld and >>intoWorld but of course, not
> sure what I'm doing there, either...

Those methods get called whenever a Morph appears in or disappears out
of some world. Other methods (delete, hide, collapse, etc) only inform
the *top level* Morph about the change but the intoWorld: / outOfWorld:
method is called for every morph in the structure.

Basically, for your OpenGL morph you should delete the OpenGL instance
whenever you get an #outOfWorld: event. This will ensure that all the
operations you can do with system windows (close, collapse, restore)
will work properly.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

LawsonEnglish
Andreas Raab wrote:

> On 4/19/2010 4:21 PM, Lawson English wrote:
>> OK, so still confused. I had hoped I could figure out what you meant
>> concerning adding a morph to the SystemWindow but I can't figure out
>> where/how to do so.
>>
>> bertf on #squeak pointed this out to me
>>
>> http://www.lazarevic.de/download/squeak/OpenGLMorph37.3.cs
>>
>>
>> tried to do things via >>outOfWorld and >>intoWorld but of course, not
>> sure what I'm doing there, either...
>
> Those methods get called whenever a Morph appears in or disappears out
> of some world. Other methods (delete, hide, collapse, etc) only inform
> the *top level* Morph about the change but the intoWorld: /
> outOfWorld: method is called for every morph in the structure.
>
> Basically, for your OpenGL morph you should delete the OpenGL instance
> whenever you get an #outOfWorld: event. This will ensure that all the
> operations you can do with system windows (close, collapse, restore)
> will work properly.
>
>
Great, thanks.


Lawson


Reply | Threaded
Open this post in threaded view
|

Re: OpenGL morphic issue with "embedd in window"

Ross Boylan
In reply to this post by LawsonEnglish
On Mon, 2010-04-19 at 16:22 -0700, Lawson English wrote:
> >
> > OK, so still confused. I had hoped I could figure out what you meant
> > concerning adding a morph to the SystemWindow but I can't figure out
> > where/how to do so.
> adding model, not morph...
>
> L

See the SystemWindow>>model: method.
Ross