Fixed crash in fbx import pipeline

This commit is contained in:
2013-11-23 17:02:17 -08:00
parent 9cd9a8474c
commit 61fde7700b
6 changed files with 40 additions and 32 deletions

View File

@@ -28,29 +28,40 @@ NSOpenGLContext *gMeshStreamerContext = nil;
KRMeshStreamer::KRMeshStreamer(KRContext &context) : m_context(context)
{
#if TARGET_OS_IPHONE
gMeshStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup];
#elif TARGET_OS_MAC
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =
{
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
0
};
NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease];
gMeshStreamerContext = [[[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ] autorelease];
#else
#error Unsupported Platform
#endif
m_running = false;
m_stop = false;
m_thread = std::thread(&KRMeshStreamer::run, this);
}
void KRMeshStreamer::startStreamer()
{
if(!m_running) {
m_running = true;
#if TARGET_OS_IPHONE
gMeshStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup];
#elif TARGET_OS_MAC
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =
{
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
0
};
NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes] autorelease];
gMeshStreamerContext = [[[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: [NSOpenGLContext currentContext] ] autorelease];
#else
#error Unsupported Platform
#endif
m_thread = std::thread(&KRMeshStreamer::run, this);
}
}
KRMeshStreamer::~KRMeshStreamer()
{
m_stop = true;
m_thread.join();
if(m_running) {
m_stop = true;
m_thread.join();
m_running = false;
}
[gMeshStreamerContext release];
}