1 // Copyright (C) 2013-2015 Patryk Nadrowski
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
\r
6 #define __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
\r
8 #include "SExposedVideoData.h"
\r
9 #include "SIrrCreationParameters.h"
\r
15 // For system specific window contexts (used for OpenGL)
\r
16 class IContextManager : public virtual IReferenceCounted
\r
19 //! Initialize manager with device creation parameters and device window (passed as exposed video data)
\r
20 virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) =0;
\r
22 //! Terminate manager, any cleanup that is left over. Manager needs a new initialize to be usable again
\r
23 virtual void terminate() =0;
\r
25 //! Create surface based on current window set
\r
26 virtual bool generateSurface() =0;
\r
28 //! Destroy current surface
\r
29 virtual void destroySurface() =0;
\r
31 //! Create context based on current surface
\r
32 virtual bool generateContext() =0;
\r
34 //! Destroy current context
\r
35 virtual void destroyContext() =0;
\r
37 //! Get current context
\r
38 virtual const SExposedVideoData& getContext() const =0;
\r
40 //! Change render context, disable old and activate new defined by videoData
\r
41 //\param restorePrimaryOnZero When true: restore original driver context when videoData is set to 0 values.
\r
42 // When false: resets the context when videoData is set to 0 values.
\r
43 /** This is mostly used internally by IVideoDriver::beginScene().
\r
44 But if you want to switch threads which access your OpenGL driver you will have to
\r
45 call this function as follows:
\r
46 Old thread gives up context with: activateContext(irr::video::SExposedVideoData());
\r
47 New thread takes over context with: activateContext(videoDriver->getExposedVideoData());
\r
48 Note that only 1 thread at a time may access an OpenGL context. */
\r
49 virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero=false) =0;
\r
52 virtual bool swapBuffers() =0;
\r
55 } // end namespace video
\r
56 } // end namespace irr
\r