Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2011-01-21 12:56:41 +0300
committerMike Erwin <significant.bit@gmail.com>2011-01-21 12:56:41 +0300
commit50186191d998d6ab51b547d94461c8d0625f3ce0 (patch)
treea70aa6e79e6c3d0cc17ba829ec242dc047276d3f
parent66bdb9a12fd7827ab5f342930941fc323bff9e74 (diff)
enabled multithread GL engine + minor cleanup
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h6
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm37
2 files changed, 16 insertions, 27 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index de835ad7768..09af9387951 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -53,7 +53,7 @@ public:
* Constructor.
*/
GHOST_SystemCocoa();
-
+
/**
* Destructor.
*/
@@ -263,7 +263,7 @@ protected:
* @return Indication whether the event was handled.
*/
GHOST_TSuccess handleTabletEvent(void *eventPtr);
-
+
/**
* Helps handleTabletEvent function.
*/
@@ -336,7 +336,7 @@ protected:
/** Multitouch gesture in progress, useful to distinguish trackpad from mouse scroll events */
bool m_isGestureInProgress;
-
+
NSAutoreleasePool* m_pool;
};
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index aea59de51cd..5bb85eaf1e7 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -34,7 +34,7 @@
#include <Carbon/Carbon.h>
#endif
-#include <OpenGL/gl.h>
+#include <OpenGL/OpenGL.h> // standard OpenGL + Mac CGL
#include "GHOST_WindowCocoa.h"
#include "GHOST_SystemCocoa.h"
@@ -321,7 +321,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
return;
}
- [m_window setSystemAndWindowCocoa:ghostSystem windowCocoa:this];
+ [m_window setSystem:ghostSystem ghostWindow:this];
// Forbid to resize the window below the blender defined minimum one
[m_window setContentMinSize:NSMakeSize(320,240)];
@@ -400,7 +400,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
activateDrawingContext();
CocoaWindowDelegate *windowDelegate = [[CocoaWindowDelegate alloc] init];
- [windowDelegate setSystemAndWindowCocoa:ghostSystem windowCocoa:this];
+ [windowDelegate setSystem:ghostSystem ghostWindow:this];
[m_window setDelegate:windowDelegate];
[m_window setAcceptsMouseMovedEvents:YES];
@@ -419,7 +419,6 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
{
if (m_customCursor) delete m_customCursor;
-// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[m_openGLView release];
if (m_window) {
@@ -434,8 +433,6 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
if ([windowsList count]) {
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
}
-
-// [pool drain];
}
#pragma mark accessors
@@ -851,7 +848,6 @@ GHOST_TSuccess GHOST_WindowCocoa::swapBuffers()
}
}
-// [m_pool drain]; // needed to put this in a function that is called regularly
return success;
}
@@ -872,12 +868,10 @@ GHOST_TSuccess GHOST_WindowCocoa::activateDrawingContext()
{
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
if (m_openGLContext != nil) {
-// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[m_openGLContext makeCurrentContext];
// Disable AA by default
if (m_numOfAASamples > 0) glDisable(GL_MULTISAMPLE_ARB);
-// [pool drain];
return GHOST_kSuccess;
}
}
@@ -889,15 +883,9 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
{
GHOST_TSuccess success = GHOST_kFailure;
-// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
NSOpenGLPixelFormat *pixelFormat;
NSOpenGLContext *tmpOpenGLContext;
- /***** Multithreaded opengl code : uncomment for enabling
- CGLContextObj cglCtx;
- */
-
switch (type) {
case GHOST_kDrawingContextTypeOpenGL:
if (!getValid()) break;
@@ -910,20 +898,21 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
break;
}
- //Switch openGL to multhreaded mode
- /******* Multithreaded opengl code : uncomment for enabling */
- cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj];
+ /******* Multithreaded OpenGL code : uncomment for enabling */
+ CGLContextObj cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj];
if (CGLEnable(cglCtx, kCGLCEMPEngine) == kCGLNoError)
- printf("\nSwitched openGL to multithreaded mode");
+ printf("\nUsing multithreaded OpenGL engine.\n");
if (!s_firstOpenGLcontext) s_firstOpenGLcontext = tmpOpenGLContext;
-#ifdef WAIT_FOR_VSYNC
- {
+
+ #ifdef WAIT_FOR_VSYNC
+ {
GLint swapInt = 1;
/* wait for vsync, to avoid tearing artifacts */
[tmpOpenGLContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
- }
-#endif
+ }
+ #endif
+
[m_openGLView setOpenGLContext:tmpOpenGLContext];
[tmpOpenGLContext setView:m_openGLView];
@@ -937,7 +926,7 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
default:
break;
}
-// [pool drain];
+
return success;
}