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