1#ifndef _GLS_STATE_MANAGER_H
2#define _GLS_STATE_MANAGER_H
68 #if defined( GLS_DEBUG )
69 static const GLfloat LINE_WIDTH_MIN;
70 static const GLfloat LINE_WIDTH_MAX;
96 void Begin(
const GLenum mode );
127 void AlphaFunc(
const GLenum func,
const GLclampf ref );
144 void BlendFunc(
const GLenum sfactor,
const GLenum dfactor );
229 #if defined( GLS_DEBUG )
235 static GlsUInt32 GetNumberOfInstancesCreated(
void );
274 #if defined( GLS_DEBUG )
292#if defined( GLS_DEBUG )
293#pragma BullseyeCoverage save off
300inline GlsBool GlsGLAlphaFuncIsValid(
const GLenum alphaFunc )
302 return( ( GL_NEVER == alphaFunc ) || ( GL_LESS == alphaFunc ) || ( GL_EQUAL == alphaFunc ) ||
303 ( GL_LEQUAL == alphaFunc ) || ( GL_GREATER == alphaFunc ) || ( GL_NOTEQUAL == alphaFunc ) ||
304 ( GL_GEQUAL == alphaFunc ) || ( GL_ALWAYS == alphaFunc ) );
306#pragma BullseyeCoverage restore
310#if defined( GLS_DEBUG )
311#pragma BullseyeCoverage save off
316inline GlsBool GlsGLBlendFuncSFactorIsValid(
const GLenum sfactor )
318 return( ( GL_ZERO == sfactor ) || ( GL_ONE == sfactor ) ||
319 ( GL_DST_COLOR == sfactor ) || ( GL_ONE_MINUS_DST_COLOR == sfactor ) ||
320 ( GL_SRC_ALPHA == sfactor ) || ( GL_ONE_MINUS_SRC_ALPHA == sfactor ) ||
321 ( GL_DST_ALPHA == sfactor ) || ( GL_ONE_MINUS_DST_ALPHA == sfactor ) ||
322 ( GL_SRC_ALPHA_SATURATE == sfactor ) );
324#pragma BullseyeCoverage restore
327#if defined( GLS_DEBUG )
328#pragma BullseyeCoverage save off
333inline GlsBool GlsGLBlendFuncDFactorIsValid(
const GLenum dfactor )
335 return( ( GL_ZERO == dfactor ) || ( GL_ONE == dfactor ) ||
336 ( GL_SRC_COLOR == dfactor ) || ( GL_ONE_MINUS_SRC_COLOR == dfactor ) ||
337 ( GL_SRC_ALPHA == dfactor ) || ( GL_ONE_MINUS_SRC_ALPHA == dfactor ) ||
338 ( GL_DST_ALPHA == dfactor ) || ( GL_ONE_MINUS_DST_ALPHA == dfactor ) );
340#pragma BullseyeCoverage restore
343#if defined( GLS_DEBUG )
344#pragma BullseyeCoverage save off
349inline GlsBool GlsGLDepthFuncIsValid(
const GLenum func )
351 return( ( GL_NEVER == func ) || ( GL_LESS == func ) || ( GL_LEQUAL == func ) ||
352 ( GL_EQUAL == func ) || ( GL_GREATER == func ) || ( GL_NOTEQUAL == func ) ||
353 ( GL_GEQUAL == func ) || ( GL_ALWAYS == func ) );
355#pragma BullseyeCoverage restore
358#if defined( GLS_DEBUG )
359#pragma BullseyeCoverage save off
364inline GlsBool GlsGLShadeModelIsValid(
const GLenum mode )
366 return( ( GL_FLAT == mode ) || ( GL_SMOOTH == mode ) );
368#pragma BullseyeCoverage restore
371#if defined( GLS_DEBUG )
372#pragma BullseyeCoverage save off
377inline GlsBool GlsGLTetxureEnvModeIsValid(
const GLint mode )
379 return( ( GL_MODULATE == mode ) || ( GL_DECAL == mode ) ||
380 ( GL_BLEND == mode ) || ( GL_REPLACE == mode ) );
382#pragma BullseyeCoverage restore
385#if defined( GLS_DEBUG )
386#pragma BullseyeCoverage save off
391inline GlsBool GlsGLTextureParameterIsValid(
const GLenum pname )
393 return( ( GL_TEXTURE_MIN_FILTER == pname ) || ( GL_TEXTURE_MAG_FILTER == pname ) ||
394 ( GL_TEXTURE_WRAP_S == pname ) || ( GL_TEXTURE_WRAP_T == pname ) );
396#pragma BullseyeCoverage restore
399#if defined( GLS_DEBUG )
400#pragma BullseyeCoverage save off
405inline GlsBool GlsGLTextureMinFilterIsValid(
const GLint param )
407 return( ( GL_NEAREST == param ) || ( GL_LINEAR == param ) ||
408 ( GL_NEAREST_MIPMAP_NEAREST == param ) || ( GL_LINEAR_MIPMAP_NEAREST == param ) ||
409 ( GL_NEAREST_MIPMAP_LINEAR == param ) || ( GL_LINEAR_MIPMAP_LINEAR == param ) );
411#pragma BullseyeCoverage restore
414#if defined( GLS_DEBUG )
415#pragma BullseyeCoverage save off
420inline GlsBool GlsGLTextureMagFilterIsValid(
const GLint param )
422 return( ( GL_NEAREST == param ) || ( GL_LINEAR == param ) );
424#pragma BullseyeCoverage restore
427#if defined( GLS_DEBUG )
428#pragma BullseyeCoverage save off
433inline GlsBool GlsGLTextureWrapIsValid(
const GLint param )
435 return( ( GL_CLAMP == param ) || ( GL_REPEAT == param ) );
437#pragma BullseyeCoverage restore
440#if defined( GLS_DEBUG )
441#pragma BullseyeCoverage save off
446inline GlsBool GlsGLPolygonModeIsValid(
const GLenum mode )
448 return( ( GL_POINT == mode ) || ( GL_LINE == mode ) || ( GL_FILL == mode ) );
450#pragma BullseyeCoverage restore
Definition: gls_state_manager.h:64
GLenum _depthFunc
Definition: gls_state_manager.h:255
void TexEnvi(const GLint param)
void EnableTexture2D(const GlsBool enable)
GLfloat _lineWidth
Definition: gls_state_manager.h:270
void TexParameteri2D(const GLenum pname, const GLint param)
void ShadeModel(const GLenum mode)
GlsBool _depthTest
Definition: gls_state_manager.h:254
GlsBool _alphaTest
Definition: gls_state_manager.h:248
void EnableBlend(const GlsBool enable)
GLenum _shadeModel
Definition: gls_state_manager.h:261
static const GLuint INVALID_GL_TEXTURE_INDEX
Definition: gls_state_manager.h:74
void BindTexture2D(const GLuint textureIndex)
GlsBool _alphaBlend
Definition: gls_state_manager.h:250
void BlendFunc(const GLenum sfactor, const GLenum dfactor)
GLenum _polygonMode
Definition: gls_state_manager.h:272
GLenum _alphaFunc
Definition: gls_state_manager.h:246
GLenum _alphaBlendSFactor
Definition: gls_state_manager.h:251
void Begin(const GLenum mode)
GlsBool _lineSmooth
Definition: gls_state_manager.h:257
void EnableLineSmooth(const GlsBool enable)
GlsBool _cullFace
Definition: gls_state_manager.h:259
GlsColor _color
Definition: gls_state_manager.h:263
static GlsStateManager & GetStateManager(void)
GLuint _textureIndex2D
Definition: gls_state_manager.h:267
GlsBool _texture2D
Definition: gls_state_manager.h:265
void EnableDepthTest(const GlsBool enable)
GLclampf _alphaRef
Definition: gls_state_manager.h:247
virtual ~GlsStateManager()
void EnableAlphaTest(const GlsBool enable)
void DepthFunc(const GLenum func)
void EnableCullFace(const GlsBool enable)
void AlphaFunc(const GLenum func, const GLclampf ref)
void Color(const GlsColor &color)
GLenum _alphaBlendDFactor
Definition: gls_state_manager.h:252
void ResetOpenGLState(void)
void LineWidth(const GLfloat lineWidth)
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
This header defines a 4 component RGBA color for use in the GL Studio DO-178B Runtime Library.
This header includes the API for the OpenGL provider used in the GL Studio DO-178B Runtime Library.
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
int GlsInt32
Definition: gls_types.h:66
bool GlsBool
Definition: gls_types.h:96
unsigned int GlsUInt32
Definition: gls_types.h:73
Definition: gls_color.h:48