[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34439] branches/soc-2010-merwin/intern/ ghost/intern: enabled multithread GL engine + minor cleanup

Mike Erwin significant.bit at gmail.com
Fri Jan 21 10:56:42 CET 2011


Revision: 34439
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34439
Author:   merwin
Date:     2011-01-21 09:56:41 +0000 (Fri, 21 Jan 2011)
Log Message:
-----------
enabled multithread GL engine + minor cleanup

Modified Paths:
--------------
    branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.h
    branches/soc-2010-merwin/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.h	2011-01-21 09:43:12 UTC (rev 34438)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_SystemCocoa.h	2011-01-21 09:56:41 UTC (rev 34439)
@@ -53,7 +53,7 @@
 	 * Constructor.
 	 */
 	GHOST_SystemCocoa();
-	
+
 	/** 
 	 * Destructor.
 	 */
@@ -263,7 +263,7 @@
 	 * @return          Indication whether the event was handled. 
 	 */
 	GHOST_TSuccess handleTabletEvent(void *eventPtr);
-	
+
 	/**
 	 * Helps handleTabletEvent function.
 	 */
@@ -336,7 +336,7 @@
 
 	/** Multitouch gesture in progress, useful to distinguish trackpad from mouse scroll events */
 	bool m_isGestureInProgress;
-	
+
 	NSAutoreleasePool* m_pool;
 };
 

Modified: branches/soc-2010-merwin/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- branches/soc-2010-merwin/intern/ghost/intern/GHOST_WindowCocoa.mm	2011-01-21 09:43:12 UTC (rev 34438)
+++ branches/soc-2010-merwin/intern/ghost/intern/GHOST_WindowCocoa.mm	2011-01-21 09:56:41 UTC (rev 34439)
@@ -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 @@
 		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 @@
 	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 @@
 {
 	if (m_customCursor) delete m_customCursor;
 
-//	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	[m_openGLView release];
 
 	if (m_window) {
@@ -434,8 +433,6 @@
 	if ([windowsList count]) {
 		[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
 	}
-
-//	[pool drain];
 }
 
 #pragma mark accessors
@@ -851,7 +848,6 @@
 		}
 	}
 
-//	[m_pool drain]; // needed to put this in a function that is called regularly	
 	return success;
 }
 
@@ -872,12 +868,10 @@
 {
 	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 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 @@
 				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 @@
 		default:
 			break;
 	}
-//	[pool drain];
+
 	return success;
 }
 




More information about the Bf-blender-cvs mailing list