From 2f104edf7c6febf00b260f184e008be2861dfeb1 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Sun, 3 Apr 2022 23:40:16 -0700 Subject: [PATCH] Remove MacOS and IOS OpenGL code --- kraken/KRContext.h | 3 -- kraken/KRContext_ios.mm | 32 ------------------- kraken/KRContext_osx.mm | 71 ----------------------------------------- 3 files changed, 106 deletions(-) diff --git a/kraken/KRContext.h b/kraken/KRContext.h index 9ca7888..2163790 100755 --- a/kraken/KRContext.h +++ b/kraken/KRContext.h @@ -159,9 +159,6 @@ public: static std::mutex g_SurfaceInfoMutex; static std::mutex g_DeviceInfoMutex; -#if TARGET_OS_MAC - static void attachToView(void *view); -#endif void addResource(KRResource* resource, const std::string& name); void removeResource(KRResource* resource); private: diff --git a/kraken/KRContext_ios.mm b/kraken/KRContext_ios.mm index d4c7736..8c906d2 100755 --- a/kraken/KRContext_ios.mm +++ b/kraken/KRContext_ios.mm @@ -32,35 +32,3 @@ #include "KREngine-common.h" #include "KRContext.h" - -EAGLContext *gStreamerContext = nil; -EAGLContext *gRenderContext = nil; - -void KRContext::destroyDeviceContexts() -{ -} - -void KRContext::createDeviceContexts() -{ - if(!gRenderContext) { - gRenderContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - gStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: gRenderContext.sharegroup]; - - // FIXME: need to add code check for iOS 7 and also this appears to cause crashing - - //gTextureStreamerContext.multiThreaded = TRUE; - } -} - -void KRContext::activateStreamerContext() -{ - createDeviceContexts(); - [EAGLContext setCurrentContext: gStreamerContext]; -} - -void KRContext::activateRenderContext() -{ - createDeviceContexts(); - [EAGLContext setCurrentContext: gRenderContext]; -} - diff --git a/kraken/KRContext_osx.mm b/kraken/KRContext_osx.mm index cbcddd7..78ab1af 100755 --- a/kraken/KRContext_osx.mm +++ b/kraken/KRContext_osx.mm @@ -33,74 +33,3 @@ #include #include "KRContext.h" - -NSOpenGLContext *gStreamerContext = nil; -NSOpenGLContext *gRenderContext = nil; - -void KRContext::destroyDeviceContexts() -{ - gStreamerContext = nil; - gRenderContext = nil; -} - -void createGLDeviceContexts() -{ - if(gRenderContext == nil) { - - /* - NSOpenGLPixelFormatAttribute attribs[] = - { - NSOpenGLPFADoubleBuffer, - NSOpenGLPFADepthSize, 32, - NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, - 0 - }; - */ - NSOpenGLPixelFormatAttribute attribs[] = { - NSOpenGLPFADoubleBuffer, - NSOpenGLPFAAccelerated, - NSOpenGLPFAColorSize, 24, - NSOpenGLPFAAlphaSize, 8, - NSOpenGLPFADepthSize, 24, - NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, - 0 - }; - NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attribs] autorelease]; - gRenderContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil ]; - gStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: gRenderContext ]; - - // set synch to VBL to eliminate tearing - GLint vblSynch = 1; - [gRenderContext setValues:&vblSynch forParameter:NSOpenGLCPSwapInterval]; - -/* - CGLEnable([gRenderContext CGLContextObj], kCGLCESurfaceBackingSize); - - const GLint dim[2] = {1920, 1080}; - - [gRenderContext setValues: &dim[0] forParameter: NSOpenGLCPSurfaceBackingSize]; - [gRenderContext update]; -*/ - } -} - -void KRContext::activateStreamerContext() -{ - createGLDeviceContexts(); - [gStreamerContext makeCurrentContext]; -} - -void KRContext::activateRenderContext() -{ - createGLDeviceContexts(); - [gRenderContext update]; - [gRenderContext makeCurrentContext]; -} - -void KRContext::attachToView(void *view) -{ - createGLDeviceContexts(); - NSView *v = (NSView *)view; - [gRenderContext setView: v]; - [gRenderContext update]; -}