Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
BIAS::glfBatch Class Reference

A batch represents a single Draw call including all parameters (render states). More...

#include <OpenGLFramework/Base/glfBatch.hh>

Public Member Functions

void Draw ()
 Draws the batch. More...
 
unsigned int GetMaxUsedTextureIndex ()
 
unsigned int GetMaxUsedTextureMatrixIndex () const
 
 glfBatch ()
 
void Init ()
 
void ReleaseTextureMatrices (unsigned int fromIndex)
 Releases texture matrices including the matrix associated with the argument index. More...
 
void ReleaseTextures (unsigned int fromIndex)
 Releases texture including the matrix associated with the argument index. More...
 
void SetBlendMode (const glfBlendMode *blendMode)
 Sets the blend mode. More...
 
void SetDepthBufferMode (const glfDepthBufferMode *depthBufferMode)
 Sets the depth buffer mode. More...
 
void SetElementBuffer (const glfElementBuffer *elementBuffer)
 Sets the element buffer. More...
 
void SetModelViewMatrix (const glfMatrix *matrix)
 Sets the modelview matrix. More...
 
void SetPrimitiveType (GLenum primitiveType)
 Sets the primitive type to rendering. More...
 
void SetProjectionMatrix (const glfMatrix *matrix)
 Sets the projection matrix. More...
 
void SetRange (int first, int count)
 Sets the range of vertices to be rendered if no element buffer is set, or the range of vertex indices if an element buffer is set. More...
 
void SetRenderTarget (const glfRenderTarget *renderTarget)
 Sets the render target. More...
 
void SetShaderProgram (const glfShaderProgram *shaderProgram)
 Sets the shader program. More...
 
void SetStencilBufferMode (const glfStencilBufferMode *stencilBufferMode)
 Sets the stencil buffer mode. More...
 
void SetTexture (const glfTexture *texture, int textureUnit)
 Sets the texture of a texture unit. More...
 
void SetTextureMatrix (const glfMatrix *matrix, int index)
 Sets a texture matrix. More...
 
void SetVertexBuffer (const glfVertexBuffer *vertexBuffer)
 Sets the vertex buffer. More...
 
void SetViewport (const glfViewport *viewport)
 Sets the viewport. More...
 
 ~glfBatch ()
 

Static Public Member Functions

static int GetMaxSupportedTextureMatrices ()
 
static int GetMaxSupportedTextureUnits ()
 
static void SetDefaultRenderStates ()
 Sets all render states possibly modified by Batch to the OpenGL defaults. More...
 

Detailed Description

A batch represents a single Draw call including all parameters (render states).

Attention
The pointers to all objects passed to the 'Set...' functions must still be valid when the batch is rendered. The objects are not copied!
Author
jkollmann
Examples:
ExampleRenderingContext.cpp.

Definition at line 48 of file glfBatch.hh.

Constructor & Destructor Documentation

glfBatch::glfBatch ( )
glfBatch::~glfBatch ( )

Definition at line 55 of file glfBatch.cpp.

Member Function Documentation

void glfBatch::Draw ( )
int glfBatch::GetMaxSupportedTextureMatrices ( )
static

Definition at line 330 of file glfBatch.cpp.

Referenced by Init(), and SetDefaultRenderStates().

int glfBatch::GetMaxSupportedTextureUnits ( )
static

Definition at line 323 of file glfBatch.cpp.

Referenced by Init(), and SetDefaultRenderStates().

unsigned int glfBatch::GetMaxUsedTextureIndex ( )

Definition at line 100 of file glfBatch.cpp.

unsigned int glfBatch::GetMaxUsedTextureMatrixIndex ( ) const

Definition at line 193 of file glfBatch.cpp.

void glfBatch::Init ( )
void glfBatch::ReleaseTextureMatrices ( unsigned int  fromIndex)

Releases texture matrices including the matrix associated with the argument index.

Definition at line 182 of file glfBatch.cpp.

References SetTextureMatrix().

void glfBatch::ReleaseTextures ( unsigned int  fromIndex)

Releases texture including the matrix associated with the argument index.

Definition at line 90 of file glfBatch.cpp.

References SetTexture().

Referenced by BIAS::PlainPerPixelProcessing::ReleaseTextures().

void glfBatch::SetBlendMode ( const glfBlendMode blendMode)

Sets the blend mode.

Defaults to GL Default. If passed NULL, the currently set GL state is used!

Definition at line 118 of file glfBatch.cpp.

void glfBatch::SetDefaultRenderStates ( )
static

Sets all render states possibly modified by Batch to the OpenGL defaults.

Should be called before using an external library that uses OpenGL.

Note
: The viewport cannot be set to default, because the default is unknown to Batch.

todo: this loop made problems with open scene graph for SIGGRAPH09, fkellner

Definition at line 337 of file glfBatch.cpp.

References BIAS::glfScreen::Bind(), BIAS::glfBlendMode::Bind(), BIAS::glfDepthBufferMode::Bind(), BIAS::glfStencilBufferMode::Bind(), BIAS::glfBlendMode::DEFAULT, BIAS::glfDepthBufferMode::DEFAULT, BIAS::glfStencilBufferMode::DEFAULT, BIAS::glfScreen::GetInstance(), GetMaxSupportedTextureMatrices(), and GetMaxSupportedTextureUnits().

Referenced by BIAS::ImageWarper< StorageType >::Process(), and BIAS::ImageWarper< StorageType >::ProcessWithColor().

void glfBatch::SetDepthBufferMode ( const glfDepthBufferMode depthBufferMode)

Sets the depth buffer mode.

Defaults to GL Default. If passed NULL, the currently set GL state is used!

Examples:
ExampleRenderingContext.cpp.

Definition at line 106 of file glfBatch.cpp.

Referenced by BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::InitBatch_(), and BIAS::TemplateSpecializedBatch::InitBatch_().

void glfBatch::SetElementBuffer ( const glfElementBuffer elementBuffer)

Sets the element buffer.

NULL is allowed. If no element buffer is used, you call Batch::SetPrimitiveType and vertices will be rendered straight from the vertex buffer.

Examples:
ExampleRenderingContext.cpp.

Definition at line 134 of file glfBatch.cpp.

Referenced by BIAS::PlainPerPixelProcessing::InitBatch_(), BIAS::TemplateSpecializedBatch::InitBatch_(), and BIAS::PMDWarp::SetupDefaultPrimitiveRendering_().

void glfBatch::SetModelViewMatrix ( const glfMatrix matrix)

Sets the modelview matrix.

Must be non-NULL. Default is the identity matrix.

Definition at line 150 of file glfBatch.cpp.

Referenced by BIAS::PlainPerPixelProcessing::InitBatch_(), and BIAS::TemplateSpecializedBatch::InitBatch_().

void glfBatch::SetPrimitiveType ( GLenum  primitiveType)

Sets the primitive type to rendering.

This is used only if no element buffer is provided. Valid primitive types are be GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_QUAD_STRIP, GL_QUADS, and GL_POLYGON.

Definition at line 139 of file glfBatch.cpp.

void glfBatch::SetProjectionMatrix ( const glfMatrix matrix)

Sets the projection matrix.

Must be non-NULL. Default is the identity matrix.

Definition at line 156 of file glfBatch.cpp.

Referenced by BIAS::PlainPerPixelProcessing::InitBatch_(), and BIAS::TemplateSpecializedBatch::InitBatch_().

void glfBatch::SetRange ( int  first,
int  count 
)

Sets the range of vertices to be rendered if no element buffer is set, or the range of vertex indices if an element buffer is set.

By default, all geometry will be rendered.

Definition at line 144 of file glfBatch.cpp.

void glfBatch::SetRenderTarget ( const glfRenderTarget renderTarget)
void glfBatch::SetShaderProgram ( const glfShaderProgram shaderProgram)

Sets the shader program.

NULL is allowed. If the shader program is NULL, the fixed-function pipeline is used.

Definition at line 124 of file glfBatch.cpp.

Referenced by BIAS::SimpleMultiPassFragmentShader::Execute(), BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::InitBatch_(), and BIAS::TemplateSpecializedBatch::InitBatch_().

void glfBatch::SetStencilBufferMode ( const glfStencilBufferMode stencilBufferMode)

Sets the stencil buffer mode.

Defaults to GL Default. If passed NULL, the currently set GL state is used!

Definition at line 112 of file glfBatch.cpp.

void glfBatch::SetTexture ( const glfTexture texture,
int  textureUnit 
)

Sets the texture of a texture unit.

NULL is allowed. Defaults are NULL. If a texture of a texture unit is NULL, it should not be used.

Definition at line 71 of file glfBatch.cpp.

Referenced by BIAS::SeparableBilateralFilter::Draw(), BIAS::SimpleMultiPassFragmentShader::Execute(), BIAS::DistortionRendering::Init(), BIAS::TemplateSpecializedBatch::InitBatch_(), ReleaseTextures(), BIAS::PlainPerPixelProcessing::SetTexture(), and BIAS::PlainPerPixelProcessing::SetTextures().

void glfBatch::SetTextureMatrix ( const glfMatrix matrix,
int  index 
)

Sets a texture matrix.

NULL is allowed. If a texture matrix is NULL, it will not be set and is undefined. Make sure to not use a texture matrix that is not set.

Definition at line 162 of file glfBatch.cpp.

Referenced by ReleaseTextureMatrices().

void glfBatch::SetVertexBuffer ( const glfVertexBuffer vertexBuffer)
void glfBatch::SetViewport ( const glfViewport viewport)

Sets the viewport.

Must be non-NULL. There is no default viewport, so you must set one.

Examples:
ExampleRenderingContext.cpp.

Definition at line 65 of file glfBatch.cpp.

Referenced by BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::InitBatch_(), and BIAS::TemplateSpecializedBatch::InitBatch_().


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