@@ -92,7 +92,7 @@ public: | |||||
updateTextureImage(); // this will update our dynamically-changing texture image. | updateTextureImage(); // this will update our dynamically-changing texture image. | ||||
drawBackground2DStuff(); // draws some 2D content to demonstrate the OpenGLRenderer class | |||||
drawBackground2DStuff(); // draws some 2D content to demonstrate the OpenGLGraphicsContext class | |||||
// Having used the juce 2D renderer, it will have messed-up a whole load of GL state, so | // Having used the juce 2D renderer, it will have messed-up a whole load of GL state, so | ||||
// we'll put back any important settings before doing our normal GL 3D drawing.. | // we'll put back any important settings before doing our normal GL 3D drawing.. | ||||
@@ -142,7 +142,7 @@ public: | |||||
void drawBackground2DStuff() | void drawBackground2DStuff() | ||||
{ | { | ||||
OpenGLRenderer glRenderer (*this); // Create an OpenGLRenderer that will draw into this GL window.. | |||||
OpenGLGraphicsContext glRenderer (*this); // Create an OpenGLGraphicsContext that will draw into this GL window.. | |||||
Graphics g (&glRenderer); // ..and then wrap it in a normal Graphics object so we can draw with it. | Graphics g (&glRenderer); // ..and then wrap it in a normal Graphics object so we can draw with it. | ||||
// This stuff just creates a spinning star shape and fills it.. | // This stuff just creates a spinning star shape and fills it.. | ||||
@@ -203,7 +203,7 @@ private: | |||||
void drawScrollingMessage (Graphics& g, int y) const | void drawScrollingMessage (Graphics& g, int y) const | ||||
{ | { | ||||
g.drawSingleLineText ("The background, foreground and texture are all being drawn using the OpenGLRenderer class, which " | |||||
g.drawSingleLineText ("The background, foreground and texture are all being drawn using the OpenGLGraphicsContext class, which " | |||||
"lets you use a standard JUCE 2D graphics context to render directly onto an OpenGL window or framebuffer... ", | "lets you use a standard JUCE 2D graphics context to render directly onto an OpenGL window or framebuffer... ", | ||||
(int) -std::fmod (textScrollPos, 2500.0f), y); | (int) -std::fmod (textScrollPos, 2500.0f), y); | ||||
} | } | ||||
@@ -68,7 +68,7 @@ | |||||
*/ | */ | ||||
#define juce_breakDebugger { assert (false); } | #define juce_breakDebugger { assert (false); } | ||||
#elif JUCE_IOS || JUCE_LINUX || JUCE_ANDROID | #elif JUCE_IOS || JUCE_LINUX || JUCE_ANDROID | ||||
#define juce_breakDebugger { kill (0, SIGTRAP); } | |||||
#define juce_breakDebugger { ::kill (0, SIGTRAP); } | |||||
#elif JUCE_USE_INTRINSICS | #elif JUCE_USE_INTRINSICS | ||||
#ifndef __INTEL_COMPILER | #ifndef __INTEL_COMPILER | ||||
#pragma intrinsic (__debugbreak) | #pragma intrinsic (__debugbreak) | ||||
@@ -97,6 +97,7 @@ enum | |||||
GL_LINK_STATUS = 0x8B82, | GL_LINK_STATUS = 0x8B82, | ||||
GL_SHADING_LANGUAGE_VERSION = 0x8B8C, | GL_SHADING_LANGUAGE_VERSION = 0x8B8C, | ||||
GL_FRAGMENT_SHADER = 0x8B30, | GL_FRAGMENT_SHADER = 0x8B30, | ||||
GL_VERTEX_SHADER = 0x8B31, | |||||
GL_FRAMEBUFFER = 0x8D40, | GL_FRAMEBUFFER = 0x8D40, | ||||
GL_RENDERBUFFER = 0x8D41, | GL_RENDERBUFFER = 0x8D41, | ||||
GL_FRAMEBUFFER_BINDING = 0x8CA6, | GL_FRAMEBUFFER_BINDING = 0x8CA6, | ||||
@@ -308,7 +308,7 @@ public: | |||||
if (! invalid.isEmpty()) | if (! invalid.isEmpty()) | ||||
{ | { | ||||
OpenGLRenderer g (frameBuffer); | |||||
OpenGLGraphicsContext g (frameBuffer); | |||||
g.clipToRectangleList (invalid); | g.clipToRectangleList (invalid); | ||||
g.setFill (Colours::transparentBlack); | g.setFill (Colours::transparentBlack); | ||||
@@ -338,7 +338,7 @@ public: | |||||
} | } | ||||
private: | private: | ||||
void paintOwner (OpenGLRenderer& glRenderer) | |||||
void paintOwner (OpenGLGraphicsContext& glRenderer) | |||||
{ | { | ||||
Graphics g (&glRenderer); | Graphics g (&glRenderer); | ||||
@@ -98,6 +98,9 @@ public: | |||||
*/ | */ | ||||
static OpenGLContext* getCurrentContext(); | static OpenGLContext* getCurrentContext(); | ||||
/** This property set allows you to attach persisent values to the context. */ | |||||
NamedValueSet properties; | |||||
protected: | protected: | ||||
//============================================================================== | //============================================================================== | ||||
OpenGLContext() noexcept; | OpenGLContext() noexcept; | ||||
@@ -30,13 +30,13 @@ | |||||
//============================================================================== | //============================================================================== | ||||
/** A LowLevelGraphicsContext for rendering into an OpenGL framebuffer or window. | /** A LowLevelGraphicsContext for rendering into an OpenGL framebuffer or window. | ||||
*/ | */ | ||||
class JUCE_API OpenGLRenderer : public LowLevelGraphicsContext | |||||
class JUCE_API OpenGLGraphicsContext : public LowLevelGraphicsContext | |||||
{ | { | ||||
public: | public: | ||||
explicit OpenGLRenderer (OpenGLComponent& target); | |||||
explicit OpenGLRenderer (OpenGLFrameBuffer& target); | |||||
OpenGLRenderer (unsigned int frameBufferID, int width, int height); | |||||
~OpenGLRenderer(); | |||||
explicit OpenGLGraphicsContext (OpenGLComponent& target); | |||||
explicit OpenGLGraphicsContext (OpenGLFrameBuffer& target); | |||||
OpenGLGraphicsContext (unsigned int frameBufferID, int width, int height); | |||||
~OpenGLGraphicsContext(); | |||||
bool isVectorDevice() const; | bool isVectorDevice() const; | ||||
void setOrigin (int x, int y); | void setOrigin (int x, int y); | ||||
@@ -38,7 +38,7 @@ public: | |||||
LowLevelGraphicsContext* createLowLevelContext() | LowLevelGraphicsContext* createLowLevelContext() | ||||
{ | { | ||||
return new OpenGLRenderer (frameBuffer); | |||||
return new OpenGLGraphicsContext (frameBuffer); | |||||
} | } | ||||
ImageType* createType() const { return new OpenGLImageType(); } | ImageType* createType() const { return new OpenGLImageType(); } | ||||
@@ -55,7 +55,7 @@ public: | |||||
If your app is built in debug mode, this method will assert if the program | If your app is built in debug mode, this method will assert if the program | ||||
fails to compile correctly. | fails to compile correctly. | ||||
The shaderType parameter is GL_VERTEX_SHADER or GL_FRAGMENT_SHADER | |||||
The shaderType parameter could be GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc. | |||||
*/ | */ | ||||
void addShader (const char* const shaderSourceCode, GLenum shaderType); | void addShader (const char* const shaderSourceCode, GLenum shaderType); | ||||