diff --git a/src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp b/src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp index 626d7d921b..43d4c0e48c 100644 --- a/src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp +++ b/src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp @@ -143,7 +143,7 @@ private: //============================================================================== OpenGLComponent::OpenGLComponent() : context (0), - componentToShareListsWith (0), + contextToShareListsWith (0), needToUpdateViewport (true) { setOpaque (true); @@ -205,13 +205,13 @@ void OpenGLComponent::setPixelFormat (const OpenGLPixelFormat& formatToUse) } } -void OpenGLComponent::shareWith (OpenGLComponent* const comp) +void OpenGLComponent::shareWith (OpenGLContext* context) { - if (componentToShareListsWith != comp) + if (contextToShareListsWith != context) { const ScopedLock sl (contextLock); deleteContext(); - componentToShareListsWith = comp; + contextToShareListsWith = context; } } @@ -225,9 +225,7 @@ bool OpenGLComponent::makeCurrentContextActive() { context = OpenGLContext::createContextForWindow (this, preferredPixelFormat, - componentToShareListsWith != 0 - ? componentToShareListsWith->context - : 0); + contextToShareListsWith); if (context != 0) { diff --git a/src/juce_appframework/gui/components/special/juce_OpenGLComponent.h b/src/juce_appframework/gui/components/special/juce_OpenGLComponent.h index f021b926bb..4a395289af 100644 --- a/src/juce_appframework/gui/components/special/juce_OpenGLComponent.h +++ b/src/juce_appframework/gui/components/special/juce_OpenGLComponent.h @@ -207,12 +207,18 @@ public: /** Returns the pixel format that this component is currently using. */ const OpenGLPixelFormat getPixelFormat() const; - /** Specifies another component whose OpenGL context should be shared with - this one. + /** Specifies an OpenGL context which should be shared with the one that this + component is using. This is an OpenGL feature that lets two contexts share their texture data. + + Note that this pointer is stored by the component, and when the component + needs to recreate its internal context for some reason, the same context + will be used again to share lists. So if you pass a context in here, + don't delete the context while this component is still using it! You can + call shareWith (0) to stop this component from sharing with it. */ - void shareWith (OpenGLComponent* const componentToShareListsWith); + void shareWith (OpenGLContext* contextToShareListsWith); //============================================================================== /** Flips the openGL buffers over. */ @@ -323,7 +329,7 @@ private: OpenGLComponentWatcher* componentWatcher; OpenGLContext* context; - OpenGLComponent* componentToShareListsWith; + OpenGLContext* contextToShareListsWith; CriticalSection contextLock; OpenGLPixelFormat preferredPixelFormat; diff --git a/src/juce_appframework/gui/graphics/drawables/juce_Drawable.h b/src/juce_appframework/gui/graphics/drawables/juce_Drawable.h index 44d4158779..9ed64ce898 100644 --- a/src/juce_appframework/gui/graphics/drawables/juce_Drawable.h +++ b/src/juce_appframework/gui/graphics/drawables/juce_Drawable.h @@ -75,7 +75,8 @@ public: /** Renders the Drawable at a given offset within the Graphics context. - This is basically a quick way of saying: + The co-ordinates passed-in are used to translate the object relative to its own + origin before drawing it - this is basically a quick way of saying: @code draw (g, AffineTransform::translation (x, y)). @@ -109,10 +110,14 @@ public: //============================================================================== /** Returns the smallest rectangle that can contain this Drawable object. + + Co-ordinates are relative to the object's own origin. */ virtual void getBounds (float& x, float& y, float& width, float& height) const = 0; /** Returns true if the given point is somewhere inside this Drawable. + + Co-ordinates are relative to the object's own origin. */ virtual bool hitTest (float x, float y) const = 0;