1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0023243: Adapt OpenGL viewer for using in Cocoa applications on Mac OS X

Cocoa_Window draft
OpenGl_Context and OpenGl_Window - added support for Cocoa OpenGL context
TKV3d - accept Cocoa_Window
Draft version of ViewerInit method for Mac OS X
Added ViewerTest_CocoaEventManagerView
ViewerTest - attach events to Cocoa window
Cocoa_Window - disable autorelease on close
Fix for OpenGl_Context::Init method
Cocoa_Window - convert top-left coordinates to bottom-left
Added selection with rubber band (rubber band drawing still should be implemented)
Fixed OpenGl_Display initialization on Mac OS X
Fixed OpenGl includes
This commit is contained in:
bugmaster
2012-12-24 17:46:07 +04:00
parent 352ffd7358
commit 4fe5661921
30 changed files with 1916 additions and 297 deletions

View File

@@ -17,7 +17,6 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <InterfaceGraphic.hxx>
#include <OpenGl_Window.hxx>
@@ -33,6 +32,8 @@
IMPLEMENT_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared)
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
namespace
{
static const TEL_COLOUR THE_DEFAULT_BG_COLOR = { { 0.F, 0.F, 0.F, 1.F } };
@@ -437,6 +438,8 @@ OpenGl_Window::~OpenGl_Window()
#endif
}
#endif // !__APPLE__
// =======================================================================
// function : Activate
// purpose :
@@ -446,6 +449,8 @@ Standard_Boolean OpenGl_Window::Activate()
return myGlContext->MakeCurrent();
}
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
// =======================================================================
// function : Resize
// purpose : call_subr_resize
@@ -471,6 +476,8 @@ void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
Init();
}
#endif // !__APPLE__
// =======================================================================
// function : ReadDepths
// purpose : TelReadDepths
@@ -507,6 +514,8 @@ void OpenGl_Window::SetBackgroundColor (const Standard_ShortReal theR,
myBgColor.rgb[2] = theB;
}
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
// =======================================================================
// function : Init
// purpose :
@@ -540,6 +549,8 @@ void OpenGl_Window::Init()
glDrawBuffer (GL_BACK);
}
#endif // !__APPLE__
// =======================================================================
// function : EnablePolygonOffset
// purpose : call_subr_enable_polygon_offset