mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Add GLEW-inspired dynamic function loading
This commit is contained in:
parent
8a6a520026
commit
54423f6583
21 changed files with 23934 additions and 525 deletions
|
|
@ -41,6 +41,20 @@
|
|||
|
||||
#include "juce_opengl.h"
|
||||
|
||||
#define JUCE_STATIC_LINK_GL_VERSION_1_0 1
|
||||
#define JUCE_STATIC_LINK_GL_VERSION_1_1 1
|
||||
|
||||
#define JUCE_STATIC_LINK_GL_ES_VERSION_2_0 1
|
||||
#if !JUCE_ANDROID || JUCE_ANDROID_GL_ES_VERSION_3_0
|
||||
#define JUCE_STATIC_LINK_GL_ES_VERSION_3_0 1
|
||||
#endif
|
||||
|
||||
#if JUCE_OPENGL_ES
|
||||
#include "opengl/juce_gles2.cpp"
|
||||
#else
|
||||
#include "opengl/juce_gl.cpp"
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_IOS
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
|
@ -69,63 +83,27 @@
|
|||
|
||||
//==============================================================================
|
||||
#elif JUCE_ANDROID
|
||||
#ifndef GL_GLEXT_PROTOTYPES
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID_GL_ES_VERSION_3_0
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
// workaround for a bug in SDK 18 and 19
|
||||
// see: https://stackoverflow.com/questions/31003863/gles-3-0-including-gl2ext-h
|
||||
#define __gl2_h_
|
||||
#include <GLES2/gl2ext.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
#include <android/native_window.h>
|
||||
#include <android/native_window_jni.h>
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
namespace juce
|
||||
{
|
||||
|
||||
using namespace ::juce::gl;
|
||||
|
||||
void OpenGLExtensionFunctions::initialise()
|
||||
{
|
||||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
|
||||
#define JUCE_INIT_GL_FUNCTION(name, returnType, params, callparams) \
|
||||
name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name);
|
||||
|
||||
JUCE_GL_BASE_FUNCTIONS (JUCE_INIT_GL_FUNCTION)
|
||||
#undef JUCE_INIT_GL_FUNCTION
|
||||
|
||||
#define JUCE_INIT_GL_FUNCTION(name, returnType, params, callparams) \
|
||||
name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); \
|
||||
if (name == nullptr) \
|
||||
name = (type_ ## name) OpenGLHelpers::getExtensionFunction (JUCE_STRINGIFY (name ## EXT));
|
||||
|
||||
JUCE_GL_EXTENSION_FUNCTIONS (JUCE_INIT_GL_FUNCTION)
|
||||
#if JUCE_OPENGL3
|
||||
JUCE_GL_VERTEXBUFFER_FUNCTIONS (JUCE_INIT_GL_FUNCTION)
|
||||
#endif
|
||||
|
||||
#undef JUCE_INIT_GL_FUNCTION
|
||||
#endif
|
||||
gl::loadFunctions();
|
||||
}
|
||||
|
||||
#if JUCE_OPENGL_ES
|
||||
#define JUCE_DECLARE_GL_FUNCTION(name, returnType, params, callparams) \
|
||||
returnType OpenGLExtensionFunctions::name params noexcept { return ::name callparams; }
|
||||
|
||||
JUCE_GL_BASE_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION)
|
||||
JUCE_GL_EXTENSION_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION)
|
||||
#if JUCE_OPENGL3
|
||||
JUCE_GL_VERTEXBUFFER_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION)
|
||||
#endif
|
||||
|
||||
#undef JUCE_DECLARE_GL_FUNCTION
|
||||
#endif
|
||||
|
||||
#undef JUCE_GL_EXTENSION_FUNCTIONS
|
||||
#define X(name) decltype (::juce::gl::name)& OpenGLExtensionFunctions::name = ::juce::gl::name;
|
||||
JUCE_GL_BASE_FUNCTIONS
|
||||
JUCE_GL_EXTENSION_FUNCTIONS
|
||||
JUCE_GL_VERTEXBUFFER_FUNCTIONS
|
||||
#undef X
|
||||
|
||||
#if JUCE_DEBUG && ! defined (JUCE_CHECK_OPENGL_ERROR)
|
||||
static const char* getGLErrorMessage (const GLenum e) noexcept
|
||||
|
|
@ -271,6 +249,7 @@ private:
|
|||
#endif
|
||||
|
||||
#elif JUCE_WINDOWS
|
||||
#include "opengl/juce_wgl.h"
|
||||
#include "native/juce_OpenGL_win32.h"
|
||||
|
||||
#elif JUCE_LINUX || JUCE_BSD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue