|
|
@@ -42,9 +42,14 @@ public: |
|
|
nativeContext = new NativeContext (component, pixFormat, contextToShare);
|
|
|
nativeContext = new NativeContext (component, pixFormat, contextToShare);
|
|
|
|
|
|
|
|
|
if (nativeContext->createdOk())
|
|
|
if (nativeContext->createdOk())
|
|
|
|
|
|
{
|
|
|
|
|
|
nativeContext->setSwapInterval (1);
|
|
|
context.nativeContext = nativeContext;
|
|
|
context.nativeContext = nativeContext;
|
|
|
|
|
|
}
|
|
|
else
|
|
|
else
|
|
|
|
|
|
{
|
|
|
nativeContext = nullptr;
|
|
|
nativeContext = nullptr;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
~CachedImage()
|
|
|
~CachedImage()
|
|
|
@@ -295,10 +300,8 @@ public: |
|
|
|
|
|
|
|
|
while (! threadShouldExit())
|
|
|
while (! threadShouldExit())
|
|
|
{
|
|
|
{
|
|
|
const uint32 frameRenderStartTime = Time::getMillisecondCounter();
|
|
|
|
|
|
|
|
|
|
|
|
if (renderFrame())
|
|
|
|
|
|
waitForNextFrame (frameRenderStartTime);
|
|
|
|
|
|
|
|
|
if (! renderFrame())
|
|
|
|
|
|
wait (5); // failed to render, so avoid a tight fail-loop.
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
shutdownOnThread();
|
|
|
shutdownOnThread();
|
|
|
@@ -332,14 +335,6 @@ public: |
|
|
associatedObjects.clear();
|
|
|
associatedObjects.clear();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void waitForNextFrame (const uint32 frameRenderStartTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
const int defaultFPS = 60;
|
|
|
|
|
|
|
|
|
|
|
|
const int elapsed = (int) (Time::getMillisecondCounter() - frameRenderStartTime);
|
|
|
|
|
|
wait (jmax (1, (1000 / defaultFPS - 1) - elapsed));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
//==============================================================================
|
|
|
static CachedImage* get (Component& c) noexcept
|
|
|
static CachedImage* get (Component& c) noexcept
|
|
|
{
|
|
|
{
|
|
|
|