Asynchronous streaming and memory management improvements in progress.

--HG--
branch : async_streaming
This commit is contained in:
2013-11-02 16:27:24 -07:00
parent 06436d72f5
commit 48d3a6a2c8
18 changed files with 167 additions and 75 deletions

View File

@@ -0,0 +1,41 @@
//
// KRMeshStreamer.cpp
// Kraken
//
// Created by Kearwood Gilbert on 11/1/2013.
// Copyright (c) 2013 Kearwood Software. All rights reserved.
//
#include "KRMeshStreamer.h"
#include "KREngine-common.h"
#include <chrono>
EAGLContext *gMeshStreamerContext;
KRMeshStreamer::KRMeshStreamer(KRContext &context) : m_context(context)
{
gMeshStreamerContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup: [EAGLContext currentContext].sharegroup];
m_stop = false;
m_thread = std::thread(&KRMeshStreamer::run, this);
}
KRMeshStreamer::~KRMeshStreamer()
{
m_stop = true;
m_thread.join();
[gMeshStreamerContext release];
}
void KRMeshStreamer::run()
{
std::chrono::microseconds sleep_duration( 100 );
[EAGLContext setCurrentContext: gMeshStreamerContext];
while(!m_stop)
{
std::this_thread::sleep_for( sleep_duration );
}
}