added a nice alert box when blender is run on a mac with less than 8Mb VRAM
authorJean-Luc Peurière <jlp@nerim.net>
Wed, 28 Jul 2004 16:47:08 +0000 (16:47 +0000)
committerJean-Luc Peurière <jlp@nerim.net>
Wed, 28 Jul 2004 16:47:08 +0000 (16:47 +0000)
intern/ghost/intern/GHOST_WindowCarbon.cpp
source/blender/src/ghostwinlay.c

index 518fdf605bc5c53fd02ab3fec065f586d258677b..0c68a571a6895cc05b9c4f7f88aa635603510b94 100644 (file)
@@ -134,6 +134,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
                        //void *handler = &GHOST_WindowCarbon::myWEventHandlerProc;
                        
                        ::SetWRefCon(m_windowRef,(SInt32)this);
+                       setTitle(title);
                        err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL); 
                        if ( err != noErr) {
                                fprintf(stderr," error creating handler %i \n",err);
index ec7b6926aa8dbd4b96f217afdb72fbccfdf779c5..954388b3db7d0d4f7d62e09788eba2cc13998e29 100644 (file)
@@ -66,6 +66,7 @@
 
 #ifdef __APPLE__
 #include <OpenGL/OpenGL.h>
+#include <Carbon/Carbon.h>
 #endif
 ///
 
@@ -115,6 +116,8 @@ int checkAppleVideoCard() {
        long nrend;
        int j;
        long value;
+       long maxvram = 0;   /* we get always more than 1 renderer, check one, at least, has 8 Mo */
+       
        
        display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );     
        
@@ -123,12 +126,14 @@ int checkAppleVideoCard() {
                theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
                if (theErr == 0) {
                        for (j = 0; j < nrend; j++) {
-                               theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value); 
-                               if ((theErr == 0) && (value != 0)) {
-                                       theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value); 
+                               theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value); 
+                               if (value > maxvram)
+                                       maxvram = value;
+                               if ((theErr == 0) && (value >= 10000000)) {
+                                       theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value); 
                                        if ((theErr == 0) && (value != 0)) {
-                                               theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value); 
-                                               if ((theErr == 0) && (value >= 10000000)) {
+                                               theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value); 
+                                               if ((theErr == 0) && (value != 0)) {
                                                        /*fprintf(stderr,"make it big\n");*/
                                                        CGLDestroyRendererInfo (rend);
                                                        macPrefState = 8;
@@ -139,6 +144,17 @@ int checkAppleVideoCard() {
                        }
                }
        }
+       if (maxvram < 7500000 ) {       /* put a standard alert and quit*/ 
+               SInt16 junkHit;
+               char  inError[] = "* Not enough VRAM    ";
+               char  inText[] = "* blender needs at least 8Mb    ";
+               inError[0] = 16;
+               inText[0] = 28;
+                               
+               fprintf(stderr, " vram is %i. not enough, aborting\n", maxvram);
+               StandardAlert (   kAlertStopAlert,  &inError,&inText,NULL,&junkHit);
+               abort();
+       }
        CGLDestroyRendererInfo (rend);
        return 0;
 }