WIP OSX and TvOS support

This commit is contained in:
2016-01-30 20:13:23 -08:00
parent 3913345a28
commit f356df178f
48 changed files with 1185 additions and 269 deletions

View File

@@ -14,19 +14,6 @@
#include <chrono>
#if TARGET_OS_IPHONE
EAGLContext *gTextureStreamerContext = nil;
#elif TARGET_OS_MAC
NSOpenGLContext *gTextureStreamerContext = nil;
#else
#error Unsupported Platform
#endif
KRStreamer::KRStreamer(KRContext &context) : m_context(context)
{
m_running = false;
@@ -37,29 +24,7 @@ void KRStreamer::startStreamer()
{
if(!m_running) {
m_running = true;
#if TARGET_OS_IPHONE
gTextureStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup];
// FIXME: need to add code check for iOS 7 and also this appears to cause crashing
//gTextureStreamerContext.multiThreaded = TRUE;
#elif TARGET_OS_MAC
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =
{
// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,
0
};
NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease];
gTextureStreamerContext = [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ];
#else
#error Unsupported Platform
#endif
KRContext::activateStreamerContext();
m_thread = std::thread(&KRStreamer::run, this);
}
@@ -72,8 +37,6 @@ KRStreamer::~KRStreamer()
m_thread.join();
m_running = false;
}
[gTextureStreamerContext release];
}
void KRStreamer::run()
@@ -82,13 +45,7 @@ void KRStreamer::run()
std::chrono::microseconds sleep_duration( 15000 );
#if TARGET_OS_IPHONE
[EAGLContext setCurrentContext: gTextureStreamerContext];
#elif TARGET_OS_MAC
[gTextureStreamerContext makeCurrentContext];
#else
#error Unsupported Platform
#endif
KRContext::activateStreamerContext();
while(!m_stop)
{