Render context class which holds the graphics context objects and the window objects. More...
#include <spRenderContext.hpp>
Public Member Functions | |
virtual | ~RenderContext () |
virtual bool | openGraphicsScreen (void *ParentWindow, const dim::size2di &Resolution, const io::stringc &Title, s32 ColorDepth, bool isFullscreen, const SDeviceFlags &Flags)=0 |
virtual void | closeGraphicsScreen ()=0 |
Closes the graphics screen and releases all hardware specific resources. | |
virtual void | flipBuffers ()=0 |
virtual bool | activate ()=0 |
Activates the render context by making it to the current. | |
virtual bool | deactivate ()=0 |
Deactivates the render context. | |
virtual void | setWindowTitle (const io::stringc &Title) |
Sets the window title. | |
virtual io::stringc | getWindowTitle () const |
Returns the window title. | |
virtual void | setWindowPosition (const dim::point2di &Position) |
Sets the window position. By default the window is screen centered. | |
virtual dim::point2di | getWindowPosition () const |
Returns the window position. | |
virtual dim::size2di | getWindowSize () const |
Returns the window size. | |
virtual dim::size2di | getWindowBorder () const |
Returns the window border size. | |
virtual bool | isWindowActive () const |
Returns true if the window is the active one. | |
virtual void * | getWindowObject ()=0 |
virtual SharedRenderContext * | createSharedContext () |
virtual void | deleteSharedContext (SharedRenderContext *SharedContext) |
Deletes the specified shared render context. | |
virtual void | setFullscreen (bool Enable) |
Enables or disables fullscreen mode. | |
virtual void | setVsync (bool isVsync) |
Enables or disabels vertical synchronisation. | |
virtual void | setResolution (const dim::size2di &Resolution) |
bool | getFullscreen () const |
s32 | getColorDepth () const |
Returns the color depth. This can not be changed. | |
dim::size2di | getResolution () const |
Returns the screen resolution. This can not be changed. | |
SDeviceFlags | getFlags () const |
Returns the device flags. This can not be changed. | |
bool | getVsync () const |
Static Public Member Functions | |
static RenderContext * | getActiveRenderContext () |
Returns a pointer to the the active render context. | |
static void | setActiveRenderContext (RenderContext *Context) |
Protected Member Functions | |
RenderContext () | |
void | resetConfig () |
Protected Attributes | |
void * | ParentWindow_ |
dim::size2di | Resolution_ |
s32 | ColorDepth_ |
bool | isFullscreen_ |
io::stringc | Title_ |
SDeviceFlags | Flags_ |
std::list< SharedRenderContext * > | SharedContextList_ |
Static Protected Attributes | |
static RenderContext * | ActiveRenderContext_ = 0 |
Render context class which holds the graphics context objects and the window objects.
sp::video::RenderContext::~RenderContext | ( | ) | [virtual] |
sp::video::RenderContext::RenderContext | ( | ) | [protected] |
virtual bool sp::video::RenderContext::activate | ( | ) | [pure virtual] |
Activates the render context by making it to the current.
Implemented in sp::video::DesktopRenderContext, sp::video::Direct3D9RenderContext, sp::video::OpenGLRenderContext, and sp::video::OpenGLESRenderContext.
virtual void sp::video::RenderContext::closeGraphicsScreen | ( | ) | [pure virtual] |
Closes the graphics screen and releases all hardware specific resources.
Implemented in sp::video::DesktopRenderContext, sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, sp::video::OpenGLRenderContext, and sp::video::OpenGLESRenderContext.
SharedRenderContext * sp::video::RenderContext::createSharedContext | ( | ) | [virtual] |
Creates a shared render context. Use shared render contexts when creating renderer resources in multi-threading. e.g. when you want to load textures on the fly in another thread.
Window,: | Specifies a pointer to the window (e.g. HWND for Windows) from which the device-context is to be used. By default 0 which means that no separate window is used. |
Reimplemented in sp::video::OpenGLRenderContext.
virtual bool sp::video::RenderContext::deactivate | ( | ) | [pure virtual] |
Deactivates the render context.
Implemented in sp::video::DesktopRenderContext, sp::video::Direct3D9RenderContext, sp::video::OpenGLRenderContext, and sp::video::OpenGLESRenderContext.
void sp::video::RenderContext::deleteSharedContext | ( | SharedRenderContext * | SharedContext | ) | [virtual] |
Deletes the specified shared render context.
virtual void sp::video::RenderContext::flipBuffers | ( | ) | [pure virtual] |
Flips the buffers to see the final image onto the monitor. If vsync (vertical synchronisation) is enabled the program waits at this point until the graphics card releases the synchronisation.
Implemented in sp::video::DesktopRenderContext, sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, sp::video::OpenGLRenderContext, and sp::video::OpenGLESRenderContext.
RenderContext * sp::video::RenderContext::getActiveRenderContext | ( | ) | [static] |
Returns a pointer to the the active render context.
s32 sp::video::RenderContext::getColorDepth | ( | ) | const [inline] |
Returns the color depth. This can not be changed.
SDeviceFlags sp::video::RenderContext::getFlags | ( | ) | const [inline] |
Returns the device flags. This can not be changed.
bool sp::video::RenderContext::getFullscreen | ( | ) | const [inline] |
Returns true if fullscreen mode is enabled. Otherwise false.
dim::size2di sp::video::RenderContext::getResolution | ( | ) | const [inline] |
Returns the screen resolution. This can not be changed.
bool sp::video::RenderContext::getVsync | ( | ) | const [inline] |
Returns true if vertical synchronisation is enabled. This is equivalent to the following code snippet:
spContext->getFlags().isVsync;
dim::size2di sp::video::RenderContext::getWindowBorder | ( | ) | const [virtual] |
Returns the window border size.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
virtual void* sp::video::RenderContext::getWindowObject | ( | ) | [pure virtual] |
Returns the window object. For MS/Windows it's a HWND* and on GNU/Linux it's a Window*.
#if defined(SP_PLATFORM_WINDOWS) HWND hWnd = *((HWND*)Context->getWindowObject()); #elif defined(SP_PLATFORM_LINUX) Window XWin = *((Window*)Context->getWindowObject()); #endif
Implemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
dim::point2di sp::video::RenderContext::getWindowPosition | ( | ) | const [virtual] |
Returns the window position.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
dim::size2di sp::video::RenderContext::getWindowSize | ( | ) | const [virtual] |
Returns the window size.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
io::stringc sp::video::RenderContext::getWindowTitle | ( | ) | const [virtual] |
Returns the window title.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
bool sp::video::RenderContext::isWindowActive | ( | ) | const [virtual] |
Returns true if the window is the active one.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
virtual bool sp::video::RenderContext::openGraphicsScreen | ( | void * | ParentWindow, | |
const dim::size2di & | Resolution, | |||
const io::stringc & | Title, | |||
s32 | ColorDepth, | |||
bool | isFullscreen, | |||
const SDeviceFlags & | Flags | |||
) | [pure virtual] |
Opens the graphics screen. This function will be called automatically once when the graphics device will be created.
[in] | ParentWindow | Pointer to the window object. For MS/Windows this must be a pointer to a HWND instance or null if no parent window is to be used. |
[in] | Resolution | Specifies the screen resolution for this context. |
[in] | Title | Specifies the window title. |
[in] | ColorDepth | Specifies the color bit depth. Valid values are 16, 24 and 32. |
[in] | isFullscreen | Specifies whether fullscreen is to be enabled or disabled. |
[in] | Flags | Specifies the device flags. This contains information about anti-aliasing and some other options. |
Implemented in sp::video::DesktopRenderContext, sp::video::Direct3D9RenderContext, sp::video::Direct3D11RenderContext, sp::video::OpenGLRenderContext, and sp::video::OpenGLESRenderContext.
void sp::video::RenderContext::resetConfig | ( | ) | [protected] |
void sp::video::RenderContext::setActiveRenderContext | ( | RenderContext * | Context | ) | [static] |
Sets the new render context manually. This is used internally for state changes only. The render system's state will not change.
TODO! -> don't work correctly in the Editor!!!
void sp::video::RenderContext::setFullscreen | ( | bool | Enable | ) | [virtual] |
Enables or disables fullscreen mode.
Reimplemented in sp::video::OpenGLRenderContext.
void sp::video::RenderContext::setResolution | ( | const dim::size2di & | Resolution | ) | [virtual] |
Changes the screen resolution. This requires for some render sytems to re-create all graphics resources such as textures, mesh buffers, shaders etc.
Reimplemented in sp::video::OpenGLRenderContext.
void sp::video::RenderContext::setVsync | ( | bool | isVsync | ) | [virtual] |
Enables or disabels vertical synchronisation.
Reimplemented in sp::video::Direct3D11RenderContext, and sp::video::OpenGLRenderContext.
void sp::video::RenderContext::setWindowPosition | ( | const dim::point2di & | Position | ) | [virtual] |
Sets the window position. By default the window is screen centered.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
void sp::video::RenderContext::setWindowTitle | ( | const io::stringc & | Title | ) | [virtual] |
Sets the window title.
Reimplemented in sp::video::DesktopRenderContext, and sp::video::OpenGLESRenderContext.
RenderContext * sp::video::RenderContext::ActiveRenderContext_ = 0 [static, protected] |
s32 sp::video::RenderContext::ColorDepth_ [protected] |
SDeviceFlags sp::video::RenderContext::Flags_ [protected] |
bool sp::video::RenderContext::isFullscreen_ [protected] |
void* sp::video::RenderContext::ParentWindow_ [protected] |
dim::size2di sp::video::RenderContext::Resolution_ [protected] |
std::list<SharedRenderContext*> sp::video::RenderContext::SharedContextList_ [protected] |
io::stringc sp::video::RenderContext::Title_ [protected] |