PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions
PLRenderer::Renderer Class Reference

Abstract renderer main class. More...

#include <Renderer.h>

Inheritance diagram for PLRenderer::Renderer:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EMode { ModeFixedFunctions = 0, ModeShaders = 1, ModeBoth = 2 }
 Renderer mode. More...

Public Member Functions

 pl_enum (EMode) pl_enum_value(ModeFixedFunctions
The renderer can only use
fixed functions 
pl_enum_value (ModeShaders,"The renderer can only use shaders") pl_enum_value(ModeBoth
The renderer can only use
fixed functions The renderer
is allowed to use fixed
functions as well as shaders
pl_enum_end virtual pl_class(PLRENDERER_RTTI_EXPORT,
Renderer,"PLRenderer",
PLCore::Object,"Abstract
renderer main class")
pl_class_end public
RendererContext
GetRendererContext () const =0
 Returns whether or not the renderer instance was initialized successfully within it's constructor.
virtual PLCore::String GetAPI (PLCore::uint32 *pnVersion=nullptr) const =0
 Returns the renderer API (for example 'OpenGL' or 'Direct3D')
virtual PLCore::String GetVendor () const =0
 Returns the renderer vendor (for example 'ATI Technologies Inc.')
virtual EMode GetMode () const =0
 Returns the mode the renderer is running in.
virtual PLCore::String GetDefaultShaderLanguage () const =0
 Returns the name of the default shader language of the renderer.
virtual ShaderLanguageGetShaderLanguage (const PLCore::String &sShaderLanguage="")=0
 Returns a shader language instance.
virtual FixedFunctionsGetFixedFunctions () const =0
 Returns the fixed functions renderer interface.
virtual FontManagerGetFontManager () const =0
 Returns the font manager interface.
virtual DrawHelpersGetDrawHelpers () const =0
 Returns the draw helpers interface.
virtual void BackupDeviceObjects ()=0
 Backups the device objects.
virtual void RestoreDeviceObjects ()=0
 Restores the device objects.
virtual PLCore::uint32 GetNumOfDisplayModes () const =0
 Returns the number of all available display modes.
virtual const DisplayModeGetDisplayMode (PLCore::uint32 nIndex) const =0
 Returns a display mode.
virtual const CapabilitiesGetCapabilities () const =0
 Returns the renderer capabilities.
virtual bool IsValidTextureBuffer1DSize (int nSize) const =0
 Returns whether or not the given size is valid for a 1D texture buffer.
virtual bool IsValidTextureBuffer2DSize (int nSize) const =0
 Returns whether or not the given size is valid for a 2D texture buffer.
virtual bool IsValidTextureBufferRectangleSize (int nSize) const =0
 Returns whether or not the given size is valid for a rectangle texture buffer.
virtual bool IsValidTextureBuffer3DSize (int nSize) const =0
 Returns whether or not the given size is valid for a 3D texture buffer.
virtual bool IsValidTextureBufferCubeSize (int nSize) const =0
 Returns whether or not the given size is valid for a cube texture buffer.
virtual const StatisticsGetStatistics () const =0
 Returns the renderer statistics.
virtual const PLMath::Vector2GetTexelToPixelOffset () const =0
 Returns the offset required to line up texel origins with pixels origins.
virtual void Update ()=0
 Updates the renderer.
virtual void Reset ()=0
 Resets all render states, texture units etc. to default.
virtual PLCore::uint32 GetNumOfSurfaces () const =0
 Returns the number of surfaces.
virtual SurfaceGetSurface (PLCore::uint32 nIndex=0) const =0
 Returns a renderer surface.
virtual bool AddSurface (Surface &cSurface)=0
 Adds a renderer surface to the renderer.
virtual bool RemoveSurface (Surface &cSurface)=0
 Removes a renderer surface from the renderer.
virtual SurfacePainterCreateSurfacePainter (const PLCore::String &sClass)=0
 Creates a surface painter.
virtual PLCore::uint32 GetNumOfResources () const =0
 Returns the number of resources.
virtual ResourceGetResource (PLCore::uint32 nIndex=0) const =0
 Returns a renderer resource.
virtual bool AddResource (Resource &cResource)=0
 Adds a renderer resource to the renderer.
virtual bool RemoveResource (Resource &cResource)=0
 Removes a renderer resource from the renderer.
virtual SurfaceWindowCreateSurfaceWindow (SurfaceWindowHandler &cHandler, PLCore::handle nNativeWindowHandle, const DisplayMode &sDisplayMode, bool bFullscreen=false)=0
 Creates renderer surface window.
virtual SurfaceTextureBufferCreateSurfaceTextureBuffer2D (const PLMath::Vector2i &vSize, TextureBuffer::EPixelFormat nFormat, PLCore::uint32 nFlags=SurfaceTextureBuffer::Depth|SurfaceTextureBuffer::Stencil, PLCore::uint8 nMaxColorTargets=1)=0
 Creates renderer 2D texture buffer surface.
virtual SurfaceTextureBufferCreateSurfaceTextureBufferRectangle (const PLMath::Vector2i &vSize, TextureBuffer::EPixelFormat nFormat, PLCore::uint32 nFlags=SurfaceTextureBuffer::Depth|SurfaceTextureBuffer::Stencil, PLCore::uint8 nMaxColorTargets=1)=0
 Creates renderer rectangle texture buffer surface.
virtual SurfaceTextureBufferCreateSurfaceTextureBufferCube (PLCore::uint16 nSize, TextureBuffer::EPixelFormat nFormat, PLCore::uint32 nFlags=SurfaceTextureBuffer::Depth|SurfaceTextureBuffer::Stencil)=0
 Creates renderer cube texture buffer surface.
virtual TextureBuffer1DCreateTextureBuffer1D (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Mipmaps|TextureBuffer::Compression)=0
 Creates a 1D texture buffer.
virtual TextureBuffer2DCreateTextureBuffer2D (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Mipmaps|TextureBuffer::Compression)=0
 Creates a 2D texture buffer.
virtual TextureBuffer2DArrayCreateTextureBuffer2DArray (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Mipmaps|TextureBuffer::Compression)=0
 Creates a 2D array texture buffer.
virtual TextureBufferCreateTextureBufferRectangle (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Compression)=0
 Creates a rectangle texture buffer.
virtual TextureBuffer3DCreateTextureBuffer3D (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Mipmaps|TextureBuffer::Compression)=0
 Creates a 3D texture buffer.
virtual TextureBufferCubeCreateTextureBufferCube (PLGraphics::Image &cImage, TextureBuffer::EPixelFormat nInternalFormat=TextureBuffer::Unknown, PLCore::uint32 nFlags=TextureBuffer::Mipmaps|TextureBuffer::Compression)=0
 Creates a cube texture buffer.
virtual IndexBufferCreateIndexBuffer ()=0
 Creates an index buffer.
virtual VertexBufferCreateVertexBuffer ()=0
 Creates a vertex buffer.
virtual OcclusionQueryCreateOcclusionQuery ()=0
 Creates an occlusion query.
virtual PLCore::uint32 GetDefaultRenderState (RenderState::Enum nState) const =0
 Returns a default render state.
virtual void ResetRenderStates ()=0
 Resets all render states to default.
virtual int GetRenderState (RenderState::Enum nState) const =0
 Retrieves a render-state value.
virtual bool SetRenderState (RenderState::Enum nState, PLCore::uint32 nValue)=0
 Sets a single render-state parameter.
virtual PLCore::uint32 GetDefaultSamplerState (Sampler::Enum nState) const =0
 Returns a default sampler state.
virtual void ResetSamplerStates ()=0
 Resets all sampler states to default.
virtual int GetSamplerState (PLCore::uint32 nStage, Sampler::Enum nState) const =0
 Retrieves a sampler-state value.
virtual bool SetSamplerState (PLCore::uint32 nStage, Sampler::Enum nState, PLCore::uint32 nValue)=0
 Sets a single sampler-state parameter.
virtual PLCore::uint32 GetSwapInterval () const =0
 Returns the swap interval (vertical synchronization)
virtual void SetSwapInterval (PLCore::uint32 nSwapInterval=1)=0
 Sets the swap interval (vertical synchronization)
virtual bool BeginScene ()=0
 Begins a scene.
virtual bool EndScene ()=0
 Ends a scene that was begun by calling the BeginScene method.
virtual const PLMath::RectangleGetViewport (float *pfMinZ=nullptr, float *pfMaxZ=nullptr) const =0
 Gets the window dimensions of a render target surface onto which a 3-D volume projects.
virtual bool SetViewport (const PLMath::Rectangle *pRectangle=nullptr, float fMinZ=0.0f, float fMaxZ=1.0f)=0
 Defines the window dimensions of a render target surface onto which a 3-D volume projects.
virtual const PLMath::RectangleGetScissorRect () const =0
 Gets the scissor rectangle.
virtual bool SetScissorRect (const PLMath::Rectangle *pRectangle=nullptr)=0
 Sets the scissor rectangle.
virtual bool GetDepthBounds (float &fZMin, float &fZMax) const =0
 Gets the depth bounds.
virtual bool SetDepthBounds (float fZMin=0.0f, float fZMax=1.0f)=0
 Sets the depth bounds.
virtual void GetColorMask (bool &bRed, bool &bGreen, bool &bBlue, bool &bAlpha) const =0
 Returns the color mask.
virtual bool SetColorMask (bool bRed=true, bool bGreen=true, bool bBlue=true, bool bAlpha=true)=0
 Sets the color mask.
virtual bool Clear (PLCore::uint32 nFlags=Clear::Color|Clear::ZBuffer, const PLGraphics::Color4 &cColor=PLGraphics::Color4::Black, float fZ=1.0f, PLCore::uint32 nStencil=0)=0
 Clears the viewport to a specified RGBA color, clears the depth buffer, and erases the stencil buffer.
virtual SurfaceGetRenderTarget (PLCore::uint8 *pnFace=nullptr) const =0
 Returns the current render target.
virtual TextureBufferGetColorRenderTarget (PLCore::uint8 nColorIndex=0) const =0
 Returns the current color render target.
virtual bool SetRenderTarget (Surface *pSurface, PLCore::uint8 nFace=0)=0
 Sets the current render target.
virtual bool SetColorRenderTarget (TextureBuffer *pTextureBuffer, PLCore::uint8 nColorIndex=0, PLCore::uint8 nFace=0)=0
 Sets the current color render target (for multi render targets)
virtual bool SetDepthRenderTarget (TextureBuffer *pTextureBuffer, PLCore::uint8 nFace=0)=0
 Sets the current depth render target.
virtual bool MakeScreenshot (PLGraphics::Image &cImage)=0
 Makes a screenshot of the current render target (see GetRenderTarget())
virtual TextureBufferGetTextureBuffer (PLCore::uint32 nStage) const =0
 Gets the current texture buffer at the given stage.
virtual bool SetTextureBuffer (int nStage=-1, TextureBuffer *pTextureBuffer=nullptr)=0
 Sets the current texture buffer at the given stage.
virtual IndexBufferGetIndexBuffer () const =0
 Gets the current index buffer.
virtual bool SetIndexBuffer (IndexBuffer *pIndexBuffer=nullptr)=0
 Sets the current index buffer.
virtual ProgramGetProgram () const =0
 Returns the currently used program.
virtual bool SetProgram (Program *pProgram=nullptr)=0
 Sets the currently used program.
virtual bool DrawPrimitives (Primitive::Enum nType, PLCore::uint32 nStartIndex, PLCore::uint32 nNumVertices)=0
 Renders the specified geometric primitive, based on an array of vertices.
virtual bool DrawIndexedPrimitives (Primitive::Enum nType, PLCore::uint32 nMinIndex, PLCore::uint32 nMaxIndex, PLCore::uint32 nStartIndex, PLCore::uint32 nNumVertices)=0
 Renders the specified geometric primitive, based on indexing into an array of vertices.

Protected Member Functions

PLRENDERER_API Renderer ()
 Constructor.
virtual PLRENDERER_API ~Renderer ()
 Destructor.

Detailed Description

Abstract renderer main class.


Member Enumeration Documentation

Renderer mode.

Enumerator:
ModeFixedFunctions 

The renderer can only use fixed functions

ModeShaders 

The renderer can only use shaders

ModeBoth 

The renderer is allowed to use fixed functions as well as shaders


Constructor & Destructor Documentation

PLRENDERER_API PLRenderer::Renderer::Renderer ( ) [protected]

Constructor.

virtual PLRENDERER_API PLRenderer::Renderer::~Renderer ( ) [protected, virtual]

Destructor.


Member Function Documentation

The renderer can only use fixed functions PLRenderer::Renderer::pl_enum_value ( ModeShaders  ,
"The renderer can only use shaders"   
)
The renderer can only use fixed functions The renderer is allowed to use fixed functions as well as shaders pl_enum_end virtual pl_class (PLRENDERER_RTTI_EXPORT, Renderer, "PLRenderer", PLCore::Object, "Abstract renderer main class") pl_class_end public RendererContext& PLRenderer::Renderer::GetRendererContext ( ) const [pure virtual]

Returns whether or not the renderer instance was initialized successfully within it's constructor.

Returns:
'true' if the renderer instance was initialized successfully within it's constructor, else 'false'

Returns the owner renderer context

Returns:
Reference to the owner renderer context
virtual PLCore::String PLRenderer::Renderer::GetAPI ( PLCore::uint32 *  pnVersion = nullptr) const [pure virtual]

Returns the renderer API (for example 'OpenGL' or 'Direct3D')

Parameters:
[out]pnVersionVersion information, can be a null pointer
Returns:
Renderer API
Remarks:
The content of 'nVersion' depends on the used API. For 'OpenGL', 'nVersion' can for example be '21' for 'OpenGL 2.1'. For 'Direct3D', 'nVersion' can for example be '900' for 'Direct3D 9'.
virtual PLCore::String PLRenderer::Renderer::GetVendor ( ) const [pure virtual]

Returns the renderer vendor (for example 'ATI Technologies Inc.')

Returns:
Renderer vendor
virtual EMode PLRenderer::Renderer::GetMode ( ) const [pure virtual]

Returns the mode the renderer is running in.

Returns:
The mode the renderer is running in

Returns the name of the default shader language of the renderer.

Returns:
The name of the default shader language of the renderer (for example "GLSL" or "Cg"), the string can be empty, too
virtual ShaderLanguage* PLRenderer::Renderer::GetShaderLanguage ( const PLCore::String sShaderLanguage = "") [pure virtual]

Returns a shader language instance.

Parameters:
[in]sShaderLanguageThe name of the shader language (for example "GLSL" or "Cg"), if empty string, the default renderer shader language is used (see GetDefaultShaderLanguage())
Returns:
The shader language instance (do NOT delete it!), a null pointer on error
virtual FixedFunctions* PLRenderer::Renderer::GetFixedFunctions ( ) const [pure virtual]

Returns the fixed functions renderer interface.

Returns:
The fixed functions renderer interface, can be a null pointer
Note:
  • A legacy renderer interface for previously build in features in old graphics APIs and GPUs
  • A renderer backend is not enforced to implement this interface, so, you have to take it into account that this function just returns a null pointer
  • Do NOT delete the instance of the interface!
virtual FontManager& PLRenderer::Renderer::GetFontManager ( ) const [pure virtual]

Returns the font manager interface.

Returns:
The font manager interface
virtual DrawHelpers& PLRenderer::Renderer::GetDrawHelpers ( ) const [pure virtual]

Returns the draw helpers interface.

Returns:
The draw helpers interface
virtual void PLRenderer::Renderer::BackupDeviceObjects ( ) [pure virtual]

Backups the device objects.

Note:
  • Used for instance if the display mode is changed to backup/restore all device objects (like texture buffers, renderer buffers etc.)
  • Normally only used inside the renderer backend!
virtual void PLRenderer::Renderer::RestoreDeviceObjects ( ) [pure virtual]

Restores the device objects.

See also:
virtual PLCore::uint32 PLRenderer::Renderer::GetNumOfDisplayModes ( ) const [pure virtual]

Returns the number of all available display modes.

Returns:
Number of all available display modes
Remarks:
Be careful when using one of the 'all available display modes' directly... because it can happen that even if a display mode received by the system is listed, it may not work properly within fullscreen mode and you get for example just a black window.
virtual const DisplayMode* PLRenderer::Renderer::GetDisplayMode ( PLCore::uint32  nIndex) const [pure virtual]

Returns a display mode.

Parameters:
[in]nIndexIndex of the display mode to return (0..'GetNumOfDisplayModes()')
Returns:
The requested display mode, (do NOT delete the display mode!) a null pointer on error
See also:
virtual const Capabilities& PLRenderer::Renderer::GetCapabilities ( ) const [pure virtual]

Returns the renderer capabilities.

Returns:
The renderer capabilities
virtual bool PLRenderer::Renderer::IsValidTextureBuffer1DSize ( int  nSize) const [pure virtual]

Returns whether or not the given size is valid for a 1D texture buffer.

Parameters:
[in]nSizeSize to check
Returns:
'true' if the given size is valid, else 'false'
Note:
  • A size is valid if nSize<=GetCapabilities().nMaxTextureBufferSize and nSize>0 and the size is a power of two (or GetCapabilities().bTextureBufferNonPowerOfTwo is "true")
virtual bool PLRenderer::Renderer::IsValidTextureBuffer2DSize ( int  nSize) const [pure virtual]

Returns whether or not the given size is valid for a 2D texture buffer.

Parameters:
[in]nSizeSize to check
Returns:
'true' if the given size is valid, else 'false'
Note:
  • A size is valid if nSize<=GetCapabilities().nMaxTextureBufferSize and nSize>0 and the size is a power of two (or GetCapabilities().bTextureBufferNonPowerOfTwo is "true")
virtual bool PLRenderer::Renderer::IsValidTextureBufferRectangleSize ( int  nSize) const [pure virtual]

Returns whether or not the given size is valid for a rectangle texture buffer.

Parameters:
[in]nSizeSize to check
Returns:
'true' if the given size is valid, else 'false'
Note:
  • A size is valid if nSize<=GetCapabilities().nMaxRectangleTextureBufferSize and nSize>0
virtual bool PLRenderer::Renderer::IsValidTextureBuffer3DSize ( int  nSize) const [pure virtual]

Returns whether or not the given size is valid for a 3D texture buffer.

Parameters:
[in]nSizeSize to check
Returns:
'true' if the given size is valid, else 'false'
Note:
  • A size is valid if nSize<=GetCapabilities().nMax3DTextureBufferSize and nSize>0 and the size is a power of two (or GetCapabilities().bTextureBufferNonPowerOfTwo is "true")
virtual bool PLRenderer::Renderer::IsValidTextureBufferCubeSize ( int  nSize) const [pure virtual]

Returns whether or not the given size is valid for a cube texture buffer.

Parameters:
[in]nSizeSize to check
Returns:
'true' if the given size is valid, else 'false'
Note:
  • A size is valid if nSize<=GetCapabilities().nMaxCubeTextureBufferSize and nSize>0 and the size is a power of two (or GetCapabilities().bTextureBufferNonPowerOfTwo is "true")
virtual const Statistics& PLRenderer::Renderer::GetStatistics ( ) const [pure virtual]

Returns the renderer statistics.

Returns:
The renderer statistics
virtual const PLMath::Vector2& PLRenderer::Renderer::GetTexelToPixelOffset ( ) const [pure virtual]

Returns the offset required to line up texel origins with pixels origins.

Returns:
The pixel origin to texel origin offset, usually (0.0, 0.0) or (-0.5, -0.5)
Note:
virtual void PLRenderer::Renderer::Update ( ) [pure virtual]

Updates the renderer.

Note:
  • All renderer surfaces of this renderer will be updated
virtual void PLRenderer::Renderer::Reset ( ) [pure virtual]

Resets all render states, texture units etc. to default.

Note:
virtual PLCore::uint32 PLRenderer::Renderer::GetNumOfSurfaces ( ) const [pure virtual]

Returns the number of surfaces.

Returns:
Number of surfaces
virtual Surface* PLRenderer::Renderer::GetSurface ( PLCore::uint32  nIndex = 0) const [pure virtual]

Returns a renderer surface.

Parameters:
[in]nIndexIndex of the surface to return
Returns:
The surface at the given index, a null pointer on error
virtual bool PLRenderer::Renderer::AddSurface ( Surface cSurface) [pure virtual]

Adds a renderer surface to the renderer.

Parameters:
[in]cSurfaceRenderer surface to add
Returns:
'true' if all went fine and the renderer surface was added to the renderer, else 'false'
Note:
  • The renderer surface itself is only added to the renderers list of surfaces!
virtual bool PLRenderer::Renderer::RemoveSurface ( Surface cSurface) [pure virtual]

Removes a renderer surface from the renderer.

Parameters:
[in]cSurfaceRenderer surface to remove
Returns:
'true' if all went fine and the renderer surface was removed from the renderer, else 'false' (maybe the surface isn't in the renderer)
Note:
  • The renderer surface itself isn't destroyed, it is just removed from the renderers list of surfaces!
virtual SurfacePainter* PLRenderer::Renderer::CreateSurfacePainter ( const PLCore::String sClass) [pure virtual]

Creates a surface painter.

Parameters:
[in]sClassClass name of the surface painter to create
Returns:
The created surface painter, a null pointer on error (YOU have to destroy the object!)
virtual PLCore::uint32 PLRenderer::Renderer::GetNumOfResources ( ) const [pure virtual]

Returns the number of resources.

Returns:
Number of resources
virtual Resource* PLRenderer::Renderer::GetResource ( PLCore::uint32  nIndex = 0) const [pure virtual]

Returns a renderer resource.

Parameters:
[in]nIndexIndex of the renderer resource to return
Returns:
The resource at the given index, a null pointer on error
virtual bool PLRenderer::Renderer::AddResource ( Resource cResource) [pure virtual]

Adds a renderer resource to the renderer.

Parameters:
[in]cResourceRenderer resource to add
Returns:
'true' if all went fine and the renderer resource was added to the renderer, else 'false'
Note:
  • The renderer resource itself is only added to the renderers list of resources!
virtual bool PLRenderer::Renderer::RemoveResource ( Resource cResource) [pure virtual]

Removes a renderer resource from the renderer.

Parameters:
[in]cResourceRenderer resource to remove
Returns:
'true' if all went fine and the renderer resource was removed from the renderer, else 'false' (maybe the resource isn't in the renderer)
Note:
  • The renderer resource itself isn't destroyed, it is just removed from the renderers list of resources!
virtual SurfaceWindow* PLRenderer::Renderer::CreateSurfaceWindow ( SurfaceWindowHandler cHandler,
PLCore::handle  nNativeWindowHandle,
const DisplayMode sDisplayMode,
bool  bFullscreen = false 
) [pure virtual]

Creates renderer surface window.

Parameters:
[in]cHandlerRenderer surface handler the new renderer surface is assigned with
[in]nNativeWindowHandleHandle to the native window the renderer surface is assigned with
[in]sDisplayModeDisplay mode information
[in]bFullscreenFullscreen mode?
Returns:
The created renderer surface, a null pointer on error
Note:
  • The new created renderer surface is added to this renderer automatically
  • The renderer surface handler is required because this kind of surface is assigned with a window and if the surface or window is lost they have to be informed
virtual SurfaceTextureBuffer* PLRenderer::Renderer::CreateSurfaceTextureBuffer2D ( const PLMath::Vector2i vSize,
TextureBuffer::EPixelFormat  nFormat,
PLCore::uint32  nFlags = SurfaceTextureBuffer::Depth|SurfaceTextureBuffer::Stencil,
PLCore::uint8  nMaxColorTargets = 1 
) [pure virtual]

Creates renderer 2D texture buffer surface.

Parameters:
[in]vSizeSize of renderer texture buffer surface
[in]nFormatTexture buffer pixel format
[in]nFlagsTexture buffer surface flags (see SurfaceTextureBuffer::EFlags)
[in]nMaxColorTargetsMaximum number of color render targets. This must be at least 1 - main renderer target color. Have a look at SetColorRenderTarget()
Returns:
The created renderer surface, a null pointer on error
Note:
  • The new created renderer surface is added to this renderer automatically
virtual SurfaceTextureBuffer* PLRenderer::Renderer::CreateSurfaceTextureBufferRectangle ( const PLMath::Vector2i vSize,
TextureBuffer::EPixelFormat  nFormat,
PLCore::uint32  nFlags = SurfaceTextureBuffer::Depth|SurfaceTextureBuffer::Stencil,
PLCore::uint8  nMaxColorTargets = 1 
) [pure virtual]

Creates renderer rectangle texture buffer surface.

Parameters:
[in]vSizeSize of renderer texture buffer surface
[in]nFormatTexture buffer pixel format
[in]nFlagsTexture buffer surface flags (see SurfaceTextureBuffer::EFlags)
[in]nMaxColorTargetsMaximum number of color render targets. This must be at least 1 - main renderer target color. Have a look at SetColorRenderTarget()
Returns:
The created renderer surface, a null pointer on error
Note:
  • The new created renderer surface is added to this renderer automatically
  • Additional color target texture buffers must be created with TextureBuffer::RenderTarget in order to work as render targets

Creates renderer cube texture buffer surface.

Parameters:
[in]nSizeSize of renderer texture buffer surface
[in]nFormatTexture buffer pixel format
[in]nFlagsTexture buffer surface flags (see SurfaceTextureBuffer::EFlags)
Returns:
The created renderer surface, a null pointer on error
Note:
  • The new created renderer surface is added to this renderer automatically

Creates a 1D texture buffer.

Parameters:
[in]cImageTexture buffer image
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags, TextureBuffer::RenderTarget has no effect (see TextureBuffer::EFlags)
Returns:
The created 1D renderer texture buffer, a null pointer on error (maybe the image size is no power of two?)
Note:
  • If the usage of 'nInternalFormat' failed - for instance texture buffer compression is not supported for this texture buffer type, the renderer will try to find a valid format by your self. Use the function TextureBuffer::GetFormat() to get the 'resulting' used format.
  • If the given image is pre compressed, but the compressed format is NOT supported by the renderer the uncompressed image is used instead.
  • If an desired internal format is given, the 'Compression' flag (see TextureBuffer::EFlags) is ignored.
  • If the 'Mipmaps' flag (see TextureBuffer::EFlags) is set and the given image doesn't provide any mipmaps, the mipmaps are created automatically. If the image comes with any mipmaps, this mipmaps MUST define all mipmap levels down to 1x1 otherwise the texture buffer is invalid when you try to use any min filter that uses mipmaps. (the OpenGL renderer normally uses white color when invalid/incomplete texture buffer is enabled)

Creates a 2D texture buffer.

Parameters:
[in]cImageTexture buffer image
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags (see TextureBuffer::EFlags)
Returns:
The created 2D renderer texture buffer, a null pointer on error (maybe the image size is no power of two?)
See also:

Creates a 2D array texture buffer.

Parameters:
[in]cImageTexture buffer image
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags (see TextureBuffer::EFlags)
Returns:
The created 2D array renderer texture buffer, a null pointer on error (maybe the image size is no power of two?)
See also:

Creates a rectangle texture buffer.

Parameters:
[in]cImageTexture buffer image
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags, TextureBuffer::Mipmaps has no effect (see TextureBuffer::EFlags)
Returns:
The created rectangle renderer texture buffer, a null pointer on error
Remarks:
Please note that it's up to the implementation to decide whether there's a special TextureBufferRectangle implementation which can deal with non-power-of-two texture data, or if TextureBuffer2D etc. can deal with non-power-of-two texture as well. (Capabilities::bTextureBufferNonPowerOfTwo = true) For instance, OpenGL ES 2.0 has no special "rectangle"/"non-power-of-two" textures. GL_TEXTURE_2D can also be used with non-power-of-two texture data, but non-power-of-two textures have restrictions on the allowed texture wrap modes and filters (the texture wrap mode must be GL_CLAMP_TO_EDGE and the minification filter must be GL_NEAREST or GL_LINEAR). As a result, usually when using GLSL, rectangle textures are accessed by using sampler2DRect/texture2DRect instead of sampler2D/texture2D, and the texture coordinates are not normalized. But OpenGL ES 2.0 makes no difference between this two texture types - as a result, a lot of special case handling would be required. To avoid this, we decided that if the implementation doesn't make a difference, "CreateTextureBufferRectangle()" should be able to return TextureBuffer2D or TextureBufferRectangle - this way, no special case handling is required, just use the textures.
Note:
See also:

Creates a 3D texture buffer.

Parameters:
[in]cImageTexture buffer image
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags, TextureBuffer::RenderTarget has no effect (see TextureBuffer::EFlags)
Returns:
The created 3D renderer texture buffer, a null pointer on error (maybe the image size is no power of two?)
Note:
See also:

Creates a cube texture buffer.

Parameters:
[in]cImageCube map image (image with 6 image parts)
[in]nInternalFormatDesired internal texture buffer pixel format, if TextureBuffer::Unknown use the format of the given image
[in]nFlagsTexture buffer flags (see TextureBuffer::EFlags)
Returns:
The created cube renderer texture buffer, a null pointer on error (maybe the image size is no power of two?)
Note:
See also:

Creates an index buffer.

Returns:
The created index buffer, a null pointer on error
Remarks:
To use index buffers, create an index buffer, lock it, fill it with indices, unlock it, pass it to SetIndexBuffer(), set up the vertices, set up the vertex shader program, and call DrawIndexedPrimitive() for rendering.

Creates a vertex buffer.

Returns:
The created vertex buffer, a null pointer on error
Remarks:
To use vertex buffers, create an vertex buffer, setup the vertex elements, allocate the vertex buffer, lock it, fill it with data, unlock it. For shader based rendering, use the ProgramAttribute interface to assign an vertex buffer attribute to an vertex shader attribute. For fixed functions rendering, pass the vertex buffer it to FixedFunctions::SetVertexBuffer().

Creates an occlusion query.

Returns:
The created occlusion query, a null pointer on error
Note:
  • If occlusion query is not supported by the hardware, an occlusion query object is returned, too. But the test will always succeed. (see Capabilities::bOcclusionQuery)
virtual PLCore::uint32 PLRenderer::Renderer::GetDefaultRenderState ( RenderState::Enum  nState) const [pure virtual]

Returns a default render state.

Parameters:
[in]nStateRender state to return the default value from
Returns:
The default state
virtual void PLRenderer::Renderer::ResetRenderStates ( ) [pure virtual]

Resets all render states to default.

See also:
virtual int PLRenderer::Renderer::GetRenderState ( RenderState::Enum  nState) const [pure virtual]

Retrieves a render-state value.

Parameters:
[in]nStateState variable that is being queried. This parameter can be any member of the render state enumerated type.
Returns:
The value of the queried render state variable, < 0 on error
See also:
virtual bool PLRenderer::Renderer::SetRenderState ( RenderState::Enum  nState,
PLCore::uint32  nValue 
) [pure virtual]

Sets a single render-state parameter.

Parameters:
[in]nStateState variable that is being modified. This parameter can be any member of the render state enumerated type.
[in]nValueNew value for the render state to be set. The meaning of this parameter is dependent on the value specified for nState. For example, if nState is Shade, the second parameter must be one member of the Shade enumerated type. (e.g. Shade::Flat)
Returns:
'true' if all went fine, else 'false'
See also:
virtual PLCore::uint32 PLRenderer::Renderer::GetDefaultSamplerState ( Sampler::Enum  nState) const [pure virtual]

Returns a default sampler state.

Parameters:
[in]nStateSampler state to return the default value from
Returns:
The default state
virtual void PLRenderer::Renderer::ResetSamplerStates ( ) [pure virtual]

Resets all sampler states to default.

See also:
virtual int PLRenderer::Renderer::GetSamplerState ( PLCore::uint32  nStage,
Sampler::Enum  nState 
) const [pure virtual]

Retrieves a sampler-state value.

Parameters:
[in]nStageTexture stage to get the value from
[in]nStateState variable that is being queried. This parameter can be any member of the sampler enumerated type.
Returns:
The value of the queried sampler state variable, < 0 on error
See also:
virtual bool PLRenderer::Renderer::SetSamplerState ( PLCore::uint32  nStage,
Sampler::Enum  nState,
PLCore::uint32  nValue 
) [pure virtual]

Sets a single sampler-state parameter.

Parameters:
[in]nStageTexture stage to set the value
[in]nStateState variable that is being modified. This parameter can be any member of the sampler enumerated type.
[in]nValueNew value for the sampler state to be set. The meaning of this parameter is dependent on the value specified for nState. For example, if nState is Sampler::AddressU, the second parameter must be one member of the Sampler::AddressU enumerated type. (e.g. TextureAddressing::Wrap)
Returns:
'true' if all went fine, else 'false'
Note:
  • If the state to set is 'Sampler::MipFilter' and the texture buffer at the given texture state has no mipmaps, the value is internally set to 'TextureFiltering::None' automatically for proper rendering of the texture buffer.
See also:
virtual PLCore::uint32 PLRenderer::Renderer::GetSwapInterval ( ) const [pure virtual]

Returns the swap interval (vertical synchronization)

Returns:
The swap interval
Note:
  • Please note that the swap interval is only a hint and can be overwritten by the driver settings!
virtual void PLRenderer::Renderer::SetSwapInterval ( PLCore::uint32  nSwapInterval = 1) [pure virtual]

Sets the swap interval (vertical synchronization)

Parameters:
[in]nSwapIntervalThe swap interval, default value is 1
See also:
virtual bool PLRenderer::Renderer::BeginScene ( ) [pure virtual]

Begins a scene.

Returns:
'true' if all went fine, else 'false' (e.g. if BeginScene is called while already in a BeginScene/EndScene pair. This happens only when BeginScene is called twice without first calling EndScene.
See also:
virtual bool PLRenderer::Renderer::EndScene ( ) [pure virtual]

Ends a scene that was begun by calling the BeginScene method.

Returns:
'true' if all went fine, else 'false'
Note:
  • When this method succeeds, the scene has been queued up for rendering by the driver. This is not a synchronous method, so the scene is not guaranteed to have completed rendering when this method returns.
  • When scene rendering begins successfully, you must call this method before you can call the BeginScene method to start rendering another scene. If a prior call to BeginScene method fails, the scene did not begin and this method should not be called.
virtual const PLMath::Rectangle& PLRenderer::Renderer::GetViewport ( float *  pfMinZ = nullptr,
float *  pfMaxZ = nullptr 
) const [pure virtual]

Gets the window dimensions of a render target surface onto which a 3-D volume projects.

Parameters:
[out]pfMinZIf not a null pointer, receives minimum z value describing the range of depth values into which a scene is to be rendered
[out]pfMaxZIf not a null pointer, receives maximum z value describing the range of depth values into which a scene is to be rendered
Returns:
The current viewport rectangle
Note:
  • Rectangle.vMin is the pixel coordinate of the upper-left corner of the viewport on the render target surface. Unless you want to render to a subset of the surface, this member can be set to 0.
  • Rectangle.vMax define the other corner of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this member should be set to the dimension of the render target surface. If < 0 the dimension of the current renderer surface is set.
  • Usually, applications render to the entire target surface; when rendering on a 640×480 surface, these cRectangle members from above should be 0, 0, 640, and 480, respectively.
  • pfMinZ and pfMaxZ indicate the depth-ranges into which the scene will be rendered and are not used for clipping. Most applications set these members to 0.0 and 1.0 to enable the system to render to the entire range of depth values in the depth buffer. In some cases, you can achieve special effects by using other depth ranges. For instance, to render a heads-up display in a game, you can set both values to 0.0 to force the system to render objects in a scene in the foreground, or you might set them both to 1.0 to render an object that should always be in the background.
virtual bool PLRenderer::Renderer::SetViewport ( const PLMath::Rectangle pRectangle = nullptr,
float  fMinZ = 0.0f,
float  fMaxZ = 1.0f 
) [pure virtual]

Defines the window dimensions of a render target surface onto which a 3-D volume projects.

Parameters:
[in]pRectangleViewport rectangle, if a null pointer, use the whole render target surface
[in]fMinZMinimum z value
[in]fMaxZMaximum z value
Returns:
'true' if all went fine, else 'false'
See also:
virtual const PLMath::Rectangle& PLRenderer::Renderer::GetScissorRect ( ) const [pure virtual]

Gets the scissor rectangle.

Returns:
The current scissor rectangle
Note:
  • cRectangle.vMin is the pixel coordinate of the upper-left corner of the scissor rectangle on the render target surface. Unless you want to render to a subset of the surface, this member can be set to 0.
  • cRectangle.vMax define the other corner of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this member should be set to the dimension of the render target surface. If < 0 the dimension of the current renderer viewport is set.
  • The scissor rectangle is used as a rectangular clipping region
  • The default scissor rectangle is the full viewport
  • The scissor test is enabled and disabled using SetRenderState() with argument
virtual bool PLRenderer::Renderer::SetScissorRect ( const PLMath::Rectangle pRectangle = nullptr) [pure virtual]

Sets the scissor rectangle.

Parameters:
[in]pRectangleViewport rectangle, if a null pointer, use the whole set viewport
Returns:
'true' if all went fine, else 'false'
See also:
virtual bool PLRenderer::Renderer::GetDepthBounds ( float &  fZMin,
float &  fZMax 
) const [pure virtual]

Gets the depth bounds.

Parameters:
[out]fZMinWill receive the Z minimum value
[out]fZMaxWill receive the Z maximum value
Returns:
'true' if all went fine, else 'false' (maybe not supported by the hardware)
Note:
  • The depth bounds test is a kind of scissor rect technique to reject untouched fragments
  • Has only an effect if Capabilities::bDepthBoundsTest is true
  • If fZMin is 0.0 and fZMax is 1.0 no depth bounds test will be performed (default)
virtual bool PLRenderer::Renderer::SetDepthBounds ( float  fZMin = 0.0f,
float  fZMax = 1.0f 
) [pure virtual]

Sets the depth bounds.

Parameters:
[in]fZMinZ minimum value (range: 0.0-1.0, must be less than or equal to fZMax)
[in]fZMaxZ maximum value (range: 0.0-1.0, must be greater than or equal to fZMin)
Returns:
'true' if all went fine, else 'false' (maybe not supported by the hardware)
See also:
virtual void PLRenderer::Renderer::GetColorMask ( bool &  bRed,
bool &  bGreen,
bool &  bBlue,
bool &  bAlpha 
) const [pure virtual]

Returns the color mask.

Parameters:
[out]bRedWill receive whether the red component is written
[out]bGreenWill receive whether the green component is written
[out]bBlueWill receive whether the blue component is written
[out]bAlphaWill receive whether the alpha component is written
Note:
  • With the color mask you can decide which color components are drawn, if you e.g. only want to fill the depth buffer you can set all components to false
  • If no color components are written, some GPU's are optimized to use for instance the z buffer much more performant
  • By default all color components are written
virtual bool PLRenderer::Renderer::SetColorMask ( bool  bRed = true,
bool  bGreen = true,
bool  bBlue = true,
bool  bAlpha = true 
) [pure virtual]

Sets the color mask.

Parameters:
[in]bRedWrite red component?
[in]bGreenWrite green component?
[in]bBlueWrite blue component?
[in]bAlphaWrite alpha component?
Returns:
'true' if all went fine, else 'false'
See also:
virtual bool PLRenderer::Renderer::Clear ( PLCore::uint32  nFlags = Clear::Color|Clear::ZBuffer,
const PLGraphics::Color4 cColor = PLGraphics::Color4::Black,
float  fZ = 1.0f,
PLCore::uint32  nStencil = 0 
) [pure virtual]

Clears the viewport to a specified RGBA color, clears the depth buffer, and erases the stencil buffer.

Parameters:
[in]nFlagsFlags that indicate what should be cleared. This parameter can be any combination of the following flags, but at least one flag must be used: Clear::Color, Clear::ZBuffer and Clear::Stencil, see Clear flags
[in]cColorRGBA clear color (used if Clear::Color is set)
[in]fZZ clear value. (if Clear::ZBuffer is set) This parameter can be in the range from 0.0 through 1.0. A value of 0.0 represents the nearest distance to the viewer, and 1.0 the farthest distance.
[in]nStencilValue to clear the stencil-buffer with. This parameter can be in the range from 0 through 2^n–1, where n is the bit depth of the stencil buffer.
Returns:
'true' if all went fine, else 'false'
Note:
  • If scissor is disabled or set to the full viewport size some GPU's may be able to clear more efficient
  • The color mask has no effect on the clear operation
virtual Surface* PLRenderer::Renderer::GetRenderTarget ( PLCore::uint8 *  pnFace = nullptr) const [pure virtual]

Returns the current render target.

Parameters:
[out]pnFaceIf not a null pointer, this will receive the current cube map face
Returns:
Current renderer target, a null pointer if there's no one
virtual TextureBuffer* PLRenderer::Renderer::GetColorRenderTarget ( PLCore::uint8  nColorIndex = 0) const [pure virtual]

Returns the current color render target.

Parameters:
[in]nColorIndexColor index of the color render target to return
Returns:
Current color renderer target, a null pointer if there's no one
virtual bool PLRenderer::Renderer::SetRenderTarget ( Surface pSurface,
PLCore::uint8  nFace = 0 
) [pure virtual]

Sets the current render target.

Parameters:
[in]pSurfaceCurrent renderer target, can be a null pointer
[in]nFaceCube map face to render in (0-5) - only used if 'pSurface' is a cube texture buffer render target
Returns:
'true' if all went fine, else 'false'
Note:
virtual bool PLRenderer::Renderer::SetColorRenderTarget ( TextureBuffer pTextureBuffer,
PLCore::uint8  nColorIndex = 0,
PLCore::uint8  nFace = 0 
) [pure virtual]

Sets the current color render target (for multi render targets)

Parameters:
[in]pTextureBufferCurrent color renderer target, can be a null pointer
[in]nColorIndexColor index of this render target, if 0 this will set the main color render target of the current set render target. (see SetRenderTarget())
[in]nFaceCube map face to render in ([TODO])
Returns:
'true' if all went fine, else 'false' (maybe invalid color index of the current render target?)
Note:
  • This color render targets MUST have the dimension and format of the render target
virtual bool PLRenderer::Renderer::SetDepthRenderTarget ( TextureBuffer pTextureBuffer,
PLCore::uint8  nFace = 0 
) [pure virtual]

Sets the current depth render target.

Parameters:
[in]pTextureBufferCurrent depth renderer target, can be a null pointer
[in]nFaceCube map face to render in ([TODO])
Returns:
'true' if all went fine, else 'false'
Note:
  • This depth render targets MUST have the dimension and format of the render target
virtual bool PLRenderer::Renderer::MakeScreenshot ( PLGraphics::Image cImage) [pure virtual]

Makes a screenshot of the current render target (see GetRenderTarget())

Parameters:
[out]cImageImage which will receive the screenshot data (usually RGBA unsigned byte)
Returns:
'true' if all went fine, else 'false'
virtual TextureBuffer* PLRenderer::Renderer::GetTextureBuffer ( PLCore::uint32  nStage) const [pure virtual]

Gets the current texture buffer at the given stage.

Parameters:
[in]nStageTexture stage
Returns:
The current texture buffer at the given stage, a null pointer if there's no one
virtual bool PLRenderer::Renderer::SetTextureBuffer ( int  nStage = -1,
TextureBuffer pTextureBuffer = nullptr 
) [pure virtual]

Sets the current texture buffer at the given stage.

Parameters:
[in]nStageTexture stage. (0 - max texture stages -> see Capabilities::nMaxTextureUnits) < 0 = set all available texture stages to this setting.
[in]pTextureBufferThe texture buffer which should be set, a null pointer if no texture buffer should be set
Returns:
'true' if all went fine, else 'false' (maybe this is already the current texture buffer at the given stage)
See also:
  • GetTransformState(), bOriginal parameter description
virtual IndexBuffer* PLRenderer::Renderer::GetIndexBuffer ( ) const [pure virtual]

Gets the current index buffer.

Returns:
The current index buffer, a null pointer if there's no one
virtual bool PLRenderer::Renderer::SetIndexBuffer ( IndexBuffer pIndexBuffer = nullptr) [pure virtual]

Sets the current index buffer.

Parameters:
[in]pIndexBufferThe index buffer which should be set, a null pointer if no index buffer should be set
Returns:
'true' if all went fine, else 'false' (maybe this is already the current index buffer)
virtual Program* PLRenderer::Renderer::GetProgram ( ) const [pure virtual]

Returns the currently used program.

Returns:
The currently used program, can be a null pointer
virtual bool PLRenderer::Renderer::SetProgram ( Program pProgram = nullptr) [pure virtual]

Sets the currently used program.

Parameters:
[in]pProgramProgram to use, can be a null pointer
Returns:
'true' if all went fine, else 'false' (invalid program?)
virtual bool PLRenderer::Renderer::DrawPrimitives ( Primitive::Enum  nType,
PLCore::uint32  nStartIndex,
PLCore::uint32  nNumVertices 
) [pure virtual]

Renders the specified geometric primitive, based on an array of vertices.

Parameters:
[in]nTypeMember of the primitive enumerated type, describing the type of primitive to render
[in]nStartIndexStart vertex index for vertices used during this call
[in]nNumVerticesNumber of vertices used during this call
Returns:
'true' if all went fine, else 'false'
Note:
virtual bool PLRenderer::Renderer::DrawIndexedPrimitives ( Primitive::Enum  nType,
PLCore::uint32  nMinIndex,
PLCore::uint32  nMaxIndex,
PLCore::uint32  nStartIndex,
PLCore::uint32  nNumVertices 
) [pure virtual]

Renders the specified geometric primitive, based on indexing into an array of vertices.

Parameters:
[in]nTypeMember of the primitive enumerated type, describing the type of primitive to render, e.g. "Primitive::TriangleList"
[in]nMinIndexMinimum vertex index for vertices used during this call, usually "0"
[in]nMaxIndexMaximum vertex index for vertices used during this call, usually "pVertexBuffer->GetNumOfElements() - 1" when "pVertexBuffer" is your currently used vertex buffer
[in]nStartIndexStart vertex index for vertices used during this call, usually "0"
[in]nNumVerticesNumber of vertices used during this call, usually "pIndexBuffer->GetNumOfElements()" when "pIndexBuffer" is your currently used index buffer
Returns:
'true' if all went fine, else 'false'
Note:
  • This method draws indexed primitives from the current set of data input streams
  • The nMinIndex and nMaxIndex parameters specify the range of vertex indices used for each DrawIndexedPrimitive() call. These are used to optimize vertex processing of indexed primitives by processing a sequential range of vertices prior to indexing into these vertices. It is invalid for any indices used during this call to reference any vertices outside of this range.
  • DrawIndexedPrimitive() fails if no index and/or vertex array is set
  • The Primitive::PointList member of the primitive enumerated type is not supported and is not a valid type for this method

The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:39
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported