mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
Added openGL macro JUCE_GLSL_VERSION
This commit is contained in:
parent
f376a82a56
commit
6c30e83de1
2 changed files with 21 additions and 4 deletions
|
|
@ -63,7 +63,6 @@
|
|||
#endif
|
||||
#elif JUCE_MAC
|
||||
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
#define JUCE_OPENGL3 1
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#else
|
||||
|
|
@ -74,6 +73,24 @@
|
|||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
|
||||
#if GL_VERSION_3_2 || GL_ES_VERSION_3_0
|
||||
#define JUCE_OPENGL3 1
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/** This macro is a helper for use in GLSL shader code which needs to compile on both OpenGL 2.1 and OpenGL 3.0.
|
||||
It's mandatory in OpenGL 3.0 to specify the GLSL version.
|
||||
*/
|
||||
#if JUCE_OPENGL3
|
||||
#if JUCE_OPENGL_ES
|
||||
#define JUCE_GLSL_VERSION "#version 300 es"
|
||||
#else
|
||||
#define JUCE_GLSL_VERSION "#version 150"
|
||||
#endif
|
||||
#else
|
||||
#define JUCE_GLSL_VERSION ""
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
#if JUCE_OPENGL_ES || defined (DOXYGEN)
|
||||
/** This macro is a helper for use in GLSL shader code which needs to compile on both GLES and desktop GL.
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ String OpenGLHelpers::translateVertexShaderToV3 (const String& code)
|
|||
{
|
||||
#if JUCE_OPENGL3
|
||||
if (OpenGLShaderProgram::getLanguageVersion() > 1.2)
|
||||
return "#version 150\n" + code.replace ("attribute", "in")
|
||||
.replace ("varying", "out");
|
||||
return JUCE_GLSL_VERSION "\n" + code.replace ("attribute", "in")
|
||||
.replace ("varying", "out");
|
||||
#endif
|
||||
|
||||
return code;
|
||||
|
|
@ -92,7 +92,7 @@ String OpenGLHelpers::translateFragmentShaderToV3 (const String& code)
|
|||
{
|
||||
#if JUCE_OPENGL3
|
||||
if (OpenGLShaderProgram::getLanguageVersion() > 1.2)
|
||||
return "#version 150\n"
|
||||
return JUCE_GLSL_VERSION "\n"
|
||||
"out vec4 fragColor;\n"
|
||||
+ code.replace ("varying", "in")
|
||||
.replace ("texture2D", "texture")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue