Browse Source

adding multisampling getter/setter methods for MacOSX and iOS, and ensuring multisampling is initially true if samples is > 0 in config

John Brandle 13 years ago
parent
commit
57fee7a08f

+ 4 - 0
gameplay/src/PlatformAndroid.cpp

@@ -177,6 +177,7 @@ static bool initEGL()
         EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
         EGL_NONE
     };
+    __multiSampling = samples > 0;
     
     EGLint eglConfigCount;
     const EGLint eglContextAttrs[] =
@@ -238,6 +239,9 @@ static bool initEGL()
                         break;
                     }
                 }
+
+                __multiSampling = sampleCount > 0;
+
                 if (validConfig)
                     break;
             }

+ 3 - 0
gameplay/src/PlatformBlackBerry.cpp

@@ -746,6 +746,7 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
         EGL_NONE
     };
+    __multiSampling = samples > 0;
 
     const EGLint eglContextAttrs[] =
     {
@@ -930,6 +931,8 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             }
         }
 
+        __multiSampling = samples > 0;
+
         if (!success)
         {
             checkErrorEGL("eglChooseConfig");

+ 2 - 0
gameplay/src/PlatformLinux.cpp

@@ -585,6 +585,8 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         GLX_SAMPLES,        __samples,
         0
     };
+    __multiSampling = __samples > 0;
+
     GLXFBConfig* configs;
     int configCount = 0;
     configs = glXChooseFBConfig(__display, DefaultScreen(__display), configAttribs, &configCount);

+ 22 - 0
gameplay/src/PlatformMacOSX.mm

@@ -50,6 +50,7 @@ static void* __attachToWindow = NULL;
 static bool __mouseCaptured = false;
 static bool __mouseCapturedFirstPass = false;
 static CGPoint __mouseCapturePoint;
+static bool __multiSampling = false;
 static bool __cursorVisible = true;
 static View* __view = NULL;
 
@@ -770,6 +771,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     };
     NSOpenGLPixelFormatAttribute* attrs = __fullscreen ? fullscreenAttrs : windowedAttrs;
     
+    __multiSampling = samples > 0;
+
     // Try to choose a supported pixel format
     NSOpenGLPixelFormat* pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
     if (!pf)
@@ -787,6 +790,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
                 break;
             }
         }
+
+        __multiSampling = samples > 0;
         
         if (!valid)
         {
@@ -1647,6 +1652,23 @@ void Platform::sleep(long ms)
     usleep(ms * 1000);
 }
 
+void Platform::setMultiSampling(bool enabled)
+{
+    if (enabled == __multiSampling)
+    {
+        return;
+    }
+
+    //todo
+
+    __multiSampling = enabled;
+}
+
+bool Platform::isMultiSampling()
+{
+    return __multiSampling;
+}
+
 void Platform::setMultiTouch(bool enabled)
 {
 }

+ 12 - 0
gameplay/src/PlatformiOS.mm

@@ -282,6 +282,8 @@ int getUnicode(int key);
             samples /= 2;
         }
         
+        //todo: __multiSampling = samples > 0;
+
         // Re-bind the default framebuffer
         GL_ASSERT( glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer) );
         
@@ -1447,6 +1449,16 @@ bool Platform::isCursorVisible()
     return false;
 }
 
+void Platform::setMultiSampling(bool enabled)
+{
+    //todo
+}
+
+bool Platform::isMultiSampling()
+{
+    return false; //todo
+}
+
 void Platform::setMultiTouch(bool enabled) 
 {
     __view.multipleTouchEnabled = enabled;