Browse Source

OpenGL tweaks.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
fe92227a4d
6 changed files with 41 additions and 6 deletions
  1. +18
    -3
      juce_amalgamated.cpp
  2. +4
    -0
      juce_amalgamated.h
  3. +4
    -0
      src/gui/components/special/juce_OpenGLComponent.h
  4. +6
    -2
      src/native/linux/juce_linux_Windowing.cpp
  5. +3
    -0
      src/native/mac/juce_mac_OpenGLComponent.mm
  6. +6
    -1
      src/native/windows/juce_win32_OpenGLComponent.cpp

+ 18
- 3
juce_amalgamated.cpp View File

@@ -244015,7 +244015,12 @@ public:
void deleteContext() void deleteContext()
{ {
makeInactive(); makeInactive();
wglDeleteContext (renderContext);

if (renderContext != 0)
{
wglDeleteContext (renderContext);
renderContext = 0;
}
} }


bool makeActive() const throw() bool makeActive() const throw()
@@ -259143,8 +259148,12 @@ public:
{ {
makeInactive(); makeInactive();


ScopedXLock xlock;
glXDestroyContext (display, renderContext);
if (renderContext != 0)
{
ScopedXLock xlock;
glXDestroyContext (display, renderContext);
renderContext = 0;
}
} }


bool makeActive() const throw() bool makeActive() const throw()
@@ -266828,6 +266837,9 @@ public:
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
[renderContext setView: nil];
[view setOpenGLContext: nil];
renderContext = nil;
} }


bool makeActive() const throw() bool makeActive() const throw()
@@ -272417,6 +272429,9 @@ public:
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
[renderContext setView: nil];
[view setOpenGLContext: nil];
renderContext = nil;
} }


bool makeActive() const throw() bool makeActive() const throw()


+ 4
- 0
juce_amalgamated.h View File

@@ -56878,6 +56878,10 @@ public:
virtual void* getRawContext() const throw() = 0; virtual void* getRawContext() const throw() = 0;


/** Deletes the context. /** Deletes the context.

This must only be called on the message thread, or will deadlock.
On background threads, call getCurrentContext()->deleteContext(), but be careful not
to call any other OpenGL function afterwards.
This doesn't touch other resources, such as window handles, etc. This doesn't touch other resources, such as window handles, etc.
You'll probably never have to call this method directly. You'll probably never have to call this method directly.
*/ */


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

@@ -147,6 +147,10 @@ public:
virtual void* getRawContext() const throw() = 0; virtual void* getRawContext() const throw() = 0;
/** Deletes the context. /** Deletes the context.
This must only be called on the message thread, or will deadlock.
On background threads, call getCurrentContext()->deleteContext(), but be careful not
to call any other OpenGL function afterwards.
This doesn't touch other resources, such as window handles, etc. This doesn't touch other resources, such as window handles, etc.
You'll probably never have to call this method directly. You'll probably never have to call this method directly.
*/ */


+ 6
- 2
src/native/linux/juce_linux_Windowing.cpp View File

@@ -3244,8 +3244,12 @@ public:
{ {
makeInactive(); makeInactive();
ScopedXLock xlock;
glXDestroyContext (display, renderContext);
if (renderContext != 0)
{
ScopedXLock xlock;
glXDestroyContext (display, renderContext);
renderContext = 0;
}
} }
bool makeActive() const throw() bool makeActive() const throw()


+ 3
- 0
src/native/mac/juce_mac_OpenGLComponent.mm View File

@@ -184,6 +184,9 @@ public:
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
[renderContext setView: nil];
[view setOpenGLContext: nil];
renderContext = nil;
} }
bool makeActive() const throw() bool makeActive() const throw()


+ 6
- 1
src/native/windows/juce_win32_OpenGLComponent.cpp View File

@@ -123,7 +123,12 @@ public:
void deleteContext() void deleteContext()
{ {
makeInactive(); makeInactive();
wglDeleteContext (renderContext);
if (renderContext != 0)
{
wglDeleteContext (renderContext);
renderContext = 0;
}
} }
bool makeActive() const throw() bool makeActive() const throw()


Loading…
Cancel
Save