diff options
author | Tomoaki Kawada <i@yvt.jp> | 2019-06-01 18:54:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-02 13:50:50 +0300 |
commit | 62fe7e9a9d0e211bc2ad4cdfedb2489c5f899133 (patch) | |
tree | caa21887fa80485937012a17edcea8126ae7482e /intern/ghost | |
parent | 2a5dc454f63a4c3442d0ff0715cbd3d135bb5ca7 (diff) |
GPU: support default framebuffer with ID not equal to 0
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 5 | ||||
-rw-r--r-- | intern/ghost/GHOST_IWindow.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Context.h | 9 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Window.cpp | 5 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Window.h | 6 |
6 files changed, 38 insertions, 0 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 3238be8fd87..ea9d6925e23 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -722,6 +722,11 @@ extern GHOST_TSuccess GHOST_ActivateOpenGLContext(GHOST_ContextHandle contexthan extern GHOST_TSuccess GHOST_ReleaseOpenGLContext(GHOST_ContextHandle contexthandle); /** + * Get the OpenGL framebuffer handle that serves as a default framebuffer. + */ +extern unsigned int GHOST_GetDefaultOpenGLFramebuffer(GHOST_WindowHandle windwHandle); + +/** * Set which tablet API to use. Only affects Windows, other platforms have a single API. * \param systemhandle The handle to the system * \param api Enum indicating which API to use. diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h index 8042244c536..52894a7c38d 100644 --- a/intern/ghost/GHOST_IWindow.h +++ b/intern/ghost/GHOST_IWindow.h @@ -218,6 +218,12 @@ class GHOST_IWindow { virtual GHOST_TSuccess activateDrawingContext() = 0; /** + * Gets the OpenGL framebuffer associated with the window's contents. + * \return The name of an OpenGL framebuffer object. + */ + virtual unsigned int getDefaultFramebuffer() = 0; + + /** * Invalidates the contents of this window. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 38ddf9819f9..ef653c114e8 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -633,6 +633,13 @@ GHOST_TSuccess GHOST_ReleaseOpenGLContext(GHOST_ContextHandle contexthandle) return context->releaseDrawingContext(); } +unsigned int GHOST_GetDefaultOpenGLFramebuffer(GHOST_WindowHandle windowhandle) +{ + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + + return window->getDefaultFramebuffer(); +} + GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle) { GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h index 7937fd1f7c7..bbf6d6a510d 100644 --- a/intern/ghost/intern/GHOST_Context.h +++ b/intern/ghost/intern/GHOST_Context.h @@ -119,6 +119,15 @@ class GHOST_Context : public GHOST_IContext { return m_stereoVisual; } + /** + * Gets the OpenGL framebuffer associated with the OpenGL context + * \return The ID of an OpenGL framebuffer object. + */ + virtual unsigned int getDefaultFramebuffer() + { + return 0; + } + protected: void initContextGLEW(); diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp index 5649386063d..76f2d2347db 100644 --- a/intern/ghost/intern/GHOST_Window.cpp +++ b/intern/ghost/intern/GHOST_Window.cpp @@ -109,6 +109,11 @@ GHOST_TSuccess GHOST_Window::getSwapInterval(int &intervalOut) return m_context->getSwapInterval(intervalOut); } +unsigned int GHOST_Window::getDefaultFramebuffer() +{ + return (m_context) ? m_context->getDefaultFramebuffer() : 0; +} + GHOST_TSuccess GHOST_Window::activateDrawingContext() { return m_context->activateDrawingContext(); diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h index acd0c93ff87..50a563453f6 100644 --- a/intern/ghost/intern/GHOST_Window.h +++ b/intern/ghost/intern/GHOST_Window.h @@ -262,6 +262,12 @@ class GHOST_Window : public GHOST_IWindow { GHOST_TSuccess updateDrawingContext(); /** + * Gets the OpenGL framebuffer associated with the window's contents. + * \return The ID of an OpenGL framebuffer object. + */ + virtual unsigned int getDefaultFramebuffer(); + + /** * Returns the window user data. * \return The window user data. */ |