GL Studio C++ Runtime API
gls_state_manager_es20_interface.h
Go to the documentation of this file.
1/*! \file
2 \brief IGlsStateManager, interface to a state manager that manages the GL Studio
3runtime library's use of the OpenGL context, minimizing unnecessary state changes.
4
5 \par Copyright Information
6
7 Copyright (c) 2017 by The DiSTI Corporation.<br>
8 11301 Corporate Blvd; Suite 100<br>
9 Orlando, Florida 32817<br>
10 USA<br>
11 <br>
12 All rights reserved.<br>
13
14 This Software contains proprietary trade secrets of DiSTI and may not be
15reproduced, in whole or part, in any form, or by any means of electronic,
16mechanical, or otherwise, without the written permission of DiSTI. Said
17permission may be derived through the purchase of applicable DiSTI product
18licenses which detail the distribution rights of this content and any
19Derivative Works based on this or other copyrighted DiSTI Software.
20
21 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
22AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
23PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
24AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
26PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
27
28 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
29IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
30INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
31DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
32INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
33INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
34OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
35EXCEED FIVE DOLLARS (US$5.00).
36
37 The aforementioned terms and restrictions are governed by the laws of the
38State of Florida and the United States of America. Use, distribution,
39duplication, or disclosure by the U. S. Government is subject to
40"Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).
41
42*/
43
44#ifndef DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
45#define DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
46
48
49#include "gls_es20_effect.h"
51
52/// The maximum number of lights, matching the fixed function pipeline.
53#ifndef LESS_MAX_LIGHTS
54# define MAX_LIGHTS 8
55#else
56# define MAX_LIGHTS 6
57#endif
58
59namespace disti
60{
61/** \interface IGlsStateManagerES20
62 * The interface to a state manager that manages the GL Studio
63 * runtime library's use of the OpenGL context, minimizing unnecessary state changes,
64 * and has support for managing shaders.
65 */
67{
68public:
69 /** Structure used to replicate the Fixed-Function lighting model */
71 {
72 GLfloat _ambient[ 4 ]; ///< Ambient color RGBA
73 GLfloat _diffuse[ 4 ]; ///< Diffuse color RGBA
74 GLfloat _specular[ 4 ]; ///< Specular color RGBA
75 GLfloat _position[ 4 ]; ///< Position XYZW
76
77 GLfloat _spotDirection[ 3 ]; ///< Spotlight direction XYZ vector
78
79 float _spotExponent; ///< Spotlight exponent
80 float _spotCutoff; ///< Spotlight cutoff in degrees
81
82 float _constantAttenuation; ///< Constant attenuation
83 float _linearAttenuation; ///< Linear attenuation
84 float _quadraticAttenuation; ///< Quadratic attenuation
85 };
86
87 /// \return A reference to the top of the modelview matrix stack.
89
90 /// \return A reference to the top of the projection matrix stack.
92
93 ////////////////////////////////////////////////////////////////
94 //
95 // The following methods manage the various OpenGL state calls
96 //
97 ////////////////////////////////////////////////////////////////
98
99 /// Enable or disable the tangent array vertex attribute.
100 /// \param val The new state flag to set.
101 GLS_EXPORT virtual void TangentArrayEnabled( bool val ) = 0;
102
103 /// Enable or disable the binormal array vertex attribute.
104 /// \param val The new state flag to set.
105 GLS_EXPORT virtual void BinormalArrayEnabled( bool val ) = 0;
106
107 /// Set the vertex attribute pointer (to underlying data) for the tangent array.
108 /// \param type Must be GL_FLOAT.
109 /// \param stride The stride in bytes between tangent elements in the vertex data.
110 /// \param pointer The vertex data.
111 GLS_EXPORT virtual void TangentPointer( GLenum type, GLsizei stride, const GLvoid* pointer ) = 0;
112
113 /// Set the vertex attribute pointer (to underlying data) for the binormal array.
114 /// \param type Must be GL_FLOAT.
115 /// \param stride The stride in bytes between binormal elements in the vertex data.
116 /// \param pointer The vertex data.
117 GLS_EXPORT virtual void BinormalPointer( GLenum type, GLsizei stride, const GLvoid* pointer ) = 0;
118
119 /// Set the alpha blend function separately for RGB and A channels.
120 /// \param srcColor Function to use for source color.
121 /// \param dstColor Function to use for destination color.
122 /// \param srcAlpha Function to use for source alpha.
123 /// \param dstAlpha Function to use for destination alpha.
124 GLS_EXPORT virtual void AlphaBlendFuncSeparate( GLenum srcColor, GLenum dstColor, GLenum srcAlpha, GLenum dstAlpha ) = 0;
125
126 /// Set the alpha blend function.
127 /// \param src Function to use for source color.
128 /// \param dst Function to use for destination color.
129 GLS_EXPORT virtual void AlphaBlendFunc( GLenum src, GLenum dst ) = 0;
130
131 /// Push the current alpha blend function on the stack.
132 GLS_EXPORT virtual void PushAlphaBlendFunc() = 0;
133
134 /// Pop the current alpha blend function off the stack.
135 GLS_EXPORT virtual void PopAlphaBlendFunc() = 0;
136
137 ////////////////////////////////////////////////////////////////
138 //
139 // The following methods manage the effects
140 //
141 ////////////////////////////////////////////////////////////////
142
143 /// \return The light source paramters for the given light index.
144 /// \param index The light index whose parameters are to be returned.
146
147 /** Enable the given custom shader program and push it to the top of the custom shader program stack
148 * \param effect custom shader program
149 * \param useProgramImmediately GL_TRUE if custom shader program should immediately be set as the active
150 * shader program else GL_FALSE to allow the state manager to set the program
151 * active when it is needed
152 * \pre number of custom shader programs is < CUSTOM_SHADER_PROGRAM_STACK_DEPTH
153 * \post the given custom shader program is at the top of the custom shader program stack and is enabled, it
154 * is set to the current active shader program if useProgramImmediately is GL_TRUE
155 */
156 GLS_EXPORT virtual void PushCustomShaderProgram( GlsEffect* effect, const GLboolean useProgramImmediately ) = 0;
157
158 /** Pop the custom shader program stack enabling the next custom shader program on the stack if there is one
159 * \pre number of custom shader programs is > 0
160 * \post the custom shader program stack is popped enabling the next custom shader program on the stack if there is one
161 */
163
164 /// \return True if there is at least one custom shader on the stack.
165 GLS_EXPORT virtual bool HasCustomShader() const = 0;
166
167 /** Select the appropriate shader program based on the current settings and update
168 * the current shader program if needed
169 * \param forceUpdate GL_TRUE to force uniforms to be updated as if shader program changed
170 * \pre none
171 * \post appropriate shader program based on the current settings is active
172 */
173 GLS_EXPORT virtual void UpdateShaderProgram( const GLboolean forceUpdate ) = 0;
174
175 /** Update the attributes for the current shader as needed
176 * \pre none
177 * \post Appropriate attributes for the current shader are updated
178 */
180
181 /** Update the uniforms for the current shader as needed
182 * \pre none
183 * \post Appropriate uniforms for the current shader are updated
184 */
186
187protected:
188 /** empty ctor */
190
191 /** empty dtor */
193};
194
195} // namespace disti
196
197#endif // DISTI_GLS_STATE_MANAGER_ES20_INTERFACE_H_INCLUDED
Definition: gls_es20_effect.h:60
Definition: gls_state_manager_es20_interface.h:67
virtual void PopCustomShaderProgram()=0
virtual void TangentArrayEnabled(bool val)=0
virtual void UpdateShaderUniforms()=0
virtual GlsMatrixType & GetTopModelViewMatrix()=0
virtual gl_LightSourceParameters & GetLightSourceParameters(unsigned int index)=0
virtual void PushCustomShaderProgram(GlsEffect *effect, const GLboolean useProgramImmediately)=0
virtual void TangentPointer(GLenum type, GLsizei stride, const GLvoid *pointer)=0
virtual GlsMatrixType & GetTopProjMatrix()=0
virtual void PushAlphaBlendFunc()=0
Push the current alpha blend function on the stack.
virtual void AlphaBlendFuncSeparate(GLenum srcColor, GLenum dstColor, GLenum srcAlpha, GLenum dstAlpha)=0
IGlsStateManagerES20()
Definition: gls_state_manager_es20_interface.h:189
virtual void BinormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)=0
~IGlsStateManagerES20()
Definition: gls_state_manager_es20_interface.h:192
virtual void BinormalArrayEnabled(bool val)=0
virtual bool HasCustomShader() const =0
virtual void AlphaBlendFunc(GLenum src, GLenum dst)=0
virtual void UpdateShaderProgram(const GLboolean forceUpdate)=0
virtual void PopAlphaBlendFunc()=0
Pop the current alpha blend function off the stack.
virtual void UpdateShaderAttributes()=0
Definition: gls_state_manager_interface.h:69
The disti::GlsEffect class. Holds information pertaining to shader programs and their uniform/attribu...
Strings and other standard enumerations used in effects.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
IGlsStateManager, interface to a state manager that manages the GL Studio runtime library's use of th...
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
Definition: gls_state_manager_es20_interface.h:71
GLfloat _ambient[4]
Ambient color RGBA.
Definition: gls_state_manager_es20_interface.h:72
float _spotExponent
Spotlight exponent.
Definition: gls_state_manager_es20_interface.h:79
GLfloat _specular[4]
Specular color RGBA.
Definition: gls_state_manager_es20_interface.h:74
float _spotCutoff
Spotlight cutoff in degrees.
Definition: gls_state_manager_es20_interface.h:80
GLfloat _diffuse[4]
Diffuse color RGBA.
Definition: gls_state_manager_es20_interface.h:73
float _quadraticAttenuation
Quadratic attenuation.
Definition: gls_state_manager_es20_interface.h:84
GLfloat _position[4]
Position XYZW.
Definition: gls_state_manager_es20_interface.h:75
float _linearAttenuation
Linear attenuation.
Definition: gls_state_manager_es20_interface.h:83
GLfloat _spotDirection[3]
Spotlight direction XYZ vector.
Definition: gls_state_manager_es20_interface.h:77
float _constantAttenuation
Constant attenuation.
Definition: gls_state_manager_es20_interface.h:82