diff options
author | Johannes Schickel | 2015-12-11 23:51:21 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-03-16 20:29:24 +0100 |
commit | 8f3783da0994703e9fe6fcfc666d194c9eb00865 (patch) | |
tree | c80866292bf96a43e5056570a025eafad7ca9a82 | |
parent | e5e234b864e75862a2de72ee6c3b8bda47f41c23 (diff) | |
download | scummvm-rg350-8f3783da0994703e9fe6fcfc666d194c9eb00865.tar.gz scummvm-rg350-8f3783da0994703e9fe6fcfc666d194c9eb00865.tar.bz2 scummvm-rg350-8f3783da0994703e9fe6fcfc666d194c9eb00865.zip |
OPENGL: Add functionality to query OpenGL functions on runtime.
This can and will be used for future extension usage support.
Tizen changes have been untested.
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 15 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-sys.h | 6 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 4 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 2 | ||||
-rw-r--r-- | backends/platform/tizen/graphics.cpp | 4 | ||||
-rw-r--r-- | backends/platform/tizen/graphics.h | 2 |
6 files changed, 33 insertions, 0 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 2a03b878ce..f83c9537ec 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -286,6 +286,21 @@ private: */ void initializeGLExtensions(); +protected: + /** + * Query the address of an OpenGL function by name. + * + * This can only be used after a context has been created. + * Please note that this function can return valid addresses even if the + * OpenGL context does not support the function. + * + * @param name The name of the OpenGL function. + * @return An function pointer for the requested OpenGL function or + * nullptr in case of failure. + */ + virtual void *getProcAddress(const char *name) const = 0; + +private: /** * Try to determine the internal parameters for a given pixel format. * diff --git a/backends/graphics/opengl/opengl-sys.h b/backends/graphics/opengl/opengl-sys.h index 4e21894380..f4d8488259 100644 --- a/backends/graphics/opengl/opengl-sys.h +++ b/backends/graphics/opengl/opengl-sys.h @@ -54,4 +54,10 @@ using namespace Tizen::Graphics::Opengl; #include <GL/gl.h> #endif +#ifdef SDL_BACKEND +#define GLCALLCONV APIENTRY +#else +#define GLCALLCONV +#endif + #endif diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 0d140ee4d7..d1e798edc1 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -305,6 +305,10 @@ void OpenGLSdlGraphicsManager::refreshScreen() { #endif } +void *OpenGLSdlGraphicsManager::getProcAddress(const char *name) const { + return SDL_GL_GetProcAddress(name); +} + bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) { // In case we request a fullscreen mode we will use the mode the user // has chosen last time or the biggest mode available. diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 1552593575..fe289d672d 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -67,6 +67,8 @@ protected: virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format); virtual void refreshScreen(); + + virtual void *getProcAddress(const char *name) const; private: bool setupMode(uint width, uint height); diff --git a/backends/platform/tizen/graphics.cpp b/backends/platform/tizen/graphics.cpp index 759c4e519d..971be460d8 100644 --- a/backends/platform/tizen/graphics.cpp +++ b/backends/platform/tizen/graphics.cpp @@ -206,3 +206,7 @@ bool TizenGraphicsManager::loadVideoMode(uint requestedWidth, uint requestedHeig void TizenGraphicsManager::refreshScreen() { eglSwapBuffers(_eglDisplay, _eglSurface); } + +void *TizenGraphicsManager::getProcAddress(const char *name) const { + return eglGetProcAddress(name); +} diff --git a/backends/platform/tizen/graphics.h b/backends/platform/tizen/graphics.h index 1522d66bbe..1798b078d8 100644 --- a/backends/platform/tizen/graphics.h +++ b/backends/platform/tizen/graphics.h @@ -63,6 +63,8 @@ protected: void refreshScreen(); + void *getProcAddress(const char *name) const; + const Graphics::Font *getFontOSD(); private: |