Browse Source

More OpenGL shader work.

tags/2021-05-28
jules 13 years ago
parent
commit
37d8a65407
6 changed files with 741 additions and 327 deletions
  1. +9
    -0
      modules/juce_opengl/juce_opengl.h
  2. +2
    -0
      modules/juce_opengl/opengl/juce_Draggable3DOrientation.h
  3. +3
    -8
      modules/juce_opengl/opengl/juce_Matrix3D.h
  4. +706
    -319
      modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp
  5. +14
    -0
      modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp
  6. +7
    -0
      modules/juce_opengl/opengl/juce_OpenGLHelpers.h

+ 9
- 0
modules/juce_opengl/juce_opengl.h View File

@@ -66,9 +66,18 @@
#include <GLES/gl.h>
#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
#include "opengl/juce_OpenGLRenderingTarget.h"
#include "opengl/juce_OpenGLHelpers.h"
// START_AUTOINCLUDE opengl
#ifndef __JUCE_DRAGGABLE3DORIENTATION_JUCEHEADER__


+ 2
- 0
modules/juce_opengl/opengl/juce_Draggable3DOrientation.h View File

@@ -101,11 +101,13 @@ public:
return quaternion.getRotationMatrix();
}
#if JUCE_USE_OPENGL_FIXED_FUNCTION
/** Applies this rotation to the active OpenGL context's matrix. */
void applyToOpenGLMatrix() const noexcept
{
getRotationMatrix().applyToOpenGL();
}
#endif
private:
typedef Quaternion<GLfloat> QuaternionType;


+ 3
- 8
modules/juce_opengl/opengl/juce_Matrix3D.h View File

@@ -77,21 +77,16 @@ public:
return *this;
}
#if JUCE_USE_OPENGL_FIXED_FUNCTION
/** Multiplies the active OpenGL context's matrix by this one. */
void applyToOpenGL() const noexcept
{
applyToGL (mat);
OpenGLHelpers::applyMatrix (mat);
}
#endif
/** The 4x4 matrix values. These are stored in the standard OpenGL order. */
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
};


+ 706
- 319
modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp
File diff suppressed because it is too large
View File


+ 14
- 0
modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp View File

@@ -112,6 +112,7 @@ void OpenGLHelpers::clear (const Colour& colour)
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)
{
glColor4f (colour.getFloatRed(), colour.getFloatGreen(),
@@ -158,6 +159,19 @@ void OpenGLHelpers::applyTransform (const AffineTransform& t)
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)
{
glEnable (GL_SCISSOR_TEST);


+ 7
- 0
modules/juce_opengl/opengl/juce_OpenGLHelpers.h View File

@@ -46,6 +46,7 @@ public:
/** Clears the current context using the given colour. */
static void clear (const Colour& colour);
#if JUCE_USE_OPENGL_FIXED_FUNCTION
/** Sets the current colour using a JUCE colour. */
static void setColour (const Colour& colour);
@@ -57,6 +58,12 @@ public:
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);
/** Draws a 2D quad with the specified corner points. */


Loading…
Cancel
Save