Browse Source

Added OpenGL locking for OSX.

tags/2021-05-28
jules 13 years ago
parent
commit
7d9e06d788
6 changed files with 26 additions and 0 deletions
  1. +2
    -0
      modules/juce_opengl/native/juce_OpenGL_android.h
  2. +2
    -0
      modules/juce_opengl/native/juce_OpenGL_ios.h
  3. +2
    -0
      modules/juce_opengl/native/juce_OpenGL_linux.h
  4. +16
    -0
      modules/juce_opengl/native/juce_OpenGL_osx.h
  5. +2
    -0
      modules/juce_opengl/native/juce_OpenGL_win32.h
  6. +2
    -0
      modules/juce_opengl/opengl/juce_OpenGLContext.cpp

+ 2
- 0
modules/juce_opengl/native/juce_OpenGL_android.h View File

@@ -129,6 +129,8 @@ public:
return nullptr;
}
struct Locker { Locker (NativeContext&) {} };
Component& component;
private:


+ 2
- 0
modules/juce_opengl/native/juce_OpenGL_ios.h View File

@@ -154,6 +154,8 @@ public:
int getSwapInterval() const noexcept { return swapFrames; }
struct Locker { Locker (NativeContext&) {} };
private:
JuceGLView* view;
CAEAGLLayer* glLayer;


+ 2
- 0
modules/juce_opengl/native/juce_OpenGL_linux.h View File

@@ -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;


+ 16
- 0
modules/juce_opengl/native/juce_OpenGL_osx.h View File

@@ -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];


+ 2
- 0
modules/juce_opengl/native/juce_OpenGL_win32.h View File

@@ -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;


+ 2
- 0
modules/juce_opengl/opengl/juce_OpenGLContext.cpp View File

@@ -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…
Cancel
Save