| GL Studio C++ Runtime API

gls_state_manager.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsStateManager factory class. Creates an instance of a
3 state manager that manages the GL Studio runtime library's use of
4 the OpenGL context, minimizing unnecessary state changes.
5
6 \par Copyright Information
7
8 Copyright (c) 2017 by The DiSTI Corporation.<br>
9 11301 Corporate Blvd; Suite 100<br>
10 Orlando, Florida 32817<br>
11 USA<br>
12 <br>
13 All rights reserved.<br>
14
15 This Software contains proprietary trade secrets of DiSTI and may not be
16 reproduced, in whole or part, in any form, or by any means of electronic,
17 mechanical, or otherwise, without the written permission of DiSTI. Said
18 permission may be derived through the purchase of applicable DiSTI product
19 licenses which detail the distribution rights of this content and any
20 Derivative Works based on this or other copyrighted DiSTI Software.
21
22 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
23 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
24 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
25 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
26 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
27 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
28
29 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
30 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
31 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
32 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
33 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
34 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
35 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
36 EXCEED FIVE DOLLARS (US$5.00).
37
38 The aforementioned terms and restrictions are governed by the laws of the
39 State of Florida and the United States of America. Use, distribution,
40 duplication, or disclosure by the U. S. Government is subject to
41"Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).
42
43*/
44
45#ifndef DISTI_GLS_STATE_MANAGER_H_INCLUDED
46#define DISTI_GLS_STATE_MANAGER_H_INCLUDED
47
48#include "gls_state_manager_interface.h"
49
50#ifdef GLES20
51# include "gls_state_manager_es20_interface.h"
52#endif
53
54/// \cond INTERNAL
55#ifdef GLS_GL_DEBUGGING
56# define ERROR_CHECK() DistiAssert( GL_NO_ERROR == GlsStateManager::CheckError() );
57#else
58# define ERROR_CHECK()
59#endif
60/// \endcond
61
62 namespace disti
63{
64/** The GlsStateManager singleton class that holds an instance of a
65 * state manager that manages the GL Studio runtime library's use of
66 * the OpenGL context, minimizing unnecessary state changes.
67 */
68 class GlsStateManager
69{
70 public:
71 /** The singleton accessor method for an implementation of an IGlsStateManager, which manages
72 * the GL Studio runtime library's use of the OpenGL context, minimizing unnecessary state changes
73 * \return Returns a pointer to the IGlsStateManager implementation singleton.
74 * For OpenGL ES 2.0, returns an implementation of an IGlsStateManagerES20
75 */
76 GLS_EXPORT static IGlsStateManager* Instance();
77
78 /// \return The value of glGetError(), and prints the value if not equal to GL_NO_ERROR.
79 GLS_EXPORT static GLenum CheckError();
80
81 private:
82 /** ctor */
83 GlsStateManager();
84
85 /** dtor */
86 ~GlsStateManager();
87
88 // Creates the proper instance for management by GlsGlobals
89 static IGlsStateManager* CreateStateManager();
90 friend class GlsGlobals;
91};
92
93} // namespace disti
94
95#endif // DISTI_GLS_STATE_MANAGER_H_INCLUDED
disti::GlsGlobals
Hold global objects so we can control order of destruction.
Definition: util.h:2071
disti::GlsStateManager
Definition: gls_state_manager.h:69
disti::GlsStateManager::Instance
static IGlsStateManager * Instance()
disti::GlsStateManager::CheckError
static GLenum CheckError()
disti::IGlsStateManager
Definition: gls_state_manager_interface.h:69
GLS_EXPORT
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
gls_state_manager_es20_interface.h
IGlsStateManager, interface to a state manager that manages the GL Studio runtime library's use of th...
gls_state_manager_interface.h
IGlsStateManager, interface to a state manager that manages the GL Studio runtime library's use of th...
disti
Definition: bmpimage.h:47