JOGL Update: Jogl OS X Port is Nigh :)

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
http://jausoft.com/blog/2011/10/13/jogl-osx-port/

+++

Since the mouse features were to easy to add and my Android vacation should take a bit longer, our OS X port was a good candidate to burn some hours I don’t have.

What should work for OS X by now:

    NEWT Top-Level Windowing
    NEWT Child Window w/ NEWT Parent
    NEWT Child Window w/ AWT Parent
    JOGL incl. shared context
    NEWT works w/ AWT enabled JVM out of the box
    Method to execute a Runnable on the MainThread
    The new native Jar loading facility (Application, Applet, Webstart)

The window positioning code was a torture, since the AWT components are not top-level on OS X. Hence we have to calculation the proper screen size position in bottom-left coordination space, even when resizing the window.
Maybe there are still some glitches in case of a NEWT child within an AWT floating Container, but most cases work fine.

Shared or offscreen context destruction was another issue.
We have to run this task on the MainThread, otherwise we experienced a ~10s freeze.

Btw our MainThread semantics have been simplified a lot.
On OS X, it just launches the user main class in a new thread while continuing as the NSApp MainThread.
In short, it is no more required when using an AWT enabled JVM, since it already launches as the NSApp MainThread.

After a few more cleanups, I will prepare the next release and test our new native Jar loading mechanism
and Applets in general.

Note on the side: Motivation for the OS X port was not my liking of the platform, which I don’t, but to just complete our platform independent solution. Hence having NEWT working well on OS X is mandatory here.

+++

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Wade Walker
Administrator
Thanks for the huge amount of great work you've been doing recently on JOGL! I personally am really looking forward to the OS X refresh :) Will this also fix the Plugin2-related problems we have with applets?
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Friday, October 14, 2011 05:55:53 PM Wade Walker [via jogamp] wrote:
>
> Thanks for the huge amount of great work you've been doing recently on JOGL!
Sorry for forcing you to repeat that statement of yours so often,
no .. let's hope I can satisfy it continusously :)
Thx.

> I personally am really looking forward to the OS X refresh :) Will this also
> fix the Plugin2-related problems we have with applets?

At least w/ using NEWT I guess, but let me finish it
later today, then we know.

Plus .. I guess I need to add OS X's way of supporting GL profiles,
however - I haven't updated to the latest OS X version yet.

Question is: Is there one license for all machines, or do I need to
purchase one for each ?

Another one .. shall we update the build machine to the latest ?
(Compatibility .. etc)

Let's see ..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
In reply to this post by Sven Gothel
NEWT/OSX done:
- pointer / mouse features are added
- proper focus management (still a few test failures in this regard though)

TODO OSX:
- OpenGL NS/CG separation/switch in top class MacOSXCGLContext
- OpenGL profiles via 'pixmap attributes' to support >= 3.0
- Applets ..
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Sunday, October 16, 2011 03:59:48 PM Sven Gothel [via jogamp] wrote:
>
> NEWT/OSX done:
> - pointer / mouse features are added
> - proper focus management (still a few test failures in this regard though)
>
> TODO OSX:
> - OpenGL NS/CG separation/switch in top class MacOSXCGLContext
> - OpenGL profiles via 'pixmap attributes' to support >= 3.0

.. currently working on the above 2 issues.

> - Applets ..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

alterscape
Sven,
  Thank you for getting GL3.2 going on Lion! It's very much appreciated!

Cheers,
Ryan
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
In reply to this post by Sven Gothel
On Tuesday, October 25, 2011 04:21:39 AM Sven Gothel wrote:

> On Sunday, October 16, 2011 03:59:48 PM Sven Gothel [via jogamp] wrote:
> >
> > NEWT/OSX done:
> > - pointer / mouse features are added
> > - proper focus management (still a few test failures in this regard though)
> >
> > TODO OSX:
> > - OpenGL NS/CG separation/switch in top class MacOSXCGLContext
> > - OpenGL profiles via 'pixmap attributes' to support >= 3.0
>
> .. currently working on the above 2 issues.

yum, GL3 is done

>
> > - Applets ..

The situation on Applets is a tricky one.

As we know on OS X >= 10.6.4 when using Applets,
the JAWT binding only supports the JAWT_SurfaceLayers/CALayers approach,
ie offscreen rendering (pbuffer) binding with a special
CALayers management (context, render trigger, ..).

The JAWT_SurfaceLayers/CALayers approach is opt-in via the JAWT_GetAWT version bit.

First I tried to just use our NewtCanvasAWT,
since it creates a child window bound to the native JAWT window handle.
This actually still works since the native window handle still exists
via JAWT_MacOSXDrawingSurfaceInfo if not opt-in the CALayer.

However, when run within the browser as an applet,
the JAWT_MacOSXDrawingSurfaceInfo's position is 0/0,
hence we don't see the absolute screen position.
This is also observed when retrieving the Applet's getLocationOnScreen().

This behavior might be a bug, or it is intended .. I don't know.
It would be very much appreciated if somebody like to file a bug report
with Apple and 'maintain' it's communication in this regard.

Another issue to communicate w/ Apple would be if they will
cut-off the 'JAWT_MacOSXDrawingSurfaceInfo' information and hence
the cocoaViewRef while enforcing the JAWT_SurfaceLayers/CALayer.
This would finally cut-off our native-parenting approach we utilize
w/ NewtCanvasAWT - and would force us to impl. this behavior completly w/ CALayers,
regardless whether it's an applet or application.

It seems to be required to implement the CALayer
support within our GLContext/GLDrawable OSX stack, ie add it next to
NSOpenGL* and CGL* ..

This OS X work is visible in the branch 'osx_jawt_calayers'.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Wade Walker
Administrator
Great work on Mac GL 3! Once this is finalized and I get a little time, I'm going to go back to my RCP tutorials and redo them with the new NEWT GLCanvas and GL 3, since it'll be workable across all platforms

Sven Gothel wrote
However, when run within the browser as an applet,
the JAWT_MacOSXDrawingSurfaceInfo's position is 0/0,
hence we don't see the absolute screen position.
This is also observed when retrieving the Applet's getLocationOnScreen().

This behavior might be a bug, or it is intended .. I don't know.
It would be very much appreciated if somebody like to file a bug report
with Apple and 'maintain' it's communication in this regard.
Normally I would volunteer, but I was planning to take a look at bug 520 (https://jogamp.org/bugzilla/show_bug.cgi?id=520) next, since we've seen a couple of reports of problems with recent Mobility Radeons lately. If that bug is quick, I can try to help with this afterwards if no one else has come forward by then.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Cork
In reply to this post by Sven Gothel
That's good news and something I've been looking forward to for a long time, well done!  So it sounds like with the latest mouse work we are almost feature complete for a minecraft clone :)  Is switching into/out-of fullscreen also supported under OSX? or is this also a OSX Lion only feature?  
Well anyway it seem I 'll soon have to dust off my game project and have another go at porting it over to NEWT. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

gouessej
Administrator
Hi

I hope you plan to make something different instead of another clone of Minecraft. The mouse work is not done, there are still some problems on some platforms.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Thursday, November 03, 2011 03:44:11 PM gouessej [via jogamp] wrote:
>
> The mouse work is not done, there are still some problems on some
> platforms.

I remember your wer mentioning something, but I fail to see a good description
or bug report on this one. Pls elaborate, so we/I can vaerify and fix.
Maybe you can create a unit tests for it, since I didn't ..
Thank you.

(Me still hacking in the OSX CALayer ..)

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
In reply to this post by Sven Gothel
On Saturday, October 29, 2011 03:16:39 PM Sven Gothel wrote:
>
>
> It seems to be required to implement the CALayer
> support within our GLContext/GLDrawable OSX stack, ie add it next to
> NSOpenGL* and CGL* ..
>
> This OS X work is visible in the branch 'osx_jawt_calayers'.

Impl. based on pbuffer now, since I could get it working using
via a simple NSView .. guess it's not even possible.

OS X 'offscreen layer surface' works for
  - GLCanvas
    - TODO: resize

  - NewtCanvasAWT
    - TODO: resize
    - TODO: currently only hacked with OffscreenWindow, minor issue though


Resize requires recreation of the offscreen pbuffer ofc.
and will be addressed later.

Due to the wide spread changes I need to validate regressions 1st
before I can close this task.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

gouessej
Administrator
In reply to this post by Sven Gothel
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Wednesday, November 09, 2011 01:07:51 PM gouessej [via jogamp] wrote:
>
> done:
> https://jogamp.org/bugzilla/show_bug.cgi?id=525
> https://jogamp.org/bugzilla/show_bug.cgi?id=525 

thank you, it's in the queue now :)

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Wade Walker
Administrator
In reply to this post by Sven Gothel
Sven Gothel wrote
Due to the wide spread changes I need to validate regressions 1st before I can close this task.
Yeah, I took a look at how much code would have to change to accomodate this new Safari version and was scared

So will this version work in Firefox on the Mac too, since it's compatible with Plugin 2?

Thanks so much for your work on this, I can't wait to update all my tutorials with a GL 3+ canvas across all three platforms
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Thursday, November 10, 2011 03:52:13 AM Wade Walker [via jogamp] wrote:
>
> Sven Gothel wrote:
> >
> > Due to the wide spread changes I need to validate regressions 1st before I
> > can close this task.
> >
>
> Yeah, I took a look at how much code would have to change to accomodate this
> new Safari version and was scared

Actually .. after reviewing and fixing regressions .. it looks more simple:

+++

Strategy for JAWTWindow:
  if OSX >= 10.6.4 && container-is-Applet
    if setJAWTVersion(CALayer)==OK
      OSXJAWTWindow is set to offscreenLayerSurface-mode

If GLDrawable's NativeWindow is a direct offscreenLayerSurface-mode (GLCanvas)
or it's parent NativeWindowHolder (ie NewtCanvasAWT),
it's created as an Offscreen/Pbuffer .. and our NSOpenGLLayer is being used
and attached.

+++

The other changes are more related to the above situation,
ie. a NativeWindow may become offscreen on-the-fly (NEWT).

Resize w/ offscreen -> recreate.

General 'harden' the existing code, ie removing bugs
not visible due to the previous value-space,
which has been widen now thx to this new use-case.

The good thing is that our architecture didn't need to change.
One just need to make sure that the GL code (GLEventListener)
is correct in respect to recreation (multiple init/destroy cycles).

>
> So will this version work in Firefox on the Mac too, since it's compatible
> with Plugin 2?

Sure it is, at least on paper/spec.

Actually all browsers are supposed to use the new CALayer now
so we shall work well with GLCanvas and NewtCanvasAWT.

The latter will work better, since it can support 'recreation'
and hence reparenting (CALayer/NSView) and resize.

>
> Thanks so much for your work on this, I can't wait to update all my
> tutorials with a GL 3+ canvas across all three platforms
>

You are welcome .. sure we need to be platform complete.
Even though I am not a OS X 'fan',
this experience lead to another code review and bug fixes.

I will send an email soon when this branch works 'well',
ie tested w/ Applets etc..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
In reply to this post by Sven Gothel
On Wednesday, November 09, 2011 08:03:05 AM Sven Gothel wrote:
>
> OS X 'offscreen layer surface' works for
>   - GLCanvas
>     - TODO: resize
done

>
>   - NewtCanvasAWT
>     - TODO: resize
done

>     - TODO: currently only hacked with OffscreenWindow, minor issue though
done

Also made a thorough regression verification locally,
all unit tests passed on linux so far.

TODO:
  - applet test - the actual goal :)
  - merge back to master ..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

jouvieje
Sven Gothel wrote
Another one .. shall we update the build machine to the latest ?
(Compatibility .. etc)
Not sure what your build scripts depends on but I know that xcode4 has drop compatibility to 10.4 and 10.5 (got the funny surprise updating xcode weeks ago).
There some way to add back the support to os x 10.4 and 10.5 in xcode 4 (involve installing xcode3, then xcode4 and use some symbol link to old sdk and gcc) but not sure if that's possible in lion (aka 10.7).
Jérôme
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
On Friday, November 11, 2011 12:27:54 PM jouvieje [via jogamp] wrote:

>
> Sven Gothel wrote:
> >
> > Another one .. shall we update the build machine to the latest ?
> > (Compatibility .. etc)
> >
> Not sure what your build scripts depends on but I know that xcode4 has drop
> compatibility to 10.4 and 10.5 (go the funny surprise updating xcode weeks
> ago).
> There some way to add back the support to os x 10.4 and 10.5 in xcode 4
> (involve installing xcode3, then xcode4 and use some symbol link to old sdk
> and gcc) but not sure if that's possible in lion (aka 10.7).

Thank you, I already upgraded to 10.7.
Code should still be able to run on 10.5/10.6 ..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Update: Jogl OS X Port is Nigh :)

Sven Gothel
Administrator
In reply to this post by Sven Gothel
On Friday, November 11, 2011 10:08:58 AM Sven Gothel wrote:

> On Wednesday, November 09, 2011 08:03:05 AM Sven Gothel wrote:
> >
> > OS X 'offscreen layer surface' works for
> >   - GLCanvas
> >     - TODO: resize
> done
>
> >
> >   - NewtCanvasAWT
> >     - TODO: resize
> done
>
> >     - TODO: currently only hacked with OffscreenWindow, minor issue though
> done
>
> Also made a thorough regression verification locally,
> all unit tests passed on linux so far.
>
> TODO:
>   - applet test - the actual goal :)
>   - merge back to master ..
>

http://jogamp.org/git/?p=jogl.git;a=commit;h=8a16d590fe2c739badbabe4906cbe9d60b20e2b9

Applet's on OS X are working:

  - OS X 10.6.4

    - Safari:

      - Hangs for a while at start .. whole screen freezes .. approx. 10s

      - Sometimes crashes when Applet stops - after all our resources are released!

      - Keyboard input isn't assigned sometimes.

      - Otherwise .. works well, incl. offscreen/onscreen parenting



    - Firefox 8.0:

      - Hangs for a while at start .. whole screen freezes .. approx. 10s

      - Sometimes crashes when Applet stops - after all our resources are released!

      - Keyboard input is never assigned.

      - Otherwise .. works well, incl. offscreen/onscreen parenting



  - OS X 10.7

    - Safari:

      - Sometimes crashes when Applet stops - after all our resources are released!

      - Keyboard input isn't assigned sometimes.

      - Otherwise .. works well, incl. offscreen/onscreen parenting



    - Firefox 8.0:

      - Sometimes crashes when Applet stops - after all our resources are released!

      - Keyboard input is never assigned.

      - Otherwise .. works well, incl. offscreen/onscreen parenting
> ~Sven
>
12