VirtualBox

Ignore:
Timestamp:
Apr 14, 2010 12:52:05 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60022
Message:

crOpenGl;FE/Qt4: added initial 3D support on OSX for the mutli-monitor case (the dock still needs some work)

Location:
trunk/src/VBox/HostServices/SharedOpenGL/render
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r27889 r28279  
    347347    {
    348348        renderspuMakeCurrent(0, 0, pCtx->id);
    349     }   
     349    }
    350350}
    351351
     
    372372            if (pNewCtx!=pOldCtx)
    373373            {
    374                 renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->id:0, 0, 
     374                renderspuMakeCurrent(pOldCtx&&pOldCtx->currentWindow ? pOldCtx->currentWindow->id:0, 0,
    375375                                     pOldCtx ? pOldCtx->id:0);
    376376            }
     
    10541054    }
    10551055
    1056 #if defined(WINDOWS) || defined(GLX)
    10571056    renderspu_SystemReparentWindow(pWindow);
    1058 #endif
    10591057}
    10601058
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r27708 r28279  
    311311
    312312extern GLint RENDER_APIENTRY renderspuWindowCreate( const char *dpyName, GLint visBits );
     313extern void RENDER_APIENTRY renderspu_SystemReparentWindow(WindowInfo *window);
    313314extern GLint RENDER_APIENTRY renderspuCreateContext( const char *dpyname, GLint visBits, GLint shareCtx );
    314315extern void RENDER_APIENTRY renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx);
    315316extern void RENDER_APIENTRY renderspuSwapBuffers( GLint window, GLint flags );
    316 
    317 #if defined(WINDOWS) || defined(GLX)
    318 extern void renderspu_SystemReparentWindow(WindowInfo *window);
    319 #endif
    320317
    321318#ifdef __cplusplus
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c

    r24378 r28279  
    428428}
    429429
     430void renderspu_SystemReparentWindow(WindowInfo *)
     431{
     432    /* stub only */
     433}
     434
    430435void
    431436renderspu_SystemDestroyWindow(WindowInfo *window)
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c

    r26229 r28279  
    9696}
    9797
    98 void renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
    99 {
    100     CRASSERT(pWinInfo);
    101 
    102     cocoaViewDestroy(pWinInfo->window);
    103 }
    104 
    105 void renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
    106 {
    107     CRASSERT(pWinInfo);
    108 
     98void renderspu_SystemReparentWindow(WindowInfo *pWinInfo)
     99{
    109100#ifdef __LP64__
    110101    NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
     
    112103    NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
    113104#endif /* __LP64__ */
     105    cocoaViewReparent(pWinInfo->window, pParentWin);
     106}
     107
     108void renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
     109{
     110    CRASSERT(pWinInfo);
     111
     112    cocoaViewDestroy(pWinInfo->window);
     113}
     114
     115void renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
     116{
     117    CRASSERT(pWinInfo);
     118
     119#ifdef __LP64__
     120    NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
     121#else /* __LP64__ */
     122    NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
     123#endif /* __LP64__ */
    114124
    115125    cocoaViewSetPosition(pWinInfo->window, pParentWin, x, y);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h

    r23491 r28279  
    4343/* View management */
    4444void cocoaViewCreate(NativeViewRef *ppView, NativeViewRef pParentView, GLbitfield fVisParams);
     45void cocoaViewReparent(NativeViewRef pView, NativeViewRef pParentView);
    4546void cocoaViewDestroy(NativeViewRef pView);
    4647void cocoaViewDisplay(NativeViewRef pView);
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m

    r25293 r28279  
    138138@private
    139139    NSView          *m_pParentView;
     140    NSWindow        *m_pOverlayWin;
    140141
    141142    NSOpenGLContext *m_pGLCtx;
     
    172173- (void)setGLCtx:(NSOpenGLContext*)pCtx;
    173174- (NSOpenGLContext*)glCtx;
     175
     176- (void)setParentView: (NSView*)view;
     177- (NSView*)parentView;
     178- (void)setOverlayWin: (NSWindow*)win;
     179- (NSWindow*)overlayWin;
    174180
    175181- (void)setPos:(NSPoint)pos;
     
    299305    [self cleanup];
    300306
    301     /* Create a buffer for our thumbnail image. Its in the size of this view. */
    302     m_ThumbBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
    303         pixelsWide:frame.size.width
    304         pixelsHigh:frame.size.height
    305         bitsPerSample:8
    306         samplesPerPixel:4
    307         hasAlpha:YES
    308         isPlanar:NO
    309         colorSpaceName:NSDeviceRGBColorSpace
    310         bytesPerRow:frame.size.width * 4
    311         bitsPerPixel:8 * 4];
    312     m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]];
    313     [m_ThumbImage addRepresentation:m_ThumbBitmap];
     307    if (   frame.size.width > 0
     308        && frame.size.height > 0)
     309    {
     310        /* Create a buffer for our thumbnail image. Its in the size of this view. */
     311        m_ThumbBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
     312            pixelsWide:frame.size.width
     313            pixelsHigh:frame.size.height
     314            bitsPerSample:8
     315            samplesPerPixel:4
     316            hasAlpha:YES
     317            isPlanar:NO
     318            colorSpaceName:NSDeviceRGBColorSpace
     319            bytesPerRow:frame.size.width * 4
     320            bitsPerPixel:8 * 4];
     321        m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]];
     322        [m_ThumbImage addRepresentation:m_ThumbBitmap];
     323    }
    314324    [self unlock];
    315325}
     
    447457        m_pOverlayView = pOverlayView;
    448458        m_Thread = [NSThread currentThread];
     459
     460        [m_pOverlayView setOverlayWin: self];
    449461
    450462        m_pOverlayHelperView = [[OverlayHelperView alloc] initWithOverlayWindow:self];
     
    606618}
    607619
     620- (NSView*)parentView
     621{
     622    return m_pParentView;
     623}
     624
     625- (void)setParentView: (NSView*)view
     626{
     627    m_pParentView = view;
     628}
     629
     630- (void)setOverlayWin: (NSWindow*)win
     631{
     632    m_pOverlayWin = win;
     633}
     634
     635- (NSWindow*)overlayWin
     636{
     637    return m_pOverlayWin;
     638}
     639
    608640- (void)setPos:(NSPoint)pos
    609641{
     
    10261058                [m_DockTileView thumbBitmap] != nil)
    10271059            {
    1028                 /* Only update after atleast 200 ms, cause glReadPixels is
     1060                /* Only update after at least 200 ms, cause glReadPixels is
    10291061                 * heavy performance wise. */
    10301062                uint64_t uiNewTime = RTTimeMilliTS();
     
    13061338}
    13071339
     1340void cocoaViewReparent(NativeViewRef pView, NativeViewRef pParentView)
     1341{
     1342    NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init];
     1343
     1344    OverlayView* pOView = (OverlayView*)pView;
     1345
     1346    if (pOView)
     1347    {
     1348        /* Make sure the window is removed from any previous parent window. */
     1349        [[[pOView overlayWin] parentWindow] removeChildWindow:[pOView overlayWin]];
     1350        /* Set the new parent view */
     1351        [pOView setParentView: pParentView];
     1352        /* Add the overlay window as a child to the new parent window */
     1353        [[pParentView window] addChildWindow:[pOView overlayWin] ordered:NSWindowAbove];
     1354    }
     1355
     1356    [pPool release];
     1357}
     1358
    13081359void cocoaViewDestroy(NativeViewRef pView)
    13091360{
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette