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

A vertex buffer contains an array of vertices that can be used for rendering. More...

#include <OpenGLFramework/Base/glfVertexBuffer.hh>

Public Member Functions

void Bind () const
 Binds the vertex buffer in OpenGL. More...
 
void Create (int numVertices, const glfVertexFormat &format, const void *data=NULL, bool useBufferIfPossible=true)
 Creates the vertex buffer for the given number of vertices and vertex format. More...
 
template<class T >
void Create (const std::vector< T > &vertices, const glfVertexFormat &format)
 Secure convenience wrapper for other glfVertexBuffer::Create method. More...
 
int GetBufferID () const
 
glfVertexFormat GetFormat () const
 
int GetNumVertices () const
 Returns the number of vertices in the vertex buffer. More...
 
 glfVertexBuffer ()
 
void * Map ()
 Maps the vertex buffer to system memory, so it can be modified after creation. More...
 
void Unmap ()
 Unmaps the vertex buffer. More...
 
 ~glfVertexBuffer ()
 

Detailed Description

A vertex buffer contains an array of vertices that can be used for rendering.

If possible, the buffer is stored in the video memory.

Author
jkollmann
Examples:
ExampleRenderingContext.cpp.

Definition at line 38 of file glfVertexBuffer.hh.

Constructor & Destructor Documentation

glfVertexBuffer::glfVertexBuffer ( )

Definition at line 31 of file glfVertexBuffer.cpp.

glfVertexBuffer::~glfVertexBuffer ( )

Definition at line 40 of file glfVertexBuffer.cpp.

Member Function Documentation

void glfVertexBuffer::Bind ( ) const

Binds the vertex buffer in OpenGL.

Definition at line 133 of file glfVertexBuffer.cpp.

References BIAS::glfVertexFormat::Bind().

void glfVertexBuffer::Create ( int  numVertices,
const glfVertexFormat format,
const void *  data = NULL,
bool  useBufferIfPossible = true 
)

Creates the vertex buffer for the given number of vertices and vertex format.

If the given data is non-NULL, it will be uploaded to the vertex buffer. It must contain numVertices vertices of the given format. The size of the given data buffer must be numVertices * format.GetVertexSize() bytes.

Examples:
ExampleRenderingContext.cpp.

Definition at line 59 of file glfVertexBuffer.cpp.

References BIAS::glfVertexFormat::GetVertexSize().

Referenced by BIAS::Primitives::AddRelativeQuadPatches(), BIAS::Primitives::AddRelativeQuadPatchOverImageLine(), BIAS::clfTrimmedICP::clfTrimmedICP(), BIAS::Primitives::LocalNormalizedVertexCloud(), BIAS::Primitives::LocalPerspectivePatches(), BIAS::Primitives::LocalPerspectivePatchOverLine(), BIAS::Primitives::LocalPerspectiveQuad(), BIAS::Primitives::PlainQuad2DWithTexture2D(), and BIAS::PMDWarp::SetupDefaultPrimitiveRendering_().

template<class T >
void BIAS::glfVertexBuffer::Create ( const std::vector< T > &  vertices,
const glfVertexFormat format 
)
inline

Secure convenience wrapper for other glfVertexBuffer::Create method.

T is the vertex structure in C++ that is described by format.

Definition at line 58 of file glfVertexBuffer.hh.

References BIAS::glfVertexFormat::GetVertexSize().

int BIAS::glfVertexBuffer::GetBufferID ( ) const
inline

Definition at line 85 of file glfVertexBuffer.hh.

Referenced by BIAS::clfBuffer::AllocateFromVertexBuffer().

glfVertexFormat BIAS::glfVertexBuffer::GetFormat ( ) const
inline

Definition at line 87 of file glfVertexBuffer.hh.

Referenced by BIAS::clfBuffer::AllocateFromVertexBuffer().

int glfVertexBuffer::GetNumVertices ( ) const

Returns the number of vertices in the vertex buffer.

Definition at line 128 of file glfVertexBuffer.cpp.

Referenced by BIAS::clfBuffer::AllocateFromVertexBuffer(), and BIAS::glfBatch::Draw().

void * glfVertexBuffer::Map ( )

Maps the vertex buffer to system memory, so it can be modified after creation.

Attention
Access is write-only!

Definition at line 99 of file glfVertexBuffer.cpp.

Referenced by BIAS::clfTrimmedICP::setFromDepthMap_().

void glfVertexBuffer::Unmap ( )

Unmaps the vertex buffer.

Must be called after glfVertexBuffer::Map and before the vertex buffer is used for rendering again.

Definition at line 113 of file glfVertexBuffer.cpp.

Referenced by BIAS::clfTrimmedICP::setFromDepthMap_().


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