Classes | Public Member Functions | Friends

sp::video::OpenGLRenderSystem Class Reference

OpenGL render system. This renderer supports OpenGL 1.1 - 4.1. More...

#include <spOpenGLRenderSystem.hpp>

Inheritance diagram for sp::video::OpenGLRenderSystem:
sp::video::GLFixedFunctionPipeline sp::video::GLProgrammableFunctionPipeline sp::video::GLBasePipeline sp::video::GLBasePipeline sp::video::RenderSystem sp::video::RenderSystem

List of all members.

Classes

struct  SX11FontPackage

Public Member Functions

 OpenGLRenderSystem ()
 ~OpenGLRenderSystem ()
void setupConfiguration ()
bool queryVideoSupport (const EVideoFeatureQueries Query) const
 Returns true if the specified feature is supported by the renderer.
void setAntiAlias (bool isAntiAlias)
 Enables or disables anti-aliasing or multi-sampling.
void setDepthClip (bool Enable)
 Enables or disables depth clipping. By default enabled.
void setStencilMask (u32 BitMask)
 Sets the bit-mask for the stencil buffer. This enables or disables individual bits in the stencil buffer to be written.
void setStencilMethod (const ESizeComparisionTypes Method, s32 Reference=0, u32 BitMask=~0)
void setStencilOperation (const EStencilOperations FailOp, const EStencilOperations ZFailOp, const EStencilOperations ZPassOp)
void setClearStencil (s32 Stencil)
 Sets the stencil clear value. The default value is zero.
bool setupMaterialStates (const MaterialStates *Material, bool Forced=false)
void endSceneRendering ()
 Ends with scene rendering. Always call this after rendering mesh buffers.
void drawMeshBuffer (const MeshBuffer *MeshBuffer)
 Renders the given hardware mesh buffer.
void drawMeshBufferPlain (const MeshBuffer *MeshBuffer, bool useFirstTextureLayer=false)
ShadercreateCgShader (ShaderClass *ShaderClassObj, const EShaderTypes Type, const EShaderVersions Version, const std::list< io::stringc > &ShaderBuffer, const io::stringc &EntryPoint="", const c8 **CompilerOptions=0)
void draw2DImage (const Texture *Tex, const dim::point2di &Position, const color &Color=color(255))
void draw2DImage (const Texture *Tex, const dim::rect2di &Position, const dim::rect2df &Clipping=dim::rect2df(0.0f, 0.0f, 1.0f, 1.0f), const color &Color=color(255))
void draw2DImage (const Texture *Tex, const dim::point2di &Position, f32 Rotation, f32 Radius, const color &Color=color(255))
void draw2DImage (const Texture *Tex, const dim::point2di &lefttopPosition, const dim::point2di &righttopPosition, const dim::point2di &rightbottomPosition, const dim::point2di &leftbottomPosition, const dim::point2df &lefttopClipping=dim::point2df(0.0f, 0.0f), const dim::point2df &righttopClipping=dim::point2df(1.0f, 0.0f), const dim::point2df &rightbottomClipping=dim::point2df(1.0f, 1.0f), const dim::point2df &leftbottomClipping=dim::point2df(0.0f, 1.0f), const color &lefttopColor=color(255), const color &righttopColor=color(255), const color &rightbottomColor=color(255), const color &leftbottomColor=color(255))
 Draws an individual positionable 2D image.
f32 getPixelDepth (const dim::point2di &Position) const
void draw2DPoint (const dim::point2di &Position, const color &Color=255)
 Draws a 2D point at the specified position in screen space.
void draw2DLine (const dim::point2di &PositionA, const dim::point2di &PositionB, const color &Color=255)
 Draws a 2D line at the specified position (PositionA to PositionB).
void draw2DLine (const dim::point2di &PositionA, const dim::point2di &PositionB, const color &ColorA, const color &ColorB)
 Draws a 2D line with a color change-over (ColorA to ColorB).
void draw2DRectangle (const dim::rect2di &Rect, const color &Color=255, bool isSolid=true)
void draw2DRectangle (const dim::rect2di &Rect, const color &lefttopColor, const color &righttopColor, const color &rightbottomColor, const color &leftbottomColor, bool isSolid=true)
 Draws a 2D rectangle or quad with color change-overs.
void draw2DPolygon (const ERenderPrimitives Type, const scene::SPrimitiveVertex2D *VerticesList, u32 Count)
void draw3DPoint (const dim::vector3df &Position, const color &Color=255)
void draw3DLine (const dim::vector3df &PositionA, const dim::vector3df &PositionB, const color &Color=255)
void draw3DLine (const dim::vector3df &PositionA, const dim::vector3df &PositionB, const color &ColorA, const color &ColorB)
void draw3DEllipse (const dim::vector3df &Position, const dim::vector3df &Rotation=0.0f, const dim::size2df &Radius=0.5f, const color &Color=255)
void draw3DTriangle (Texture *hTexture, const dim::triangle3df &Triangle, const color &Color=255)
FontcreateBitmapFont (const io::stringc &FontName="", s32 FontSize=0, s32 Flags=0)
void draw3DText (Font *FontObj, const dim::matrix4f &Transformation, const io::stringc &Text, const color &Color=color(255))
void setColorMatrix (const dim::matrix4f &Matrix)

Friends

class OpenGLTexture

Detailed Description

OpenGL render system. This renderer supports OpenGL 1.1 - 4.1.


Constructor & Destructor Documentation

sp::video::OpenGLRenderSystem::OpenGLRenderSystem (  ) 
sp::video::OpenGLRenderSystem::~OpenGLRenderSystem (  ) 

Member Function Documentation

Font* sp::video::OpenGLRenderSystem::createBitmapFont ( const io::stringc FontName = "",
s32  FontSize = 0,
s32  Flags = 0 
) [virtual]

Reimplemented from sp::video::RenderSystem.

Shader* sp::video::OpenGLRenderSystem::createCgShader ( ShaderClass ShaderClassObj,
const EShaderTypes  Type,
const EShaderVersions  Version,
const std::list< io::stringc > &  ShaderBuffer,
const io::stringc EntryPoint = "",
const c8 **  CompilerOptions = 0 
) [virtual]

Creates a Cg shader.

Parameters:
CompilerOptions,: Specifies the compiler options. Invalid options may occur a runtime crash! So be careful with this option. Look at the Cg documentation to see the full list of supported compiler options. The last options in the array must be a null.
Returns:
Pointer to the new shader or null if the engine was not compiled with the Cg toolkit.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DImage ( const Texture Tex,
const dim::point2di Position,
f32  Rotation,
f32  Radius,
const color Color = color(255) 
) [virtual]

Draws a rotatable 2D image.

Parameters:
Rotation,: Angle (in degrees) for the centered image rotation.
Radius,: Radius for the square image.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DImage ( const Texture Tex,
const dim::point2di lefttopPosition,
const dim::point2di righttopPosition,
const dim::point2di rightbottomPosition,
const dim::point2di leftbottomPosition,
const dim::point2df lefttopClipping = dim::point2df(0.0f, 0.0f),
const dim::point2df righttopClipping = dim::point2df(1.0f, 0.0f),
const dim::point2df rightbottomClipping = dim::point2df(1.0f, 1.0f),
const dim::point2df leftbottomClipping = dim::point2df(0.0f, 1.0f),
const color lefttopColor = color(255),
const color righttopColor = color(255),
const color rightbottomColor = color(255),
const color leftbottomColor = color(255) 
) [virtual]

Draws an individual positionable 2D image.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DImage ( const Texture Tex,
const dim::point2di Position,
const color Color = color(255) 
) [virtual]

Draws a normal 2D image using the specified texture.

Parameters:
Tex,: Texture which is to be used. No settings are needed to be done to draw 2 dimensional with normal Texture objects.
Position,: 2D position in screen space where the image is to be drawn.
Color,: Color which the image shall get.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DImage ( const Texture Tex,
const dim::rect2di Position,
const dim::rect2df Clipping = dim::rect2df(0.0f, 0.0f, 1.0f, 1.0f),
const color Color = color(255) 
) [virtual]

Draws a strechted and mapped 2D image.

Parameters:
Position,: 2D area in screen space. In this case the two parameters of rect2di ("Right" and "Bottom") specifie the size (width and height).
Clipping,: 2D mapping or clipping area. This specifies the texture coordinates for the quad.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DLine ( const dim::point2di PositionA,
const dim::point2di PositionB,
const color Color = 255 
) [virtual]

Draws a 2D line at the specified position (PositionA to PositionB).

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DLine ( const dim::point2di PositionA,
const dim::point2di PositionB,
const color ColorA,
const color ColorB 
) [virtual]

Draws a 2D line with a color change-over (ColorA to ColorB).

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DPoint ( const dim::point2di Position,
const color Color = 255 
) [virtual]

Draws a 2D point at the specified position in screen space.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DPolygon ( const ERenderPrimitives  Type,
const scene::SPrimitiveVertex2D VerticesList,
u32  Count 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DRectangle ( const dim::rect2di Rect,
const color Color = 255,
bool  isSolid = true 
) [virtual]

Draws a 2D rectangle or quad.

Parameters:
Rect,: 2D area in screen space.
Color,: Color which is to be used for the rectangle.
isSolid,: If true the rectangle is filled. Otherwise four lines will be drawn.
See also:
draw2DBox

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw2DRectangle ( const dim::rect2di Rect,
const color lefttopColor,
const color righttopColor,
const color rightbottomColor,
const color leftbottomColor,
bool  isSolid = true 
) [virtual]

Draws a 2D rectangle or quad with color change-overs.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw3DEllipse ( const dim::vector3df Position,
const dim::vector3df Rotation = 0.0f,
const dim::size2df Radius = 0.5f,
const color Color = 255 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw3DLine ( const dim::vector3df PositionA,
const dim::vector3df PositionB,
const color Color = 255 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw3DLine ( const dim::vector3df PositionA,
const dim::vector3df PositionB,
const color ColorA,
const color ColorB 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw3DPoint ( const dim::vector3df Position,
const color Color = 255 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::draw3DText ( Font FontObj,
const dim::matrix4f Transformation,
const io::stringc Text,
const color Color = color(255) 
)
void sp::video::OpenGLRenderSystem::draw3DTriangle ( Texture hTexture,
const dim::triangle3df Triangle,
const color Color = 255 
) [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::drawMeshBuffer ( const MeshBuffer MeshBuffer  )  [virtual]

Renders the given hardware mesh buffer.

Implements sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::drawMeshBufferPlain ( const MeshBuffer MeshBuffer,
bool  useFirstTextureLayer = false 
) [virtual]

Renders only the plain geometry of the given hardware mesh buffer. No normals for lighting, no tex-coords for texture mapping, no fog-coord etc. This can be used to render fast shadow- or depth maps.

Parameters:
MeshBuffer,: Specifies the hardware mesh buffer which is to be drawn.
useFirstTextureLayer,: Specifies whether the first texture layer is to be bound or not. This can be used when the mesh buffer has a transparent color texture and you want to perform alpha-testing.
Note:
If the active render system does not support this optimized function the default function "drawMeshBuffer" will be called.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::endSceneRendering (  )  [virtual]

Ends with scene rendering. Always call this after rendering mesh buffers.

Reimplemented from sp::video::RenderSystem.

f32 sp::video::OpenGLRenderSystem::getPixelDepth ( const dim::point2di Position  )  const [virtual]
Returns:
Depth of the pixel buffer (depth buffer) at the specified position in screen space.

Reimplemented from sp::video::RenderSystem.

bool sp::video::OpenGLRenderSystem::queryVideoSupport ( const EVideoFeatureQueries  Query  )  const [virtual]

Returns true if the specified feature is supported by the renderer.

Implements sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setAntiAlias ( bool  isAntiAlias  )  [virtual]

Enables or disables anti-aliasing or multi-sampling.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setClearStencil ( s32  Stencil  )  [virtual]

Sets the stencil clear value. The default value is zero.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setColorMatrix ( const dim::matrix4f Matrix  )  [virtual]

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setDepthClip ( bool  Enable  )  [virtual]

Enables or disables depth clipping. By default enabled.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setStencilMask ( u32  BitMask  )  [virtual]

Sets the bit-mask for the stencil buffer. This enables or disables individual bits in the stencil buffer to be written.

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setStencilMethod ( const ESizeComparisionTypes  Method,
s32  Reference = 0,
u32  BitMask = ~0 
) [virtual]

Sets the stencil buffer method.

Parameters:
[in] Method Specifies the size comparision type. This is similiar to the "setDepthMethod" function in the "MaterialStates" class.
[in] Reference Specifies the stencil reference value which will be used for the "STENCIL_REPLACE" stencil operation. By default zero.
[in] BitMask Specifies the stencil buffer bit mask. By default 0xFFFFFFFF.
See also:
ESizeComparisionTypes

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setStencilOperation ( const EStencilOperations  FailOp,
const EStencilOperations  ZFailOp,
const EStencilOperations  ZPassOp 
) [virtual]

Sets the stencil buffer operations.

Parameters:
[in] FailOp Specifies the operation which is to be executed when the stencil test fails. The default value is STENCIL_KEEP.
[in] ZFailOp Specifies the operation which is to be executed when the stencil test succeeds but the z-buffer test fails. The default value is STENCIL_KEEP.
[in] ZPassOp Specifies the operation which is to be executed when the stencil test and the z-buffer test succeed. The default value is STENCIL_KEEP.
See also:
EStencilOperations

Reimplemented from sp::video::RenderSystem.

void sp::video::OpenGLRenderSystem::setupConfiguration (  )  [virtual]
bool sp::video::OpenGLRenderSystem::setupMaterialStates ( const MaterialStates Material,
bool  Forced = false 
) [virtual]

Configures the renderer with the specified material states.

Parameters:
[in] Material Pointer to the MaterialStates object.
[in] Forced Specifies whether the setup is to be forced or not. If true the material states will be updated guaranteed. Otherwise the render system checks if the material states are different to the previously set states.
Returns:
True if the new material states have changed. Otherwise there is no need for an update. This function always returns true if 'Forced' is set to true and 'Material' is not null.

Implements sp::video::RenderSystem.


Friends And Related Function Documentation

friend class OpenGLTexture [friend]

Reimplemented from sp::video::RenderSystem.


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