@@ -66,9 +66,18 @@ | |||||
#include <GLES/gl.h> | #include <GLES/gl.h> | ||||
#endif | #endif | ||||
#if (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) && ! defined (JUCE_USE_OPENGL_SHADERS) | |||||
#define JUCE_USE_OPENGL_SHADERS 1 | |||||
#endif | |||||
#ifndef JUCE_USE_OPENGL_FIXED_FUNCTION | |||||
#define JUCE_USE_OPENGL_FIXED_FUNCTION 1 | |||||
#endif | |||||
//============================================================================= | //============================================================================= | ||||
BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
#include "opengl/juce_OpenGLRenderingTarget.h" | #include "opengl/juce_OpenGLRenderingTarget.h" | ||||
#include "opengl/juce_OpenGLHelpers.h" | |||||
// START_AUTOINCLUDE opengl | // START_AUTOINCLUDE opengl | ||||
#ifndef __JUCE_DRAGGABLE3DORIENTATION_JUCEHEADER__ | #ifndef __JUCE_DRAGGABLE3DORIENTATION_JUCEHEADER__ | ||||
@@ -101,11 +101,13 @@ public: | |||||
return quaternion.getRotationMatrix(); | return quaternion.getRotationMatrix(); | ||||
} | } | ||||
#if JUCE_USE_OPENGL_FIXED_FUNCTION | |||||
/** Applies this rotation to the active OpenGL context's matrix. */ | /** Applies this rotation to the active OpenGL context's matrix. */ | ||||
void applyToOpenGLMatrix() const noexcept | void applyToOpenGLMatrix() const noexcept | ||||
{ | { | ||||
getRotationMatrix().applyToOpenGL(); | getRotationMatrix().applyToOpenGL(); | ||||
} | } | ||||
#endif | |||||
private: | private: | ||||
typedef Quaternion<GLfloat> QuaternionType; | typedef Quaternion<GLfloat> QuaternionType; | ||||
@@ -77,21 +77,16 @@ public: | |||||
return *this; | return *this; | ||||
} | } | ||||
#if JUCE_USE_OPENGL_FIXED_FUNCTION | |||||
/** Multiplies the active OpenGL context's matrix by this one. */ | /** Multiplies the active OpenGL context's matrix by this one. */ | ||||
void applyToOpenGL() const noexcept | void applyToOpenGL() const noexcept | ||||
{ | { | ||||
applyToGL (mat); | |||||
OpenGLHelpers::applyMatrix (mat); | |||||
} | } | ||||
#endif | |||||
/** The 4x4 matrix values. These are stored in the standard OpenGL order. */ | /** The 4x4 matrix values. These are stored in the standard OpenGL order. */ | ||||
Type mat[16]; | Type mat[16]; | ||||
private: | |||||
static void applyToGL (const GLfloat* const m) noexcept { glMultMatrixf (m); } | |||||
#if ! JUCE_OPENGL_ES | |||||
static void applyToGL (const GLdouble* const m) noexcept { glMultMatrixd (m); } | |||||
#endif | |||||
}; | }; | ||||
@@ -112,6 +112,7 @@ void OpenGLHelpers::clear (const Colour& colour) | |||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | ||||
} | } | ||||
#if JUCE_USE_OPENGL_FIXED_FUNCTION | |||||
void OpenGLHelpers::setColour (const Colour& colour) | void OpenGLHelpers::setColour (const Colour& colour) | ||||
{ | { | ||||
glColor4f (colour.getFloatRed(), colour.getFloatGreen(), | glColor4f (colour.getFloatRed(), colour.getFloatGreen(), | ||||
@@ -158,6 +159,19 @@ void OpenGLHelpers::applyTransform (const AffineTransform& t) | |||||
glMultMatrixf (m); | glMultMatrixf (m); | ||||
} | } | ||||
void OpenGLHelpers::applyMatrix (const float matrixValues[16]) | |||||
{ | |||||
glMultMatrixf (matrixValues); | |||||
} | |||||
#if ! JUCE_OPENGL_ES | |||||
void OpenGLHelpers::applyMatrix (const double matrixValues[16]) | |||||
{ | |||||
glMultMatrixd (matrixValues); | |||||
} | |||||
#endif | |||||
#endif | |||||
void OpenGLHelpers::enableScissorTest (const Rectangle<int>& clip) | void OpenGLHelpers::enableScissorTest (const Rectangle<int>& clip) | ||||
{ | { | ||||
glEnable (GL_SCISSOR_TEST); | glEnable (GL_SCISSOR_TEST); | ||||
@@ -46,6 +46,7 @@ public: | |||||
/** Clears the current context using the given colour. */ | /** Clears the current context using the given colour. */ | ||||
static void clear (const Colour& colour); | static void clear (const Colour& colour); | ||||
#if JUCE_USE_OPENGL_FIXED_FUNCTION | |||||
/** Sets the current colour using a JUCE colour. */ | /** Sets the current colour using a JUCE colour. */ | ||||
static void setColour (const Colour& colour); | static void setColour (const Colour& colour); | ||||
@@ -57,6 +58,12 @@ public: | |||||
static void applyTransform (const AffineTransform& t); | static void applyTransform (const AffineTransform& t); | ||||
static void applyMatrix (const float matrixValues[16]); | |||||
#if ! JUCE_OPENGL_ES | |||||
static void applyMatrix (const double matrixValues[16]); | |||||
#endif | |||||
#endif | |||||
static void enableScissorTest (const Rectangle<int>& clip); | static void enableScissorTest (const Rectangle<int>& clip); | ||||
/** Draws a 2D quad with the specified corner points. */ | /** Draws a 2D quad with the specified corner points. */ | ||||