Difference between revisions of "Mac OS X Porting - OpenGL transitions"
(→''' TODO (draft)''') |
|||
Line 3: | Line 3: | ||
=== Description === | === Description === | ||
− | '''In Impress, there are transitions between slides, with or without funny 3D effects. The problem is, those nice and Funny effects are power | + | '''In Impress, there are transitions between slides, with or without funny 3D effects. The problem is, those nice and Funny effects are power consuming, 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 on Mac OS X.''' | '''This tasks aims to replace the software rendered transitions with hardware accelerated transitions on Mac OS X.''' | ||
Line 19: | Line 19: | ||
=== Timeline === | === Timeline === | ||
− | Expected timeline: ''' | + | Expected timeline: '''October / November 2008''' |
=== Examples === | === Examples === | ||
Line 29: | Line 29: | ||
=== Existing (historical implementation) === | === Existing (historical implementation) === | ||
− | Common : | + | Common: |
− | vcl/source/opengl.cxx , implements: | + | vcl/source/opengl.cxx, implements: |
− | * functions pointers ( most important gl functions typedef'ed ) | + | * functions pointers (most important gl functions typedef'ed) |
* + corresponding macro for functions initialization | * + corresponding macro for functions initialization | ||
* + impl functions getters | * + impl functions getters | ||
− | * Ctor: | + | * Ctor: parameter pOutDev is a pointer on a OutputDevice*, using mpOutDev |
* Dtor: deletes mpOGL | * Dtor: deletes mpOGL | ||
* usual methods ... and so on | * usual methods ... and so on | ||
− | vcl/source/salogl.cxx : | + | vcl/source/salogl.cxx: |
− | * Static members: | + | * Static members: oslModule (himpOGLLib == libgl.dylib), NSOpenGLContext* .. (bool) state |
* Macros | * Macros | ||
* Callbacks for CreateContext, DeleteContext, MakeCurrent, GetCurrentContext | * Callbacks for CreateContext, DeleteContext, MakeCurrent, GetCurrentContext | ||
Line 51: | Line 51: | ||
->there is a very interesting OpenGL* OutputDevice::GetOpenGL() | ->there is a very interesting OpenGL* OutputDevice::GetOpenGL() | ||
− | FIXME | + | FIXME: To be continued |
− | === | + | === Concerned files / ideas === |
==== ''' Ideas''' ==== | ==== ''' Ideas''' ==== | ||
Line 59: | Line 59: | ||
25th august: | 25th august: | ||
− | After reading a lot of code (mostly vcl), it appears this is not possible ( excepted doing hacks), to use OpenGL without use outdev thing ( got | + | After reading a lot of code (mostly vcl), it appears this is not possible (excepted doing hacks), to use OpenGL without use outdev thing (got systematic crashes using NSOpenGLView directly, and outdev complains about lost events and pending pointers) |
The consequence is, the slideshow calls must be abstraction of CreateContext, MakeCurrentContext, ReleaseContext ..etc. | The consequence is, the slideshow calls must be abstraction of CreateContext, MakeCurrentContext, ReleaseContext ..etc. | ||
− | And the real implementation must go in vcl/aqua/source/gdi/salogl.cxx , respecting vcl/source/gdi/opengl.cxx virtual classes. | + | And the real implementation must go in vcl/aqua/source/gdi/salogl.cxx, respecting vcl/source/gdi/opengl.cxx virtual classes. |
− | The plan ( to be confirmed seems to be): | + | The plan (to be confirmed seems to be): |
* design the abstraction we'll use, and prepare the OGLTrans_TransitionerImpl.cxx like it is for Linux, but adapted to Mac OS X | * design the abstraction we'll use, and prepare the OGLTrans_TransitionerImpl.cxx like it is for Linux, but adapted to Mac OS X | ||
Line 76: | Line 76: | ||
− | ====Possibilities :==== | + | ====Possibilities:==== |
− | Everything is based on implement an OpenGLView | + | Everything is based on implement an OpenGLView adding a new NSOpenGLView* pOpenGLView object in sysdata.hxx, or an NSView drawn as a subview of the (NSView * type) pView. |
'''TODO''': investigate about ImplOutdev and co | '''TODO''': investigate about ImplOutdev and co | ||
− | Try 1 : '''either''' implement ( NSView * type) pOpenGLView in vcl, more precisely, modify : | + | Try 1: '''either''' implement (NSView * type) pOpenGLView in vcl, more precisely, modify: |
vcl/inc/vcl/sysdata.hxx | vcl/inc/vcl/sysdata.hxx | ||
Line 96: | Line 96: | ||
+ the makefile | + the makefile | ||
− | and in slideshow : | + | and in slideshow: |
slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.hxx | slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.hxx | ||
Line 105: | Line 105: | ||
− | '''Issue is at buildtime''' : | + | '''Issue is at buildtime''': |
− | Pb: | + | Pb: visibility of the vcl/aqua/inc headers from slideshow at buildtime |
Update: predeclaration in vcl/inc/vcl/sysdata.hxx will help a lot. | Update: predeclaration in vcl/inc/vcl/sysdata.hxx will help a lot. | ||
Line 121: | Line 121: | ||
(maybe completely wrong, but worth a try) | (maybe completely wrong, but worth a try) | ||
− | Implement the OpenGL methods directly in the SalframeView. just two methods have the same names/parameters numbers, so just | + | Implement the OpenGL methods directly in the SalframeView. just two methods have the same names/parameters numbers, so just rename they properly to avoid clash. Important: initWithFrame for OpenGL has two parameters, while initWithFrame for normal NSView has only one. |
Try 3 '''or''' | Try 3 '''or''' | ||
− | Add an NSOpenGLView * pOpenGLView in the sysdata.hxx , and modify everything in vcl accordingly. | + | Add an NSOpenGLView * pOpenGLView in the sysdata.hxx, and modify everything in vcl accordingly. |
<div align="left" style="color:blue; font-size:18px">''' [[Mac_OS_X_Porting_-_OpenGL_transitions/NSOpenGLView | ==> click here to have a look at NSOpenGLView available methods]]''' </div> | <div align="left" style="color:blue; font-size:18px">''' [[Mac_OS_X_Porting_-_OpenGL_transitions/NSOpenGLView | ==> click here to have a look at NSOpenGLView available methods]]''' </div> | ||
Line 131: | Line 131: | ||
− | Thus, in OGLTrans_TransitionerImpl.cxx | + | Thus, in OGLTrans_TransitionerImpl.cxx instanciate |
an NSView who is a pointer on the normal NSView, and an NSOpenGLView, who is a pointer | an NSView who is a pointer on the normal NSView, and an NSOpenGLView, who is a pointer | ||
Line 143: | Line 143: | ||
Using the second solution, the subview seems to -somewhat- show something. | Using the second solution, the subview seems to -somewhat- show something. | ||
− | '''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 this is encouraging for the future). | + | '''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 this is encouraging for the future). |
− | '''Known issue''': | + | '''Known issue''': there is no communication between the subView and the NSApplication, events are lost, timeout and chaos in event queue |
− | -> deadlock and crash. | + | -> deadlock and crash. |
− | TODO: | + | TODO: Second test will consist in delegate the notifications send for the refresh, to the NSApp. |
− | It is expected, once this NSOpenGL view | + | 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). | + | 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). |
− | ==== | + | ==== '''Concerned files''' ==== |
− | Task : build the lib | + | Task: build the lib |
'''slideshow/source/engine/OGLTrans/makefile.mk''' | '''slideshow/source/engine/OGLTrans/makefile.mk''' | ||
− | add the case Aqua, | + | add the case Aqua, modify CFLAGSCXX + add fremaworks OpenGL, GLUT and Cocoa for linking |
− | Task : Deliver the libs / includes: | + | Task: Deliver the libs / includes: |
'''slideshow/prj/d.lst''' | '''slideshow/prj/d.lst''' | ||
− | deliver the new lib on Aqua | + | deliver the new lib on Aqua (libOGLTrans.dylib) |
− | Modified files : | + | Modified files: |
'''slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.cxx''' | '''slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.cxx''' | ||
Line 179: | Line 179: | ||
− | New files (to be confirmed) : | + | New files (to be confirmed): |
slideshow/source/engine/OGLTrans/aquaOpenGLView.h | slideshow/source/engine/OGLTrans/aquaOpenGLView.h | ||
Line 187: | Line 187: | ||
=== ''' Concerned modules''' === | === ''' Concerned modules''' === | ||
− | * config_office : make OpenGL default on Mac OS X Aqua => ENABLE_OPENGL=TRUE | + | * 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 ) | + | * 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) | + | * 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 | + | * scp2: to add the new lib in the package |
* other changes ? | * other changes ? | ||
Line 219: | Line 219: | ||
*integrate | *integrate | ||
− | Notes about lib registration : | + | Notes about lib registration: |
− | When using UNO services ( if I'm not wrong) a lib must be listed in services.rdb blob. | + | When using UNO services (if I'm not wrong) a lib must be listed in services.rdb blob. |
− | For your tests, and until the lib will be packaged , you need to do this action '''manually'''. For that, you need to place you in the bundle : | + | For your tests, and until the lib will be packaged, you need to do this action '''manually'''. For that, you need to place you in the bundle: |
<pre> | <pre> | ||
cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program | cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program | ||
Line 235: | Line 235: | ||
With the new libs you built previously | With the new libs you built previously | ||
− | If you | + | If you want to go backward, just replace register with '''revoke'' in the same place, using similar command line: |
<pre> | <pre> | ||
cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program | cd <Bundle_dir>/OpenOffice.org.app/Contents/basis-link/program | ||
Line 247: | Line 247: | ||
== '''LINKS''' == | == '''LINKS''' == | ||
− | Below a now exhaustive list of links. Feel free to add interesting links | + | Below a now exhaustive list of links. Feel free to add interesting links. |
[http://developer.apple.com/documentation/GraphicsImaging/OpenGL-date.html Apple OpenGL Documentation] | [http://developer.apple.com/documentation/GraphicsImaging/OpenGL-date.html Apple OpenGL Documentation] | ||
Line 259: | Line 259: | ||
[http://lists.apple.com/archives/mac-opengl/2005/Dec/msg00089.html NSOpenGLView initialisation issue] | [http://lists.apple.com/archives/mac-opengl/2005/Dec/msg00089.html NSOpenGLView initialisation issue] | ||
− | == COMPLETE ME | + | == COMPLETE ME == |
Bla bla ... | Bla bla ... | ||
− | |||
− | |||
− | |||
− | |||
[[Category:Aqua]] | [[Category:Aqua]] | ||
[[Category:MacOSX]] | [[Category:MacOSX]] |
Revision as of 09:56, 25 August 2008
Contents
OpenGL transitions on Mac OS X
Description
In Impress, there are transitions between slides, with or without funny 3D effects. The problem is, those nice and Funny effects are power consuming, 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 on Mac OS X.
We'll use OpenGL, the API Mac OS X does natively use
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
Timeline
Expected timeline: October / November 2008
Examples
FIXME: add screenshots or links for demos
Modifications
Existing (historical implementation)
Common:
vcl/source/opengl.cxx, implements:
- functions pointers (most important gl functions typedef'ed)
- + corresponding macro for functions initialization
- + impl functions getters
- Ctor: parameter pOutDev is a pointer on a OutputDevice*, using mpOutDev
- Dtor: deletes mpOGL
- usual methods ... and so on
vcl/source/salogl.cxx:
- Static members: oslModule (himpOGLLib == libgl.dylib), NSOpenGLContext* .. (bool) state
- Macros
- Callbacks for CreateContext, DeleteContext, MakeCurrent, GetCurrentContext
- OpenGLWndProc (what's that ?)
vcl/source/gdi/outdev.cxx ->there is a very interesting OpenGL* OutputDevice::GetOpenGL()
FIXME: To be continued
Concerned files / ideas
Ideas
25th august:
After reading a lot of code (mostly vcl), it appears this is not possible (excepted doing hacks), to use OpenGL without use outdev thing (got systematic crashes using NSOpenGLView directly, and outdev complains about lost events and pending pointers)
The consequence is, the slideshow calls must be abstraction of CreateContext, MakeCurrentContext, ReleaseContext ..etc.
And the real implementation must go in vcl/aqua/source/gdi/salogl.cxx, respecting vcl/source/gdi/opengl.cxx virtual classes.
The plan (to be confirmed seems to be):
- design the abstraction we'll use, and prepare the OGLTrans_TransitionerImpl.cxx like it is for Linux, but adapted to Mac OS X
- implement NSOpenGLView* pOpenGLView in vcl, guessing it will be sufficient (else, we'll have to implement a new class, but things will become complicated)
- define the NSView containing the scene, instantiate an OpenGLNSView using the same frame, and use addSubview. Current choosen Place to do that: OGLTrans_TransitionerImpl.cxx
- implement (using existing Windows and Linux implementation) the same classes / macros ( :-/ ) methods in salogl.cxx
- add the mac osx cases in outdev and anywhere else it is needed
Retry with the coming DEV300_m30
Possibilities:
Everything is based on implement an OpenGLView adding a new NSOpenGLView* pOpenGLView object in sysdata.hxx, or an NSView drawn as a subview of the (NSView * type) pView.
TODO: investigate about ImplOutdev and co
Try 1: 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:
Pb: visibility of the vcl/aqua/inc headers from slideshow at buildtime
Update: predeclaration in vcl/inc/vcl/sysdata.hxx will help a lot.
Main issue is, 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]
Try 2 or
(maybe completely wrong, but worth a try)
Implement the OpenGL methods directly in the SalframeView. just two methods have the same names/parameters numbers, so just rename they properly to avoid clash. Important: initWithFrame for OpenGL has two parameters, while initWithFrame for normal NSView has only one.
Try 3 or
Add an NSOpenGLView * pOpenGLView in the sysdata.hxx, and modify everything in vcl accordingly.
Thus, in OGLTrans_TransitionerImpl.cxx instanciate
an NSView who is a pointer on the normal NSView, and an NSOpenGLView, who is a pointer
or
create the AquaOpenGLView object directly in slideshow, modify the other slideshow files mentioned above (changes are similar)
Result
Using the second solution, the subview seems to -somewhat- show something.
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 this 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).
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
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
- design the abstraction used in slideshow
- implement the abstracted methods/classes in vcl/aqua/source/gdi/salogl
- implement NSOpenGLView or customize an NSView [Current plan: try using NSOpenGLView first]
- 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.
For your tests, and until the lib will be packaged, you need to do this action manually. For that, you need to 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 want to go 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.
NSView + OpenGLView in Apple database
NSOpenGLView initialisation issue
COMPLETE ME
Bla bla ...