mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added OpenGL locking for OSX.
This commit is contained in:
parent
ccb357d23a
commit
7d9e06d788
6 changed files with 26 additions and 0 deletions
|
|
@ -129,6 +129,8 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
struct Locker { Locker (NativeContext&) {} };
|
||||
|
||||
Component& component;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -154,6 +154,8 @@ public:
|
|||
|
||||
int getSwapInterval() const noexcept { return swapFrames; }
|
||||
|
||||
struct Locker { Locker (NativeContext&) {} };
|
||||
|
||||
private:
|
||||
JuceGLView* view;
|
||||
CAEAGLLayer* glLayer;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ public:
|
|||
void* getRawContext() const noexcept { return renderContext; }
|
||||
GLuint getFrameBufferID() const noexcept { return 0; }
|
||||
|
||||
struct Locker { Locker (NativeContext&) {} };
|
||||
|
||||
private:
|
||||
GLXContext renderContext;
|
||||
Window embeddedWindow;
|
||||
|
|
|
|||
|
|
@ -185,6 +185,22 @@ public:
|
|||
return [NSOpenGLContext currentContext] == renderContext;
|
||||
}
|
||||
|
||||
struct Locker
|
||||
{
|
||||
Locker (NativeContext& nc) : cglContext ((CGLContextObj) [nc.renderContext CGLContextObj])
|
||||
{
|
||||
CGLLockContext (cglContext);
|
||||
}
|
||||
|
||||
~Locker()
|
||||
{
|
||||
CGLUnlockContext (cglContext);
|
||||
}
|
||||
|
||||
private:
|
||||
CGLContextObj cglContext;
|
||||
};
|
||||
|
||||
void swapBuffers()
|
||||
{
|
||||
[renderContext flushBuffer];
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ public:
|
|||
void* getRawContext() const noexcept { return renderContext; }
|
||||
unsigned int getFrameBufferID() const noexcept { return 0; }
|
||||
|
||||
struct Locker { Locker (NativeContext&) {} };
|
||||
|
||||
private:
|
||||
Component dummyComponent;
|
||||
ScopedPointer<ComponentPeer> nativeWindow;
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ public:
|
|||
if (! context.makeActive())
|
||||
return false;
|
||||
|
||||
NativeContext::Locker locker (*nativeContext);
|
||||
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
glViewport (0, 0, component.getWidth(), component.getHeight());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue