GL Studio C++ Runtime API
gls_display_list.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsDisplayList class.
3
4 \par Copyright Information
5
6 Copyright (c) 2017 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.
38
39*/
40#ifndef _GLS_DISPLAY_LIST_H
41#define _GLS_DISPLAY_LIST_H
42#include "display.h"
43
44namespace disti
45{
46/**
47 The GlsDisplayList class. Manages an OpenGL display list.
48*/
49
51{
52protected:
53 bool _valid; /**< True if this list is valid */
54 bool _useList; /**< True if this list is enabled */
55 unsigned int _handle; /**< The OpenGL list handle for this list */
56
57public:
59 : _valid( false )
60 , _useList( true )
61 , _handle( 0 )
62 {
63 }
64
65 /// Assignment operator
66 /// \param oldClass The list to copy from.
67 /// \return The resulting list (this).
69 {
70 _useList = oldClass._useList;
71 _valid = false;
72 _handle = 0;
73
74 return *this;
75 }
76
78 {
79 Invalidate();
80 }
81
82 /** Invalidate the display list. An object with an invalid display list should
83 * reinvoke its draw code to rebuild the display list. Also deallocates the OpenGL list.
84 */
86 {
87 if( _valid )
88 {
89 glDeleteLists( _handle, 1 );
90 _valid = false;
91 _handle = 0;
92 }
93 }
94
95 /** Allocate an OpenGL display list, deallocating any existing list */
96 void Allocate()
97 {
98 Invalidate();
99 _handle = glGenLists( 1 );
100 _valid = true;
101 }
102
103 /** Start writing into the display list */
104 void Start() { glNewList( _handle, GL_COMPILE ); }
105
106 /** Stop writing into the display list and save it */
107 void End() { glEndList(); }
108
109 /** Draw what's in the display list */
110 void Invoke() { glCallList( _handle ); }
111
112 /// \returns true if the list is valid
113 bool Valid() { return _valid; }
114
115 /// Set whether or not the list is valid.
116 /// \note Be careful when setting this to true. Make sure the list really is valid.
117 /// \param val The new validity of the list.
118 void Valid( const bool& val ) { _valid = val; }
119
120 /// \return True if this display list is enabled.
121 bool UseList() { return _useList; }
122
123 /// Set whether or not this display list is enabled.
124 /// \param val The new enabled state of the list.
125 void UseList( const bool& val ) { _useList = val; }
126};
127
128} // namespace disti
129
130#endif
Definition: gls_display_list.h:51
void Start()
Definition: gls_display_list.h:104
void Valid(const bool &val)
Definition: gls_display_list.h:118
void Allocate()
Definition: gls_display_list.h:96
bool UseList()
Definition: gls_display_list.h:121
GlsDisplayList & operator=(const GlsDisplayList &oldClass)
Definition: gls_display_list.h:68
bool Valid()
Definition: gls_display_list.h:113
void UseList(const bool &val)
Definition: gls_display_list.h:125
void Invalidate()
Definition: gls_display_list.h:85
bool _useList
Definition: gls_display_list.h:54
void Invoke()
Definition: gls_display_list.h:110
bool _valid
Definition: gls_display_list.h:53
unsigned int _handle
Definition: gls_display_list.h:55
void End()
Definition: gls_display_list.h:107
The disti::DisplayObject class and global enumerations.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47