NCBI C++ ToolKit
glstate.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: glstate.cpp 44821 2020-03-23 16:08:14Z evgeniev $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Bob Falk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <gui/opengl/glstate.hpp>
34 #include <gui/opengl/glutils.hpp>
36 #include <gui/opengl/irender.hpp>
37 
39 
40 
41 /// Defaults are set to be the stated openGL defaults for those values.
43 : m_LineWidth(1.0f)
44 , m_LineWidthSet(false)
45 , m_LineJoinStyle(eMiteredJoin)
46 , m_LineJoinStyleSet(false)
47 , m_LineCapStyle(eButtCap)
48 , m_LineCapStyleSet(false)
49 , m_PdfShadeStyle(eGouraud)
50 , m_PdfShadeStyleSet(false)
51 , m_PointSize(1.0f)
52 , m_PointSizeSet(false)
53 , m_ShadeModel(GL_SMOOTH)
54 , m_ShadeModelSet(false)
55 , m_ScissorRect(0, 0, 0, 0)
56 , m_ScissorSet(false)
57 , m_Color(1.0f, 1.0f, 1.0f, 1.0f)
58 , m_ColorSet(false)
59 , m_ColorMaskRed(true)
60 , m_ColorMaskGreen(true)
61 , m_ColorMaskBlue(true)
62 , m_ColorMaskAlpha(true)
63 , m_ColorMaskSet(false)
64 , m_PolygonModeFace(GL_FRONT_AND_BACK)
65 , m_PolygonMode(GL_FILL)
66 , m_PolygonModeSet(false)
67 , m_LineStippleFactor(1)
68 , m_LineStipplePattern(0xFFFF)
69 , m_LineStippleSet(false)
70 , m_PolygonStippleSet(false)
71 , m_SourceBlendFactor(GL_ONE)
72 , m_TargetBlendFactor(GL_ZERO)
73 , m_BlendFuncSet(false)
74 , m_BlendEquation(GL_FUNC_ADD)
75 , m_BlendEquationSet(false)
76 , m_BlendFuncSeparateSet(false)
77 , m_BlendColor(0.0f, 0.0f, 0.0f, 0.0f)
78 , m_BlendColorSet(false)
79 , m_ScaleInvarient(false)
80 , m_ScaleInvarientSet(false)
81 , m_ScaleFactor(TModelUnit(1), TModelUnit(1))
82 , m_Texture(nullptr)
83 , m_Dirty(true)
84 {
85 }
86 
88 {
89  // if (!m_Dirty)
90  // return;
91  m_Dirty = false;
92 
93  IRender& gl = GetGl();
94 
95  if (m_Texture != NULL)
97 
98  if (m_LineWidthSet)
100 
101  if (m_PointSizeSet)
103 
104  if (m_ShadeModelSet)
105  glShadeModel(m_ShadeModel);
106 
107  if (m_ScissorSet)
108  glScissor(m_ScissorRect.Left(), m_ScissorRect.Bottom(),
110 
111  if (m_ColorSet)
113 
114  if (m_ColorMaskSet)
115  glColorMask(m_ColorMaskRed,
119 
120  if (m_PolygonModeSet)
121  glPolygonMode(m_PolygonModeFace, m_PolygonMode);
122 
123  if (m_LineStippleSet)
124  glLineStipple(m_LineStippleFactor, m_LineStipplePattern);
125 
127  glPolygonStipple(m_PolygonStippleMask);
128 
129  size_t i;
130  for (i=0; i<m_Enabled.size(); ++i) {
131  gl.Enable(m_Enabled[i]);
132 
133  if (m_Enabled[i] == GL_BLEND) {
135  if (target == eOpenGL20) {
136  if (m_BlendEquationSet) {
137  glBlendEquation(m_BlendEquation);
138  }
139 
140  if (m_BlendColorSet) {
141  glBlendColor(m_BlendColor.GetRed(),
145  }
146 
147  // OpenGL 1.4
149  glBlendFuncSeparate(m_SourceRgbFactor,
153  }
154  }
155  }
156  }
157 
158  for (i=0; i<m_Disabled.size(); ++i) {
159  gl.Disable(m_Disabled[i]);
160  }
161 }
162 
163 /*
164 void CGlState::SetDefaultGLState()
165 {
166 }
167 
168 void CGlState::ReadState()
169 {
170 }
171 */
172 
173 void CGlState::MergeStates(CGlState& s, GLbitfield mask)
174 {
175  // Merge any state information not included in the mask
176  if (mask == GL_ALL_ATTRIB_BITS)
177  return;
178 
179  // now go one attribute at a time and if none of the mask
180  // variables refer to that item, merge it.
181 
182  if (!(mask|GL_LINE_BIT)) {
185 
186  // put pdf attributes under most apprpriate opengl bits
189 
190  /// Cap (line terminator) style (pdf only)
193  }
194 
195  if (!(mask|GL_POINT_BIT)) {
198  }
199 
200  if (!(mask|GL_LIGHTING_BIT)) {
203  }
204 
205  if (!(mask|GL_SCISSOR_BIT)) {
208  // GL_SCISSOR_TEST can be masked by GL_SCISSOR_BIT or GL_ENABLE_BIT
209  }
210 
211  /// Current color (glColor())
212  if (!(mask|GL_CURRENT_BIT)) {
213  m_Color = s.m_Color;
215  }
216 
217  /// ColorMask ???
218  if (!(mask|GL_SCISSOR_BIT)) {
224  }
225 
226  /// parameters for glPolygonMode. We only support one entry - can't specify
227  /// different modes for GL_FRONT and GL_BACK (should use GL_FRONT_AND_BACK)
228  if (!(mask|GL_POLYGON_BIT)) {
232  // GL_POLYGON_STIPPLE can be masked by GL_POLYGON_BIT or GL_ENABLE_BIT
233  // but not GL_POLYGON_STIPPLE_BIT
234  // GL_CULL_FACE is masked by GL_POLYGON_BIT and GL_ENABLE_BIT
235  }
236 
237  /// glLineStipple(factor, pattern) Deprecated in OpenGL 3+
238  if (!(mask|GL_LINE_BIT)) {
242  // GL_LINE_STIPPLE enable can be masked by GL_LINE_BIT or GL_ENABLE_BIT
243  }
244 
245  if (!(mask|GL_POLYGON_STIPPLE_BIT)) {
246  memcpy(m_PolygonStippleMask, s.m_PolygonStippleMask, sizeof(GLubyte)*32*32);
248  // GL_POLYGON_STIPPLE is not masked by GL_POLYGON_STIPPLE_BIT
249  }
250 
251  /// Blend factors for glBlendFunc()
252  if (!(mask|GL_COLOR_BUFFER_BIT)) {
256 
262 
263  /// Optional color to be used in blending (glBlendColor())
266  }
267 
268  // copy any flags that were set/unset and were not covered
269  // by some other flag
270  if (!(mask|GL_ENABLE_BIT)) {
271 
272  // Iterate over all flags and if they are not specifically covered
273  // by another flag, set them in the merged (this) state
274  size_t i;
275  for (i=0; i<m_Enabled.size(); ++i) {
276  if (x_MergeFlag(m_Enabled[i], mask)) {
277  Enable(m_Enabled[i]);
278  }
279  }
280  for (i=0; i<m_Disabled.size(); ++i) {
281  if (x_MergeFlag(m_Disabled[i], mask)) {
282  Disable(m_Disabled[i]);
283  }
284  }
285  }
286 }
287 
288 bool CGlState::x_MergeFlag(GLenum e, GLbitfield mask)
289 {
290  if (e==GL_BLEND && (mask|GL_COLOR_BUFFER_BIT))
291  return false;
292  if (e==GL_ALPHA_TEST && (mask|GL_COLOR_BUFFER_BIT))
293  return false;
294  if (e==GL_DITHER && (mask|GL_COLOR_BUFFER_BIT))
295  return false;
296  if (e==GL_COLOR_LOGIC_OP && (mask|GL_COLOR_BUFFER_BIT))
297  return false;
298  if (e==GL_INDEX_LOGIC_OP && (mask|GL_COLOR_BUFFER_BIT))
299  return false;
300 
301  if (e==GL_DEPTH_TEST && (mask|GL_DEPTH_BUFFER_BIT))
302  return false;
303 
304  if (e==GL_FOG && (mask|GL_FOG_BIT))
305  return false;
306 
307  if (e==GL_COLOR_MATERIAL && (mask|GL_LIGHTING_BIT))
308  return false;
309  if (e==GL_LIGHTING && (mask|GL_LIGHTING_BIT))
310  return false;
311  if (e==GL_LIGHT0 && (mask|GL_LIGHTING_BIT))
312  return false;
313  if (e==GL_LIGHT1 && (mask|GL_LIGHTING_BIT))
314  return false;
315  if (e==GL_LIGHT2 && (mask|GL_LIGHTING_BIT))
316  return false;
317  if (e==GL_LIGHT3 && (mask|GL_LIGHTING_BIT))
318  return false;
319  if (e==GL_SHADE_MODEL && (mask|GL_LIGHTING_BIT))
320  return false;
321 
322  if (e==GL_LINE_SMOOTH && (mask|GL_LINE_BIT))
323  return false;
324  if (e==GL_LINE_STIPPLE && (mask|GL_LINE_BIT))
325  return false;
326 
327  if (e==GL_POINT_SMOOTH && (mask|GL_POINT_BIT))
328  return false;
329 
330  if (e==GL_CULL_FACE && (mask|GL_POLYGON_BIT))
331  return false;
332  if (e==GL_POLYGON_STIPPLE && (mask|GL_POLYGON_BIT))
333  return false;
334 
335  if (e==GL_SCISSOR_TEST && (mask|GL_SCISSOR_BIT))
336  return false;
337 
338  if (e==GL_STENCIL_TEST && (mask|GL_STENCIL_BUFFER_BIT))
339  return false;
340 
341  if (e==GL_TEXTURE_1D && (mask|GL_TEXTURE_BIT))
342  return false;
343  if (e==GL_TEXTURE_2D && (mask|GL_TEXTURE_BIT))
344  return false;
345  if (e==GL_TEXTURE_3D && (mask|GL_TEXTURE_BIT))
346  return false;
347 
348  if (e==GL_NORMALIZE && (mask|GL_TRANSFORM_BIT))
349  return false;
350  if (e==GL_RESCALE_NORMAL && (mask|GL_TRANSFORM_BIT))
351  return false;
352 
353  return true;
354 }
355 
356 void CGlState::Enable(GLenum glstate)
357 {
358  vector<GLenum>::iterator iter = std::find(m_Disabled.begin(), m_Disabled.end(), glstate);
359  if (iter != m_Disabled.end()) {
360  m_Disabled.erase(iter);
361  m_Dirty = true;
362  }
363 
364  iter = std::find(m_Enabled.begin(), m_Enabled.end(), glstate);
365  if (iter == m_Enabled.end()) {
366  m_Enabled.push_back(glstate);
367  m_Dirty = true;
368  }
369 }
370 
371 bool CGlState::IsEnabled(GLenum glstate) const
372 {
373  vector<GLenum>::const_iterator iter = std::find(m_Enabled.begin(), m_Enabled.end(), glstate);
374  if (iter != m_Enabled.end())
375  return true;
376  else
377  return false;
378 }
379 
380 void CGlState::Disable(GLenum glstate)
381 {
382  vector<GLenum>::iterator iter = std::find(m_Enabled.begin(), m_Enabled.end(), glstate);
383  if (iter != m_Enabled.end()) {
384  m_Enabled.erase(iter);
385  m_Dirty = true;
386  }
387 
388  iter = std::find(m_Disabled.begin(), m_Disabled.end(), glstate);
389  if (iter == m_Disabled.end()) {
390  m_Disabled.push_back(glstate);
391  m_Dirty = true;
392  }
393 }
394 
395 bool CGlState::IsDisabled(GLenum glstate) const
396 {
397  vector<GLenum>::const_iterator iter = std::find(m_Disabled.begin(), m_Disabled.end(), glstate);
398  if (iter != m_Disabled.end())
399  return true;
400  else
401  return false;
402 }
403 
405 {
406  m_Texture = tex;
407  m_Dirty = true;
408 }
409 
410 void CGlState::LineWidth(GLfloat w)
411 {
412  if (!m_LineWidthSet || w != m_LineWidth) {
413  m_LineWidth = w;
414  m_LineWidthSet = true;
415  m_Dirty = true;
416  }
417 }
418 
419 void CGlState::PointSize(GLfloat s)
420 {
421  if (!m_PointSizeSet || s != m_PointSize) {
422  m_PointSize = s;
423  m_PointSizeSet = true;
424  m_Dirty = true;
425  }
426 }
427 
429 {
430  if (!m_ShadeModelSet || mode != m_ShadeModel) {
431  m_ShadeModel = mode;
432  m_ShadeModelSet = true;
433  m_Dirty = true;
434  }
435 }
436 
437 void CGlState::Scissor(GLint x, GLint y,
438  GLsizei width, GLsizei height)
439 {
440  TVPRect s(x, y, x+width, y+height);
441 
442  if (!m_ScissorSet || s != m_ScissorRect) {
443  m_ScissorRect = s;
444  m_ScissorSet = true;
445  m_Dirty = true;
446  }
447 }
448 
450 {
451  m_Color = c;
452  m_ColorSet = true;
453  m_Dirty = true;
454 }
455 
456 void CGlState::Color3f(GLfloat r, GLfloat g, GLfloat b)
457 {
458  ColorC(CRgbaColor(r, g, b));
459 }
460 
461 void CGlState::Color3fv(const GLfloat* v)
462 {
463  ColorC(CRgbaColor(v[0], v[1], v[2]));
464 }
465 
466 void CGlState::Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
467 {
468  ColorC(CRgbaColor(r, g, b, a));
469 }
470 
471 void CGlState::Color4fv(const GLfloat* v)
472 {
473  ColorC(CRgbaColor(v[0], v[1], v[2], v[3]));
474 }
475 
476 void CGlState::Color3d(GLdouble r, GLdouble g, GLdouble b)
477 {
478  ColorC(CRgbaColor(float(r), float(g), float(b)));
479 }
480 
481 void CGlState::Color3dv(const GLdouble* v)
482 {
483  ColorC(CRgbaColor(float(v[0]), float(v[1]), float(v[2])));
484 }
485 
486 void CGlState::Color4d(GLdouble r, GLdouble g, GLdouble b, GLdouble a)
487 {
488  ColorC(CRgbaColor(float(r), float(g), float(b), float(a)));
489 }
490 
491 void CGlState::Color4dv(const GLdouble* v)
492 {
493  ColorC(CRgbaColor(float(v[0]), float(v[1]), float(v[2]), float(v[3])));
494 }
495 
496 void CGlState::ColorMask(GLboolean red,
497  GLboolean green,
498  GLboolean blue,
499  GLboolean alpha)
500 {
501  m_ColorMaskRed = red;
502  m_ColorMaskGreen = green;
503  m_ColorMaskBlue = blue;
504  m_ColorMaskAlpha = alpha;
505 
506  m_ColorMaskSet = true;
507  m_Dirty = true;
508 }
509 
510 void CGlState::GetColorMask(GLboolean& red,
511  GLboolean& green,
512  GLboolean& blue,
513  GLboolean& alpha)
514 {
515  red = m_ColorMaskRed;
516  green = m_ColorMaskGreen;
517  blue = m_ColorMaskBlue;
518  alpha = m_ColorMaskAlpha;
519  m_Dirty = true;
520 }
521 
522 void CGlState::PolygonMode(GLenum face, GLenum mode)
523 {
524  if (!m_PolygonModeSet ||
525  face != m_PolygonModeFace ||
526  mode != m_PolygonMode) {
527  m_PolygonModeFace = face;
529  m_PolygonModeSet = true;
530  m_Dirty = true;
531  }
532 }
533 
534 void CGlState::LineStipple(GLint factor, GLushort pattern)
535 {
536  m_LineStippleFactor = factor;
537  m_LineStipplePattern = pattern;
538  m_LineStippleSet = true;
539  m_Dirty = true;
540 }
541 
542 void CGlState::GetLineStipple(GLint& factor, GLushort& pattern) const
543 {
544  factor = m_LineStippleFactor;
545  pattern = m_LineStipplePattern;
546 }
547 
549 {
550  memcpy(m_PolygonStippleMask, mask, 32*32*sizeof(GLubyte));
551  m_PolygonStippleSet = true;
552  m_Dirty = true;
553 }
554 
556 {
557  m_BlendColor = c;
558  m_BlendColorSet = true;
559  m_Dirty = true;
560 }
561 
562 void CGlState::BlendFunc(GLenum sfactor, GLenum dfactor)
563 {
564  if (!m_PolygonModeSet ||
565  sfactor != m_SourceBlendFactor ||
566  dfactor != m_TargetBlendFactor) {
567  m_SourceBlendFactor = sfactor;
568  m_TargetBlendFactor = dfactor;
569 
570  m_BlendFuncSet = true;
571  m_Dirty = true;
572  }
573 }
574 
576 {
578  m_BlendEquationSet = true;
579 }
580 
581 void CGlState::BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
582  GLenum srcAlpha, GLenum dstAlpha)
583 {
584  m_SourceRgbFactor = srcRGB;
585  m_TargetRgbFactor = dstRGB;
586  m_SourceAlpahFactor = srcAlpha;
587  m_TargetAlphaFactor = dstAlpha;
588 
589  m_BlendFuncSeparateSet = true;
590  m_Dirty = true;
591 }
592 
594 {
596  m_ScaleFactor = scale;
597  m_ScaleInvarientSet = true;
598 
599  /// Scale change does not require OpenGL state to be set (m_Dirty invarient)
600 }
601 
603 {
604  m_LineJoinStyle = s;
605  m_LineJoinStyleSet = true;
606 
607  // pdf only options do not require state change (m_Dirty invarient)
608 }
609 
611 {
612  m_LineCapStyle = c;
613  m_LineCapStyleSet = true;
614 
615  // pdf only options do not require state change (m_Dirty invarient)
616 }
617 
619 {
620  m_PdfShadeStyle = s;
621  m_PdfShadeStyleSet = true;
622 
623  // pdf only options do not require state change (m_Dirty invarient)
624 }
625 
627 {
628  m_LineWidth = 1.0f;
629  m_LineWidthSet = false;
631  m_LineJoinStyleSet = false;
633  m_LineCapStyleSet = false;
635  m_PdfShadeStyleSet = false;
636  m_PointSize = 1.0f;
637  m_PointSizeSet = false;
638  m_ShadeModel = GL_SMOOTH;
639  m_ShadeModelSet = false;
640  m_ScissorRect = TVPRect(0, 0, 0, 0);
641  m_ScissorSet = false;
642  m_Color = CRgbaColor(1.0f, 1.0f, 1.0f, 1.0f);
643  m_ColorSet = false;
644  m_ColorMaskRed = true;
645  m_ColorMaskGreen = true;
646  m_ColorMaskBlue = true;
647  m_ColorMaskAlpha = true;
648  m_ColorMaskSet = false;
649  m_PolygonModeFace = GL_FRONT_AND_BACK;
650  m_PolygonMode = GL_FILL;
651  m_PolygonModeSet = false;
653  m_LineStipplePattern = 0xFFFF;
654  m_LineStippleSet = false;
655  m_PolygonStippleSet = false;
656  m_SourceBlendFactor = GL_ONE;
657  m_TargetBlendFactor = GL_ZERO;
658  m_BlendFuncSet = false;
659  m_BlendEquation = GL_FUNC_ADD;
660  m_BlendEquationSet = false;
661  m_BlendFuncSeparateSet = false;
662  m_BlendColor = CRgbaColor(0.0f, 0.0f, 0.0f, 0.0f);
663  m_BlendColorSet = false;
664  m_ScaleInvarient = false;
665  m_ScaleInvarientSet = false;
666  m_ScaleFactor = { TModelUnit(1), TModelUnit(1) };
667  m_Texture = nullptr;
668  m_Dirty = true;
669 }
670 
ncbi::TMaskedQueryRegions mask
CGlState Class to encapsulate Rendering state so that a set of user-selected GL state options can be ...
Definition: glstate.hpp:195
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
#define NULL
Definition: ncbistd.hpp:225
bool IsDisabled(GLenum glstate) const
Return true if option is in m_Disabled list for this state.
Definition: glstate.cpp:395
GLdouble TModelUnit
Definition: gltypes.hpp:48
GLenum m_PolygonModeFace
parameters for glPolygonMode.
Definition: glstate.hpp:404
void Color4fv(const GLfloat *v)
Definition: irender.hpp:98
bool m_PdfShadeStyleSet
Definition: glstate.hpp:377
virtual void MergeStates(CGlState &s, GLbitfield mask)
This is for pushing and popping states - retain state variables not included in the mask (as per glPu...
Definition: glstate.cpp:173
T Height() const
Definition: glrect.hpp:90
ELineJoinStyle
Enumerators for non-enumerated state values (e.g. pdf-only state values)
Definition: glstate.hpp:77
ELineCapStyle m_LineCapStyle
Cap (line terminator) style (effects pdf only)
Definition: glstate.hpp:372
virtual void PointSize(GLfloat s)
Set point size for drawing: glPointSize()
Definition: glstate.cpp:419
virtual void Enable(GLenum glstate)=0
virtual void PdfShadeStyle(EPdfShadeStyle s)
In (our) PDF files there are two kinds of polys, flat ones (move to, line to, fill) which can have an...
Definition: glstate.cpp:618
GLfloat m_PointSize
Point size (glPointSize())
Definition: glstate.hpp:380
bool m_BlendColorSet
Definition: glstate.hpp:434
virtual void PolygonMode(GLenum face, GLenum mode)
Set the polygon rasterization mode.
Definition: glstate.cpp:522
GLboolean m_ColorMaskGreen
Definition: glstate.hpp:397
virtual void Color3d(GLdouble r, GLdouble g, GLdouble b)
Definition: glstate.cpp:476
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
virtual void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
Set the color mask (glColorMask)
Definition: glstate.cpp:496
T Bottom() const
Definition: glrect.hpp:82
bool m_ScaleInvarient
If true, object dimension are in pixels/points (not zoomable)
Definition: glstate.hpp:442
virtual void ScaleInvarient(bool b, CVect2< TModelUnit > scale=CVect2< TModelUnit >(TModelUnit(1), TModelUnit(1)))
Generic rendering options not specfically tied to OpenGL (or pdf..)
Definition: glstate.cpp:593
virtual void LineStipple(GLint factor, GLushort pattern)
Set line stipple pattern: glLineStipple(). Deprecated in gl 3.2+.
Definition: glstate.cpp:534
virtual void BlendColor(const CRgbaColor &c)
glBlendColor() - Optional constant color for blending
Definition: glstate.cpp:555
ELineJoinStyle m_LineJoinStyle
Joining style for adjacent lines (effects pdf only)
Definition: glstate.hpp:368
bool m_LineStippleSet
Definition: glstate.hpp:411
T Width() const
Definition: glrect.hpp:86
virtual void PointSize(GLfloat size)=0
Set point size for drawing: glPointSize()
I3DTexture * m_Texture
For now only allow 1 texture per object (no multi-texturing)
Definition: glstate.hpp:449
bool m_BlendFuncSet
Definition: glstate.hpp:419
IRender & GetGl()
convenience function for getting current render manager
virtual void Color3fv(const GLfloat *v)
Definition: glstate.cpp:461
GLushort m_LineStipplePattern
Definition: glstate.hpp:410
CGlRect< TVPUnit > TVPRect
Definition: gltypes.hpp:53
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
Definition: glstate.cpp:356
virtual void Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
Set clipping window: glScissor(x,y,width,height)
Definition: glstate.cpp:437
virtual void Reset()
Resets the state back to the default one.
Definition: glstate.cpp:626
bool m_ShadeModelSet
Definition: glstate.hpp:385
EPdfShadeStyle m_PdfShadeStyle
Pdf shading style (effects pdf only)
Definition: glstate.hpp:376
CRgbaColor m_BlendColor
Optional color to be used in blending (glBlendColor())
Definition: glstate.hpp:433
GLenum m_TargetAlphaFactor
Definition: glstate.hpp:429
virtual void LineWidth(GLfloat w)
Set line width for drawing: glLineWidth()
Definition: glstate.cpp:410
bool IsEnabled(GLenum glstate) const
Return true if option is in m_Enabled list for this state.
Definition: glstate.cpp:371
CRgbaColor m_Color
Current color (glColor())
Definition: glstate.hpp:392
virtual void LineCapStyle(ELineCapStyle c)
Set line cap ending style (pdf only)
Definition: glstate.cpp:610
virtual void BlendEquation(GLenum mode)
Options for glBlendEquation.
Definition: glstate.cpp:575
bool x_MergeFlag(GLenum e, GLbitfield mask)
helper function for MergeState that determines if a flag was masked
Definition: glstate.cpp:288
GLenum m_SourceRgbFactor
Blend factors for glBlendFuncSeparate.
Definition: glstate.hpp:426
virtual void Color3dv(const GLdouble *v)
Definition: glstate.cpp:481
bool m_BlendEquationSet
Definition: glstate.hpp:423
T Left() const
Definition: glrect.hpp:81
CVect2< TModelUnit > m_ScaleFactor
Only needed for scale-invariant rendering (from CGlPane::GetScale()
Definition: glstate.hpp:445
void MakeCurrent(ERenderTarget target)
Set current options.
Definition: glstate.cpp:87
void GetLineStipple(GLint &factor, GLushort &pattern) const
Definition: glstate.cpp:542
ERenderTarget
Different api levels based on information from OpenGL driver.
Definition: glstate.hpp:61
void GetColorMask(GLboolean &red, GLboolean &green, GLboolean &blue, GLboolean &alpha)
Definition: glstate.cpp:510
virtual void Disable(GLenum glstate)
glDisable() all options in m_Disabled
Definition: glstate.cpp:380
bool m_ColorSet
Definition: glstate.hpp:393
bool m_ScaleInvarientSet
Definition: glstate.hpp:443
GLubyte m_PolygonStippleMask[32 *32]
Definition: glstate.hpp:413
GLenum m_SourceBlendFactor
Blend factors for glBlendFunc()
Definition: glstate.hpp:417
virtual void Color3f(GLfloat r, GLfloat g, GLfloat b)
Set current color (glColor{3,4}{f,d})
Definition: glstate.cpp:456
GLenum m_TargetRgbFactor
Definition: glstate.hpp:427
ELineCapStyle
Definition: glstate.hpp:78
virtual void SetTexture(I3DTexture *tex)
Allow 1 texture for now (no multi-texturing)
Definition: glstate.cpp:404
bool m_BlendFuncSeparateSet
Definition: glstate.hpp:430
GLenum m_ShadeModel
Shade model (GL_FLAT or GL_SMOOTH)
Definition: glstate.hpp:384
bool m_PolygonStippleSet
Definition: glstate.hpp:414
virtual void Color4dv(const GLdouble *v)
Definition: glstate.cpp:491
bool m_PointSizeSet
Definition: glstate.hpp:381
virtual void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Definition: glstate.cpp:466
GLfloat m_LineWidth
Line width (glLineWidth())
Definition: glstate.hpp:364
bool m_PolygonModeSet
Definition: glstate.hpp:406
bool m_LineJoinStyleSet
Definition: glstate.hpp:369
EPdfShadeStyle
Definition: glstate.hpp:79
GLint m_LineStippleFactor
glLineStipple(factor, pattern) Deprecated in OpenGL 3+
Definition: glstate.hpp:409
virtual void MakeCurrent()=0
GLboolean m_ColorMaskBlue
Definition: glstate.hpp:398
virtual void LineJoinStyle(ELineJoinStyle s)
PDF-specific rendering state.
Definition: glstate.cpp:602
CGlState()
Defaults are set to be the stated openGL defaults for those values.
Definition: glstate.cpp:42
virtual void ShadeModel(GLenum mode)
Set shade model for default lighting: glShadeModel(GL_FLAT or GL_SMOOTH)
Definition: glstate.cpp:428
virtual void Disable(GLenum glstate)=0
glDisable()
GLboolean m_ColorMaskRed
ColorMask.
Definition: glstate.hpp:396
virtual void Color4d(GLdouble r, GLdouble g, GLdouble b, GLdouble a)
Definition: glstate.cpp:486
bool m_ColorMaskSet
Definition: glstate.hpp:400
virtual void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
Options for glBlendFuncSeparate, also enabled via Enable(GL_BLEND).
Definition: glstate.cpp:581
GLboolean m_ColorMaskAlpha
Definition: glstate.hpp:399
GLenum m_SourceAlpahFactor
Definition: glstate.hpp:428
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)
Options to be used when GL_BLEND is enabled.
Definition: glstate.cpp:562
virtual void Color4fv(const GLfloat *v)
Definition: glstate.cpp:471
vector< GLenum > m_Disabled
Set of all options to be disabled (glDisable())
Definition: glstate.hpp:439
bool m_LineCapStyleSet
Definition: glstate.hpp:373
bool m_Dirty
Set to false in MakeCurrent and true when any parms are updated.
Definition: glstate.hpp:452
TVPRect m_ScissorRect
Scissor rectangle.
Definition: glstate.hpp:388
bool m_ScissorSet
Definition: glstate.hpp:389
virtual void PolygonStipple(GLubyte *mask)
Set polygon stipple pattern: glPolygonStipple(). Deprecated in gl 3.2+.
Definition: glstate.cpp:548
GLenum m_PolygonMode
Definition: glstate.hpp:405
vector< GLenum > m_Enabled
Set of all options to be enabled (glEnable())
Definition: glstate.hpp:437
virtual void ColorC(const CRgbaColor &c)
Definition: glstate.cpp:449
bool m_LineWidthSet
Definition: glstate.hpp:365
GLenum m_BlendEquation
Blend equatnion for glBlendEquation()
Definition: glstate.hpp:422
GLenum m_TargetBlendFactor
Definition: glstate.hpp:418
@ eMiteredJoin
Definition: glstate.hpp:77
@ eOpenGL20
Definition: glstate.hpp:61
@ eButtCap
Definition: glstate.hpp:78
@ eGouraud
Definition: glstate.hpp:79
float GetBlue(void) const
Definition: rgba_color.hpp:333
float GetGreen(void) const
Definition: rgba_color.hpp:327
float GetAlpha(void) const
Definition: rgba_color.hpp:339
const float * GetColorArray(void) const
Access the color array directly.
Definition: rgba_color.hpp:394
float GetRed(void) const
Get specific channels in floating point values.
Definition: rgba_color.hpp:321
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
int i
mdb_mode_t mode
Definition: lmdb++.h:38
unsigned int a
Definition: ncbi_localip.c:102
#define nullptr
Definition: ncbimisc.hpp:45
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
Modified on Tue Jun 18 13:37:52 2024 by modify_doxy.py rev. 669887