Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
548e59d24f
3 changed files with 21 additions and 12 deletions
  1. +5
    -7
      src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp
  2. +10
    -4
      src/juce_appframework/gui/components/special/juce_OpenGLComponent.h
  3. +6
    -1
      src/juce_appframework/gui/graphics/drawables/juce_Drawable.h

+ 5
- 7
src/juce_appframework/gui/components/special/juce_OpenGLComponent.cpp View File

@@ -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)
{


+ 10
- 4
src/juce_appframework/gui/components/special/juce_OpenGLComponent.h View File

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


+ 6
- 1
src/juce_appframework/gui/graphics/drawables/juce_Drawable.h View File

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


Loading…
Cancel
Save