renderspu_cocoa.c revision 15b99330b4c33559d5dd2ca2ba6afa1213970204
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * VirtualBox OpenGL Cocoa Window System implementation
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * Copyright (C) 2009 Sun Microsystems, Inc.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * This file is part of VirtualBox Open Source Edition (OSE), as
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * available from http://www.virtualbox.org. This file is free software;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * you can redistribute it and/or modify it under the terms of the GNU
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * General Public License (GPL) as published by the Free Software
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * Foundation, in version 2 as it comes in the "COPYING" file of the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * Clara, CA 95054 USA or visit http://www.sun.com if you need
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots * additional information or have any questions.
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd KlootsGLboolean renderspu_SystemInitVisual(VisualInfo *pVisInfo)
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots/* cocoaGLVisualCreate(&pCtxInfo->context);*/
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd KlootsGLboolean renderspu_SystemCreateContext(VisualInfo *pVisInfo, ContextInfo *pCtxInfo, ContextInfo *pShharedCtxInfo)
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots cocoaGLCtxCreate(&pCtxInfo->context, pVisInfo->visAttribs);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvoid renderspu_SystemDestroyContext(ContextInfo *pCtxInfo)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspuFullscreen(WindowInfo *pWinInfo, GLboolean fFullscreen)
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots /* Real fullscreen isn't supported by VirtualBox */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsGLboolean renderspu_SystemVBoxCreateWindow(VisualInfo *pVisInfo, GLboolean fShowIt, WindowInfo *pWinInfo)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots#else /* __LP64__ */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots#endif /* __LP64__ */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots/* if (!pParentWin)*/
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots/* return GL_FALSE;*/
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots cocoaViewCreate(&pWinInfo->window, pParentWin, pVisInfo->visAttribs);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvoid renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
de413b3e25c9cba63ab4b3003f5a4524d49f9f05Todd Kloots NativeViewRef pParentWin = (NativeViewRef)render_spu_parent_window_id;
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots#else /* __LP64__ */
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots NativeViewRef pParentWin = (NativeViewRef)(uint32_t)render_spu_parent_window_id;
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots#endif /* __LP64__ */
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Kloots cocoaViewSetPosition(pWinInfo->window, pParentWin, x, y);
9a2430d08e4d1b8b870cd3ba6c17ffc7881d16a6Todd Klootsvoid renderspu_SystemWindowSize(WindowInfo *pWinInfo, GLint w, GLint h)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemGetWindowGeometry(WindowInfo *pWinInfo, GLint *pX, GLint *pY, GLint *pW, GLint *pH)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots cocoaViewGetGeometry(pWinInfo->window, pX, pY, pW, pH);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemGetMaxWindowSize(WindowInfo *pWinInfo, GLint *pW, GLint *pH)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemShowWindow(WindowInfo *pWinInfo, GLboolean fShowIt)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemMakeCurrent(WindowInfo *pWinInfo, GLint nativeWindow, ContextInfo *pCtxInfo)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots/* if(pWinInfo->visual != pCtxInfo->visual)*/
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots/* printf ("visual mismatch .....................\n");*/
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots cocoaViewMakeCurrentContext(pWinInfo->window, pCtxInfo->context);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemSwapBuffers(WindowInfo *pWinInfo, GLint flags)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemWindowVisibleRegion(WindowInfo *pWinInfo, GLint cRects, GLint* paRects)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Kloots cocoaViewSetVisibleRegion(pWinInfo->window, cRects, paRects);
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *paRects)
5f40f927dba3cf399373572f6ed6fe59a376376eTodd Klootsvoid renderspu_SystemWindowApplyVisibleRegion(WindowInfo *pWinInfo)