Mac OS X Porting - OpenGL transitions

From Apache OpenOffice Wiki
Revision as of 08:42, 23 August 2008 by Ericb (Talk | contribs)

Jump to: navigation, search

OpenGL transitions on Mac OS X

Description

In Impress, there are transitions between slides, or 3D effects possible. The problem is, those nice and Funny effects are power consumming, and without hardware acceleration -means software rendered- ,extremely slow , what is not acceptable by users.

This tasks aims to replace the software rendered transitions with hardware accelerated transitions ( OpenGL ) on Mac OS X.

Below the technical description, the involved code, the plan, and so on. Feel free to add information if you estimate it usefull for the task.

Thanks in advance :-)

Goal

Make OpenGL transitions work in Impress, on Mac OS X Aqua

Timeline

Expected timeline: october / november 2008

Examples

FIXME: add screenshots or links for demos

Modifications

Concerned files / ideas

Ideas

Two possibilities :

Everything is based on implement a customized OpenGLView, drawn as a subview of the ( NSView * type) pView.


either implement ( NSView * type) pOpenGLView in vcl, more precisely, modify :

vcl/inc/vcl/sysdata.hxx

vcl/aqua/inc/salframe.h

vcl/aqua/inc/salframeview.h,

vcl/aqua/source/window/salframe.cxx

vcl/aqua/source/window/salobj.cxx

+ the makefile

and in slideshow :

slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.hxx

slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.cxx

slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx


Issue is at buildtime : how to explain the compiler NSView* pOpenGLView has new methods (OpenGL specific), the NSView* pView has not ?

More precisely, there are warnings because the pOpenGLView is supposed receive no answer from the OpenGL specific methods used in OGLTrans_TransitionerImpl.cxx. In theory, it should work out of the box, but the code aims to be warning free; so this solution is not acceptable.

Workaround could be implement the new methods directly in the NSView, or delegate. Just wild guess [FIXME]


or

create the AquaOpenGLView object directly in slideshow, modify the other slideshow files mentioned above (changes are similar)

Result: the subview works, as expected.

Test : a right click in the transition demo, using the presentation wizard, give the same contextual menu we have in fullscreen (yes, this is weird, but the context seems to be ok, what is encouraging for the future).

Known issue: there is no communication between the subView and the NSApplication, events are lost, timeout and chaos in event queue

-> deadlock and crash.

TODO: Second test will consist in delegate the notifications send for the refresh, to the NSApp.


It is expected, once this NSOpenGL view will work, this should be no problem to use it from the slideshow.

Communication between slideshow object and the NSApplication ( customized NSView, itself inheriting of NSWindow) will use the notification center as proxy (what is extremely fast in theory).

Pb: visibility of the vcl/aqua/inc headers from slideshow at buildtime

Update: predeclaration in vcl/inc/vcl/sysdata.hxx will help a lot. Needs to be confirmed.

Concerned files

Task : build the lib

slideshow/source/engine/OGLTrans/makefile.mk

add the case Aqua, modify CFLAGSCXX + add fremaworks OpenGL, GLUT and Cocoa for linking

Task : Deliver the libs / includes:

slideshow/prj/d.lst

deliver the new lib on Aqua ( libOGLTrans.dylib )


Modified files :

slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.cxx

slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.hxx

slideshow/source/engine/OGLTrans/OglTrans_TransitionerImpl.cxx


New files (to be confirmed) :

slideshow/source/engine/OGLTrans/aquaOpenGLView.h

slideshow/source/engine/OGLTrans/aquaOpenGLView.m

Concerned modules

  • config_office : make OpenGL default on Mac OS X Aqua => ENABLE_OPENGL=TRUE
  • slideshow : where the lib is built. This lib is linked with libvcl ( vcl must be built before slideshow )
  • vcl ( add NSOpenGLView* in salframe.h ? / implement it in NSApp + NSApp should receive notifications, maybe an object should be added and managed)
  • scp2 : to add the new lib in the package
  • other changes ?

Issues attached to the task

issue 93013

TODO (draft)

  • build the OpenGL trans lib, warning free, on Mac OS X
    • [DONE] fix warnings and breakages, with empty implementation
    • [DONE] fix linking
    • [DONE] create customized NSView (skeleton, and pre-implementation)
  • [DONE] add the lib to the package
  • register the lib
  • Design the first implementation
  • implement NSOpenGLView or customize an NSView
    • manage OpenGL context
    • manage OpenGL pixels mapping
    • manage events and notifications critical
    • initialize the view properly in splitted view
    • implement the fullscreen mode
  • finalize the transitions integration in Aqua bundle
  • make transitions work
  • test
  • integrate

Notes about lib registration :

When using UNO services ( if I'm not wrong) a lib must be listed in services.rdb blob.

To achieve that, place you in the bundle :

cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program
chmod ug+w services.rdb  # else everything below will fail 
../ure-link/bin/regcomp -register -r ./services.rdb -c libOGLTrans.uno.dylib
../ure-link/bin/regcomp -register -r ./services.rdb -c slideshow.uno.dylib
../ure-link/bin/regcomp -register -r ./services.rdb -c libslideshowtestmxi.dylib
chmod ug-w services.rdb

With the new libs you built previously

If you wan't to fo backward, just replace register with 'revoke in the same place, using similar command line :

cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program
chmod ug+w services.rdb  # else everything below will fail 
../ure-link/bin/regcomp -revoke -r ./services.rdb -c libOGLTrans.uno.dylib
../ure-link/bin/regcomp -revoke -r ./services.rdb -c slideshow.uno.dylib
../ure-link/bin/regcomp -revoke -r ./services.rdb -c libslideshowtestmxi.dylib
chmod ug-w services.rdb

LINKS

Below a now exhaustive list of links. Feel free to add interesting links !

Apple OpenGL Documentation

Cocoa OpenGL

Custom GLView

NSView + OpenGLView in Apple database

NSOpenGLView initialisation issue

COMPLETE ME

Bla bla ...


Page created Ericb 11:55, 22 August 2008 (CEST)

Personal tools