1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGL work: renamed OpenGLGraphicsContext class, and made it use shaders for rendering where available.

This commit is contained in:
jules 2011-12-15 13:50:19 +00:00
parent 0925b99e6d
commit a56a285e58
9 changed files with 1121 additions and 745 deletions

View file

@ -92,7 +92,7 @@ public:
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
// we'll put back any important settings before doing our normal GL 3D drawing..
@ -142,7 +142,7 @@ public:
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.
// This stuff just creates a spinning star shape and fills it..
@ -203,7 +203,7 @@ private:
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... ",
(int) -std::fmod (textScrollPos, 2500.0f), y);
}

View file

@ -68,7 +68,7 @@
*/
#define juce_breakDebugger { assert (false); }
#elif JUCE_IOS || JUCE_LINUX || JUCE_ANDROID
#define juce_breakDebugger { kill (0, SIGTRAP); }
#define juce_breakDebugger { ::kill (0, SIGTRAP); }
#elif JUCE_USE_INTRINSICS
#ifndef __INTEL_COMPILER
#pragma intrinsic (__debugbreak)

View file

@ -97,6 +97,7 @@ enum
GL_LINK_STATUS = 0x8B82,
GL_SHADING_LANGUAGE_VERSION = 0x8B8C,
GL_FRAGMENT_SHADER = 0x8B30,
GL_VERTEX_SHADER = 0x8B31,
GL_FRAMEBUFFER = 0x8D40,
GL_RENDERBUFFER = 0x8D41,
GL_FRAMEBUFFER_BINDING = 0x8CA6,

View file

@ -308,7 +308,7 @@ public:
if (! invalid.isEmpty())
{
OpenGLRenderer g (frameBuffer);
OpenGLGraphicsContext g (frameBuffer);
g.clipToRectangleList (invalid);
g.setFill (Colours::transparentBlack);
@ -338,7 +338,7 @@ public:
}
private:
void paintOwner (OpenGLRenderer& glRenderer)
void paintOwner (OpenGLGraphicsContext& glRenderer)
{
Graphics g (&glRenderer);

View file

@ -98,6 +98,9 @@ public:
*/
static OpenGLContext* getCurrentContext();
/** This property set allows you to attach persisent values to the context. */
NamedValueSet properties;
protected:
//==============================================================================
OpenGLContext() noexcept;

File diff suppressed because it is too large Load diff

View file

@ -30,13 +30,13 @@
//==============================================================================
/** A LowLevelGraphicsContext for rendering into an OpenGL framebuffer or window.
*/
class JUCE_API OpenGLRenderer : public LowLevelGraphicsContext
class JUCE_API OpenGLGraphicsContext : public LowLevelGraphicsContext
{
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;
void setOrigin (int x, int y);

View file

@ -38,7 +38,7 @@ public:
LowLevelGraphicsContext* createLowLevelContext()
{
return new OpenGLRenderer (frameBuffer);
return new OpenGLGraphicsContext (frameBuffer);
}
ImageType* createType() const { return new OpenGLImageType(); }

View file

@ -55,7 +55,7 @@ public:
If your app is built in debug mode, this method will assert if the program
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);