Classes | Public Member Functions | Public Attributes

Wizt::VertexField Class Reference
[The Fish Eye Retina - Fiber Bundle to OpenGL Gateway via Vish API]

A VertexField is a (abstract) gateway from RAM to GPU memory. More...

#include <VertexField.hpp>

List of all members.

Classes

Public Member Functions

Public Attributes


Detailed Description

A VertexField is a (abstract) gateway from RAM to GPU memory.

It takes a data array in RAM (provided by the base class Fiber::MemBase) and transforms it into an OpenGL Buffer Array, e.g. to be used as a vertex attribute for some Shader program. It does so via the virtual function

virtual RefPtr<BufferArray> VertexField::createVBOArray(const RefPtr<MemBase>&MB);

which is implemented in child classes for the specific types that are to be transferred from CPU to GPU.

The member function VertexField::append() is then to be used in the rendering routine to add a certain vertex field to a vertex buffer object (VBO) for rendering.

Note that class VertexField does not deal with Fiber::Field itself, but it provides a slot connecting to such. The class FragmentPainter provides the iterators to transform the various fragments of a Field into a sequence of VBO's, each with a collection of appropriate VertexField's attached. Be aware that a single Field may well consist of many fragments, and therefore be loaded as many BufferArray's through the same VertexField.


Constructor & Destructor Documentation

Wizt::VertexField::VertexField ( VObject what,
const string &  fieldname,
bool  ConvertToElements = true 
)

Constructor.

Parameters:
theSlice A common slice object, used to select fields and grids from the same time step.

Member Function Documentation

bool Wizt::VertexField::append ( VBO myVBO,
const RefPtr< Fiber::CreativeArrayBase > &  CAb,
const string &  arrayname,
const RefPtr< GLProgram > &  Shader 
) const

Loading a given dataset as provided by the creator into a vertex array and append it to the given vertex buffer object.

This function must be called within a valid OpenGL Context.

References Wizt::VBO::append(), and createVBOArray().

virtual RefPtr<BufferArray> Wizt::VertexField::createVBOArray ( const RefPtr< Fiber::MemBase > &  MB,
const string &  arrayname,
const RefPtr< GLProgram > &  Shader,
const Fiber::MemBase::Creator_t theCreator 
) const [pure virtual]

Virtual function to create a vertex array from a given memory array.

This function must be called within a valid OpenGL Context.

Implemented in Wizt::VBOField< VBOArrayType >, Wizt::VBOField< TypedTexCoordArray< Type > >, Wizt::VBOField< TypedVertexAttribArray< Type > >, and Wizt::VBOTensorField.

Referenced by append().

bool Wizt::VertexField::isOlderThan ( const Ageable A,
const RefPtr< ValuePool > &  Context 
) const [virtual]

Check if the parameters associated with this field are older than the given age.

If nothing has changed, return true, which is the default. Returning false here will trigger some action like reloading and/or recomputing data, which might be expensive.