OGRE Manual v1.7 ('Cthugha'): Updating Index Buffers

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

### 5.7.2 Updating Index Buffers

Updating index buffers can only be done when you lock the buffer for writing; See section 5.4 Locking buffers for details. Locking returns a void pointer, which must be cast to the apropriate type; with index buffers this is either an unsigned short (for 16-bit indexes) or an unsigned long (for 32-bit indexes). For example:

    unsigned short* pIdx = static_cast<unsigned short*>(ibuf->lock(HardwareBuffer::HBL_DISCARD));

You can then write to the buffer using the usual pointer semantics, just remember to unlock the buffer when you're finished!

This document was generated by Steve Streeting on December, 31 2009 using texi2html