Difference between revisions of "Mac OS X Porting - OpenGL transitions"
(→Examples) |
(→Examples) |
||
Line 129: | Line 129: | ||
<br> | <br> | ||
− | <div align="left" style="color: | + | <div align="left" style="color:red; font-size:16px">'''To illustrate the current work in progress, some experimental screenshots are available [http://eric.bachard.free.fr/mac/aquavcl/patches/aqua_August_2008/OGLTransitions/screenshots/here => CLICK ME]'''</div> |
<br> | <br> |
Revision as of 07:32, 28 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 task 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
Current status
28th August
cws state changed for new
added tasks and modules to the cws
27th August: cws ogltrans4mac has been created (planned)
Stephan Schaefer helped me ( he made the NSOpenGLView work some weeks ago), and including all the changes, I was able to package a working version !
27th August
Created the patches concerning :
- scp2,
- config_office (René confirmed it is ok to bypass OpenGL / gl.h, glut.h headers and GLUT tests , and declare ENABLE_OPENGL=TRUE as default on Mac OS X),
- officecfg,
- sd,
- slideshow
Waiting for more information, about how proceed in vcl (I now know it works, but a big issue remains to be fixed :-) ).
26th August:
Found why the libOGLTrans was not loaded: the registration as UNO_COMPONENT was not done.
Other issues : the new transitions effects are not listed, because not in the .xcu nor any .xml
I finally found where: in sd/xml ! -> transitions-ogl (who is a plain .xml file) has to be
- renammed into transition-ogl.xml
- copied into the solver (accordingly to th esd/prj/d.lst file)
Consequence : some changes are needed in officecfg too:
Existing transitions are put in officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
-> new entries, matching with transitions-ogl.xml have to be entered (probably around line 1910, after "Random Transition" effect)
FIXME : localisation of new transitions names ?
25th august:
Reading documentation ( vcl code, mostly about outdev and co )
Defined the implementation plan (working with DEV300_m29)
24th august
Did some tests, using the first aquaOpenGLView I created. Lot of crashes.
23th august
Added other ideas
22th august
Started the wiki page and the implementation in parallel
PLEASE DO NOT REMOVE THE CREATION DATE
Page created Ericb 11:55, 22 August 2008 (CEST)
Concerned domains
- conditional activation of ENABLE_OPENGL in configure
- addition of NSOpenGLView class in vcl
- conditional build of libOGLTrans.dylib in slideshow
- conditional packaging of ligOGLTrans.dylib in scp2
- conditional addition of new transitions in the officecfg schema/UI files
- conditional registration of libOGLTrans.dylib at packaging time
- NSOpenGLView implementation in vcl
- OpenGL initialization and context creation in the slideshow
- load the libOGLTrans.dylib
- add the list of the new transitions in the list
- use them
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)
- scp2: to add the new lib in the package
- sd : rename the transitions-ogl in transitions-ogl.xml and deliver it
- officecfg : add the new transitions names in the list, to make them appear in the UI + add the transitions-ogl.xml file name in the matching Effects.xcs schema
Examples
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
27th August
Created the patches concerning :
- scp2,
- config_office (René confirmed it is ok to bypass OpenGL / gl.h, glut.h headers and GLUT tests , and declare ENABLE_OPENGL=TRUE as default on Mac OS X),
- officecfg,
- sd,
- slideshow
Should be the only concerned modules. I used the OpenGL transitions listed in sd/xml/transitions-ogl.xml, but there are obvisouly more in slideshow/source/engine/transitions.
Waiting for more information, about how proceed in vcl (I now know it works, but a big issue remains to be fixed :-) ).
26th August:
I finally found why the libOGLTrans was not loaded: the registration as UNO_COMPONENT was not done.
Other issues : the new transitions effects are not listed, because not in the .xcu nor any .xml
I finally found where: in sd/xml ! -> transitions-ogl (who is a plain .xml file) has to be
- renammed into transition-ogl.xml
- copied into the solver (accordingly to th esd/prj/d.lst file)
Consequence : some changes are needed in officecfg too:
Existing transitions are put in officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
-> new entries, matching with transitions-ogl.xml have to be entered (probably around line 1910, after "Random Transition" effect)
FIXME : localisation of new transitions names ?
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).
Tasks and concerned files
config_office/configure.in + run autoconf Add the info in the cws comments for the RE !
Result: ENABLE_OPENGL=TRUE on Mac OS X Aqua // OK
slideshow/source/engine/OGLTrans/makefile.mk // OK
add the case Aqua, modify CFLAGSCXX + add fremaworks OpenGL, GLUT and Cocoa for linking
slideshow/prj/d.lst // OK
deliver the new lib on Aqua (libOGLTrans.dylib)
Other modified files in slideshow:
slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.cxx // OK
slideshow/source/engine/OGLTrans/OglTrans_TransitionImpl.hxx // OK
slideshow/source/engine/OGLTrans/OglTrans_TransitionerImpl.cxx // OK
Must be done only if ENABLE_OPENGL is TRUE, and this environment variable must be turned in preprocessor macro:
scp2/source/impress/makefile.mk
Package and registration of the lib :
scp2/source/ooo/file_library_ooo.scp // OK
scp2/source/ooo/makefile.mk // OK
Package and registration of the new file transitions-ogl.xml
scp2/source/impress/file_impress.scp // OK
sd/prj/build.lst // OK
sd/prj/d.lst // OK
sd/xml/makefile.mk // OK ## New file to be created
sd/xml/transitions-ogl // OK to be renamed in transitions-ogl.xml and delivered in the solver, in solver/300/$build_type/xml
officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu // OK
officecfg/registry/schema/org/openoffice/Office/Impress.xcs // OK
( the final file containing the new transitions will be OOO_BASE_DIR/share/config/soffice.cfg/simpress/transitions-ogl.xml )
Better solution : reuse the fix I provided in macmenusquit ( at packaging time, modify the .xml on the fly, using xsltproc)
New files who could contain the customized NSView if ever the NSOpenGLView does not work well (to be confirmed, not sure at all):
slideshow/source/engine/OGLTrans/aquaOpenGLView.h
slideshow/source/engine/OGLTrans/aquaOpenGLView.m
Issues attached to the task
TODO (draft)
- [DONE] build the OpenGL trans lib, warning free, on Mac OS X
- [DONE] fix warnings and breakages, with empty implementation
- [DONE] fix linking
- [Done but needs work] create customized NSView (skeleton, and pre-implementation)
- [DONE] add the lib to the package
- [DONE] register the lib
- [DONE] rename the transitions-ogl in transitions-ogl.xml in sd and deliver it properly in the solver
- in officecfg, add the new transitions names in the list, to make them appear in the UI
- [DONE] in officecfg, add the transitions-ogl.xml file name in the matching Effects.xcs schema
- [DONE] Design the first implementation
- design the abstraction used in slideshow
- [DONE] implement NSOpenGLView or customize an NSView [Current plan: try using NSOpenGLView first]
- manage OpenGL context
- manage OpenGL pixels mapping
- manage colors
- manage events and notifications critical
- initialize the view properly in splitted view
- manage geometry
- [WORKS] implement the fullscreen mode
- finalize the transitions integration in Aqua bundle
- [DONE] make transitions work
- work on the flickering issue with last image
- test
- integrate
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 ...