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
16 // For system specific window contexts (used for OpenGL)
\r
17 class IContextManager : public virtual IReferenceCounted
\r
20 //! Initialize manager with device creation parameters and device window (passed as exposed video data)
\r
21 virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) =0;
\r
23 //! Terminate manager, any cleanup that is left over. Manager needs a new initialize to be usable again
\r
24 virtual void terminate() =0;
\r
26 //! Create surface based on current window set
\r
27 virtual bool generateSurface() =0;
\r
29 //! Destroy current surface
\r
30 virtual void destroySurface() =0;
\r
32 //! Create context based on current surface
\r
33 virtual bool generateContext() =0;
\r
35 //! Destroy current context
\r
36 virtual void destroyContext() =0;
\r
38 //! Get current context
\r
39 virtual const SExposedVideoData& getContext() const =0;
\r
41 //! Change render context, disable old and activate new defined by videoData
\r
42 //\param restorePrimaryOnZero When true: restore original driver context when videoData is set to 0 values.
\r
43 // When false: resets the context when videoData is set to 0 values.
\r
44 /** This is mostly used internally by IVideoDriver::beginScene().
\r
45 But if you want to switch threads which access your OpenGL driver you will have to
\r
46 call this function as follows:
\r
47 Old thread gives up context with: activateContext(irr::video::SExposedVideoData());
\r
48 New thread takes over context with: activateContext(videoDriver->getExposedVideoData());
\r
49 Note that only 1 thread at a time may access an OpenGL context. */
\r
50 virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero=false) =0;
\r
52 //! Get the address of any OpenGL procedure (including core procedures).
\r
53 virtual void* getProcAddress(const std::string &procName) =0;
\r
56 virtual bool swapBuffers() =0;
\r
59 } // end namespace video
\r
60 } // end namespace irr
\r