Hardware Buffers In OGRE: The Hardware Buffer Manager

[ < ] | [ Up ] | [ > ] |  |  |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.1 The Hardware Buffer Manager

The HardwareBufferManager class is the factory hub of all the objects in the new geometry system. You create and destroy the majority of the objects you use to define geometry through this class. It's a Singleton, so you access it by doing HardwareBufferManager::getSingleton() - however be aware that it is only guaranteed to exist after the RenderSystem has been initialised (after you call Root::initialise); this is because the objects created are invariably API-specific, although you will deal with them through one common interface.
For example:

    VertexDeclaration* decl = HardwareBufferManager::getSingleton().createVertexDeclaration();

    HardwareVertexBufferSharedPtr vbuf =
    	HardwareBufferManager::getSingleton().createVertexBuffer(
    		3*sizeof(Real), // size of one whole vertex
    		numVertices, // number of vertices
    		HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage
    		false); // no shadow buffer

Don't worry about the details of the above, we'll cover that in the later sections. The important thing to remember is to always create objects through the HardwareBufferManager, don't use 'new' (it won't work anyway in most cases).

This document was generated by Steve Streeting on , 21 2003 using texi2html