GL Studio C++ Runtime API
gls_index_array.h
Go to the documentation of this file.
1/// \file gls_index_array.h
2/// \brief The disti::GlsIndexArray class, for managing index buffers.
3///
4/// \par Copyright Information
5///
6/// Copyright (c) 2016 by The DiSTI Corporation.<br>
7/// 12249 Science Drive; Suite 300<br>
8/// Orlando, Florida 32826<br>
9/// USA<br>
10/// <br>
11/// All rights reserved.<br>
12///
13/// This Software contains proprietary trade secrets of DiSTI and may not be
14/// reproduced, in whole or part, in any form, or by any means of electronic,
15/// mechanical, or otherwise, without the written permission of DiSTI. Said
16/// permission may be derived through the purchase of applicable DiSTI product
17/// licenses which detail the distribution rights of this content and any
18/// Derivative Works based on this or other copyrighted DiSTI Software.
19///
20/// NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21/// AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22/// PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23/// AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24/// IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25/// PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26///
27/// LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28/// IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29/// INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30/// DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31/// INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32/// INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33/// OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34/// EXCEED FIVE DOLLARS (US$5.00).
35///
36/// The aforementioned terms and restrictions are governed by the laws of the
37/// State of Florida and the United States of America.
38
39#ifndef GLS_INDEX_ARRAY_H
40#define GLS_INDEX_ARRAY_H
41
42#include "gls_include.h"
43#include "gls_state_manager.h"
44#include "non_copyable.h"
45
46namespace disti
47{
48/// \details The GlsIndexArray class. Wraps an OpenGL index buffer object.
50{
51public:
52 /** Default constructor
53 */
55
56 /** Destructor
57 */
58 virtual ~GlsIndexArray();
59
60 /** Sets the size of the index buffer
61 * \param size New index buffer count
62 */
63 void SetSize( const unsigned int size );
64
65 /** \return Returns the size of the index buffer */
66 unsigned int GetSize() const
67 {
68 return _size;
69 }
70
71 /** Populates the the index buffer
72 * \pre _size > 0
73 * \param indexData The indices to set. The array length is assumed to be equal to GetSize()
74 */
75 void SetIndices( const unsigned short indexData[] );
76
77 /** Sets one index
78 * \pre index < _size
79 * \param index The index of the index to set
80 * \param value The index data
81 */
82 void SetIndex( const unsigned int index, const unsigned short value );
83
84 /** Download the index buffer data to Open GL
85 * \pre (_vboHandle != 0) && (_size > 0)
86 * \param stateManager The OpenGL state to download the index buffer to
87 */
88 void Bake( IGlsStateManager* stateManager );
89
90 /** Bind the index buffer, e.g. make it current
91 * \pre (_vboHandle != 0) && (_size > 0)
92 * \param stateManager The OpenGL state to bind the buffer on
93 */
94 void Bind( IGlsStateManager* stateManager );
95
96protected:
97 unsigned short* _indexData; /**< The memory for storing the indices */
98 unsigned int _vboHandle; /**< The OpenGL VBO handle */
99 unsigned int _size; /**< The number of indices. There can be unsigned int quantity of unsigned short values*/
100
101 /** Allocates the buffer data, copying the existing data
102 * \param size The new size in bytes to allocate
103 */
104 void AllocateBuffer( const unsigned int size );
105
106 /** Deallocates the buffer data
107 */
109};
110
111} // namespace disti
112
113#endif
Definition: gls_index_array.h:50
void Bind(IGlsStateManager *stateManager)
void SetSize(const unsigned int size)
unsigned short * _indexData
Definition: gls_index_array.h:97
unsigned int _size
Definition: gls_index_array.h:99
void SetIndices(const unsigned short indexData[])
unsigned int _vboHandle
Definition: gls_index_array.h:98
unsigned int GetSize() const
Definition: gls_index_array.h:66
void AllocateBuffer(const unsigned int size)
void SetIndex(const unsigned int index, const unsigned short value)
void Bake(IGlsStateManager *stateManager)
virtual ~GlsIndexArray()
Definition: gls_state_manager_interface.h:65
Definition: non_copyable.h:46
A file for all GL Studio files to include.
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
Definition: bmpimage.h:46
A base class for objects that are not copyable via the standard C++ copy constructor.