Cinder  0.9.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
cinder::gl::Batch Class Reference

#include <Batch.h>

Public Types

typedef std::map< geom::Attrib, std::string > AttributeMapping
 

Public Member Functions

void draw (GLint first=0, GLsizei count=-1)
 
void bind ()
 
GLenum getPrimitive () const
 
size_t getNumVertices () const
 
size_t getNumIndices () const
 
GLenum getIndexDataType () const
 
const GlslProgRefgetGlslProg () const
 
void replaceGlslProg (const GlslProgRef &glsl)
 
const VaoRef getVao () const
 
VboMeshRef getVboMesh () const
 
void replaceVboMesh (const VboMeshRef &vboMesh)
 
void reassignContext (Context *context)
 

Static Public Member Functions

static BatchRef create (const VboMeshRef &vboMesh, const gl::GlslProgRef &glsl, const AttributeMapping &attributeMapping=AttributeMapping())
 
static BatchRef create (const geom::Source &source, const gl::GlslProgRef &glsl, const AttributeMapping &attributeMapping=AttributeMapping())
 

Protected Member Functions

 Batch (const VboMeshRef &vboMesh, const gl::GlslProgRef &glsl, const AttributeMapping &attributeMapping)
 
 Batch (const geom::Source &source, const gl::GlslProgRef &glsl, const AttributeMapping &attributeMapping)
 
void init (const geom::Source &source, const gl::GlslProgRef &glsl)
 
void initVao (const AttributeMapping &attributeMapping=AttributeMapping())
 

Protected Attributes

VboMeshRef mVboMesh
 
VaoRef mVao
 
GlslProgRef mGlsl
 
AttributeMapping mAttribMapping
 

Friends

class BatchGeomTarget
 

Member Typedef Documentation

typedef std::map<geom::Attrib,std::string> cinder::gl::Batch::AttributeMapping

Maps a geom::Attrib to a named attribute in the GlslProg.

Constructor & Destructor Documentation

cinder::gl::Batch::Batch ( const VboMeshRef vboMesh,
const gl::GlslProgRef glsl,
const AttributeMapping attributeMapping 
)
protected
cinder::gl::Batch::Batch ( const geom::Source source,
const gl::GlslProgRef glsl,
const AttributeMapping attributeMapping 
)
protected

Member Function Documentation

BatchRef cinder::gl::Batch::create ( const VboMeshRef vboMesh,
const gl::GlslProgRef glsl,
const AttributeMapping attributeMapping = AttributeMapping() 
)
static

Builds a Batch from a VboMesh and a GlslProg. Attributes defined in attributeMapping override the default mapping between AttributeSemantics and GlslProg attribute names.

BatchRef cinder::gl::Batch::create ( const geom::Source source,
const gl::GlslProgRef glsl,
const AttributeMapping attributeMapping = AttributeMapping() 
)
static

Builds a Batch from a geom::Source and a GlslProg. Attributes defined in attributeMapping override the default mapping.

void cinder::gl::Batch::draw ( GLint  first = 0,
GLsizei  count = -1 
)

Draws the Batch. Optionally specify a first vertex/element and a count. Otherwise the entire geometry will be drawn.

void cinder::gl::Batch::bind ( )
GLenum cinder::gl::Batch::getPrimitive ( ) const

Returns OpenGL primitive type (GL_TRIANGLES, GL_TRIANGLE_STRIP, etc)

size_t cinder::gl::Batch::getNumVertices ( ) const

Returns the total number of vertices in the associated geometry.

size_t cinder::gl::Batch::getNumIndices ( ) const

Returns the number of element indices in the associated geometry; 0 for non-indexed geometry.

GLenum cinder::gl::Batch::getIndexDataType ( ) const

Returns the data type for indices; GL_UNSIGNED_INT or GL_UNSIGNED_SHORT.

const GlslProgRef& cinder::gl::Batch::getGlslProg ( ) const

Returns the shader associated with the Batch.

void cinder::gl::Batch::replaceGlslProg ( const GlslProgRef glsl)

Replaces the shader associated with the Batch. Issues a warning if not all attributes were able to match.

const VaoRef cinder::gl::Batch::getVao ( ) const

Returns the VAO mapping the Batch's geometry to its shader.

VboMeshRef cinder::gl::Batch::getVboMesh ( ) const

Returns the VboMesh associated with the Batch.

void cinder::gl::Batch::replaceVboMesh ( const VboMeshRef vboMesh)

Replaces the VboMesh associated with the Batch. Issues a warning if not all attributes were able to match.

void cinder::gl::Batch::reassignContext ( Context context)

Changes the GL context the Batch is associated with.

void cinder::gl::Batch::init ( const geom::Source source,
const gl::GlslProgRef glsl 
)
protected
void cinder::gl::Batch::initVao ( const AttributeMapping attributeMapping = AttributeMapping())
protected

Friends And Related Function Documentation

friend class BatchGeomTarget
friend

Member Data Documentation

VboMeshRef cinder::gl::Batch::mVboMesh
protected
VaoRef cinder::gl::Batch::mVao
protected
GlslProgRef cinder::gl::Batch::mGlsl
protected
AttributeMapping cinder::gl::Batch::mAttribMapping
protected

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