Fixed crash in fbx import pipeline
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user