Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

sp::video::RenderContext Class Reference

Render context class which holds the graphics context objects and the window objects. More...

#include <spRenderContext.hpp>

Inheritance diagram for sp::video::RenderContext:
sp::video::DesktopRenderContext sp::video::OpenGLESRenderContext sp::video::Direct3D11RenderContext sp::video::Direct3D9RenderContext sp::video::OpenGLRenderContext

List of all members.

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 SharedRenderContextcreateSharedContext ()
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 RenderContextgetActiveRenderContext ()
 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 RenderContextActiveRenderContext_ = 0

Detailed Description

Render context class which holds the graphics context objects and the window objects.


Constructor & Destructor Documentation

sp::video::RenderContext::~RenderContext (  )  [virtual]
sp::video::RenderContext::RenderContext (  )  [protected]

Member Function Documentation

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]
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.

Parameters:
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.
Returns:
Pointer to the new SharedRenderContext object.

Reimplemented in sp::video::OpenGLRenderContext.

virtual bool sp::video::RenderContext::deactivate (  )  [pure virtual]
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.

See also:
setFullscreen
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.

Parameters:
[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.
Returns:
True if the graphics screen has been successfully created. Otherwise false.

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.


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines