Remove MacOS and IOS OpenGL code
This commit is contained in:
@@ -159,9 +159,6 @@ public:
|
|||||||
static std::mutex g_SurfaceInfoMutex;
|
static std::mutex g_SurfaceInfoMutex;
|
||||||
static std::mutex g_DeviceInfoMutex;
|
static std::mutex g_DeviceInfoMutex;
|
||||||
|
|
||||||
#if TARGET_OS_MAC
|
|
||||||
static void attachToView(void *view);
|
|
||||||
#endif
|
|
||||||
void addResource(KRResource* resource, const std::string& name);
|
void addResource(KRResource* resource, const std::string& name);
|
||||||
void removeResource(KRResource* resource);
|
void removeResource(KRResource* resource);
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -32,35 +32,3 @@
|
|||||||
#include "KREngine-common.h"
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
#include "KRContext.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];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,74 +33,3 @@
|
|||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
#include "KRContext.h"
|
#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];
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user