LCOV - code coverage report
Current view: top level - eq - systemWindow.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 0 4 0.0 %
Date: 2017-12-16 05:07:20 Functions: 0 3 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *                          Daniel Nachbaur <danielnachbaur@gmail.com>
       4             :  *                          Maxim Makhinya
       5             :  *
       6             :  * This library is free software; you can redistribute it and/or modify it under
       7             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       8             :  * by the Free Software Foundation.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      11             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      12             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      13             :  * details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public License
      16             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      17             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             :  */
      19             : 
      20             : #ifndef EQ_SYSTEM_WINDOW_H
      21             : #define EQ_SYSTEM_WINDOW_H
      22             : 
      23             : #include <eq/types.h>
      24             : #include <eq/windowSettings.h> // WindowSettings::IAttribute enum
      25             : 
      26             : namespace eq
      27             : {
      28             : /**
      29             :  * The interface definition for system-specific windowing code.
      30             :  *
      31             :  * The system window abstracts all window system specific code and facilitates
      32             :  * porting to new windowing systems. Each eq::Window uses one eq::SystemWindow,
      33             :  * which is created and initialized in Window::configInitSystemWindow.
      34             :  */
      35             : class SystemWindow
      36             : {
      37             : public:
      38             :     /** Create a new SystemWindow for the given eq::Window. @version 1.7.2 */
      39             :     EQ_API SystemWindow(NotifierInterface& parent,
      40             :                         const WindowSettings& settings);
      41             : 
      42             :     /** Destroy the SystemWindow. @version 1.0 */
      43             :     EQ_API virtual ~SystemWindow();
      44             : 
      45             :     /** @name Methods forwarded from eq::Window */
      46             :     //@{
      47             :     /**
      48             :      * Initialize this system window.
      49             :      *
      50             :      * This method should take into account all attributes of the parent Window.
      51             :      *
      52             :      * @return true if the window was correctly initialized, false
      53             :      *         on any error.
      54             :      * @version 1.0
      55             :      */
      56             :     EQ_API virtual bool configInit() = 0;
      57             : 
      58             :     /**
      59             :      * De-initialize this system window.
      60             :      *
      61             :      * This function might be called on partially or uninitialized system
      62             :      * windows, and the implemenation has therefore be tolerant enough to handle
      63             :      * this case.
      64             :      * @version 1.0
      65             :      */
      66             :     EQ_API virtual void configExit() = 0;
      67             : 
      68             :     /**
      69             :      * Make the system window rendering context and drawable current.
      70             :      *
      71             :      * This function invalidates the pipe's make current cache.
      72             :      * @version 1.0
      73             :      */
      74             :     EQ_API virtual void makeCurrent(const bool cache = true) const = 0;
      75             : 
      76             :     /**
      77             :      * This results in no context being current in the current thread.
      78             :      *
      79             :      * This function resets the pipe's make current cache.
      80             :      * @version 1.10
      81             :      */
      82             :     EQ_API virtual void doneCurrent() const = 0;
      83             : 
      84             :     /** Bind the window's FBO, if it uses an FBO drawable. @version 1.0 */
      85             :     EQ_API virtual void bindFrameBuffer() const = 0;
      86             : 
      87             :     /** Bind the window's draw FBO, used for multisampling. @version 1.9 */
      88             :     EQ_API virtual void bindDrawFrameBuffer() const = 0;
      89             : 
      90             :     /** Update the window's FBO from the multisampled FBO. @version 1.9 */
      91             :     EQ_API virtual void updateFrameBuffer() const = 0;
      92             : 
      93             :     /** Swap the front and back buffer. @version 1.0 */
      94             :     EQ_API virtual void swapBuffers() = 0;
      95             : 
      96             :     /** Flush all command buffers. @version 1.5.2 */
      97             :     EQ_API virtual void flush() = 0;
      98             : 
      99             :     /** Finish execution of  all commands. @version 1.5.2 */
     100             :     EQ_API virtual void finish() = 0;
     101             : 
     102             :     /**
     103             :      * Join a NV_swap_group.
     104             :      *
     105             :      * See WGL or GLX implementation and OpenGL extension for details on how to
     106             :      * implement this function.
     107             :      *
     108             :      * @param group the swap group name.
     109             :      * @param barrier the swap barrier name.
     110             :      * @version 1.0
     111             :      */
     112             :     EQ_API virtual void joinNVSwapBarrier(const uint32_t group,
     113             :                                           const uint32_t barrier) = 0;
     114             :     //@}
     115             : 
     116             :     /** @name Frame Buffer Object support. */
     117             :     //@{
     118             :     /** @return the FBO of this window, or 0. @version 1.0 */
     119           0 :     virtual const util::FrameBufferObject* getFrameBufferObject() const
     120             :     {
     121           0 :         return 0;
     122             :     }
     123             :     /** @return the FBO of this window, or 0. @version 1.0 */
     124           0 :     virtual util::FrameBufferObject* getFrameBufferObject() { return 0; }
     125             :     //@}
     126             : 
     127             :     /**
     128             :      * Set up the given drawable based on the current context.
     129             :      * @version 1.0
     130             :      */
     131             :     EQ_API virtual void queryDrawableConfig(DrawableConfig& dc) = 0;
     132             : 
     133             :     /**
     134             :      * Get the GLEW context for this window.
     135             :      *
     136             :      * The glew context is initialized during window initialization, and
     137             :      * provides access to OpenGL extensions. This function does not follow the
     138             :      * Equalizer naming conventions, since GLEW uses a function of this name to
     139             :      * automatically resolve OpenGL function entry points. Therefore, any
     140             :      * supported GL function can be called directly from an initialized
     141             :      * SystemWindow.
     142             :      *
     143             :      * @return the extended OpenGL function table for the window's OpenGL
     144             :      *         context.
     145             :      * @version 1.0
     146             :      */
     147           0 :     virtual const GLEWContext* glewGetContext() const { return 0; }
     148             :     /**
     149             :      * Send a window error event to the application node.
     150             :      *
     151             :      * @param error the error code.
     152             :      * @version 1.7.1
     153             :      */
     154             :     EQ_API EventOCommand sendError(const uint32_t error);
     155             : 
     156             :     /** Process a stateless event. @return true if the event was handled. */
     157             :     EQ_API bool processEvent(EventType type);
     158             : 
     159             :     /** Process a (re)size event. @return true if the event was handled. */
     160             :     EQ_API bool processEvent(EventType type, SizeEvent& event);
     161             : 
     162             :     /** Process a mouse event. @return true if the event was handled. */
     163             :     EQ_API bool processEvent(EventType type, PointerEvent& event);
     164             : 
     165             :     /** Process a keyboard event. @return true if the event was handled. */
     166             :     EQ_API bool processEvent(EventType type, KeyEvent& event);
     167             : 
     168             :     /** Process an axis event. @return true if the event was handled. */
     169             :     EQ_API bool processEvent(AxisEvent& event);
     170             : 
     171             :     /** Process a button event. @return true if the event was handled. */
     172             :     EQ_API bool processEvent(ButtonEvent& event);
     173             : 
     174             :     /**
     175             :      * Set the window's pixel viewport wrt its parent pipe.
     176             :      *
     177             :      * @param pvp the viewport in pixels.
     178             :      * @version 1.7.2
     179             :      */
     180             :     EQ_API void setPixelViewport(const PixelViewport& pvp);
     181             : 
     182             :     /**
     183             :      * @return the window's pixel viewport wrt the parent pipe.
     184             :      * @version 1.7.2
     185             :      */
     186             :     EQ_API const PixelViewport& getPixelViewport() const;
     187             : 
     188             :     /**
     189             :      * Resize the underlying frame buffer to the given size.
     190             :      *
     191             :      * @param pvp the viewport in pixels.
     192             :      * @version 2.1
     193             :      */
     194             :     EQ_API virtual void resize(const PixelViewport& pvp) = 0;
     195             : 
     196             :     /**
     197             :      * @internal
     198             :      * @return the OpenGL texture format corresponding to the window's color
     199             :      *         drawable configuration
     200             :      */
     201             :     EQ_API uint32_t getColorFormat() const;
     202             : 
     203             :     /** Set the window's name. @version 1.7.2 */
     204             :     EQ_API void setName(const std::string& name);
     205             : 
     206             :     /** @return the window's name. @version 1.7.2 */
     207             :     EQ_API const std::string& getName() const;
     208             : 
     209             :     /** @return the value of an integer attribute. @version 1.7.2 */
     210             :     EQ_API int32_t getIAttribute(const WindowSettings::IAttribute attr) const;
     211             : 
     212             :     /**
     213             :      * @return the window with which this window shares the GL context.
     214             :      * @version 1.7.2
     215             :      */
     216             :     EQ_API const SystemWindow* getSharedContextWindow() const;
     217             : 
     218             : private:
     219             :     NotifierInterface& _parent;
     220             :     WindowSettings _settings;
     221             : };
     222             : }
     223             : 
     224             : #endif // EQ_SYSTEM_WINDOW_H

Generated by: LCOV version 1.11