mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
parent
8cbeb41cd2
commit
548e59d24f
3 changed files with 21 additions and 12 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue