OpenSceneGraph 3.6.5
ClampColor
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_CLAMPCOLOR
15#define OSG_CLAMPCOLOR 1
16
17#include <osg/StateAttribute>
18
19#ifndef GL_ARB_color_buffer_float
20#define GL_RGBA_FLOAT_MODE_ARB 0x8820
21#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
22#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
23#define GL_CLAMP_READ_COLOR_ARB 0x891C
24#define GL_FIXED_ONLY_ARB 0x891D
25#endif
26
27#ifndef GL_FIXED_ONLY
28#define GL_FIXED_ONLY GL_FIXED_ONLY_ARB
29#define GL_CLAMP_VERTEX_COLOR GL_CLAMP_VERTEX_COLOR_ARB
30#define GL_CLAMP_READ_COLOR GL_CLAMP_READ_COLOR_ARB
31#define GL_CLAMP_FRAGMENT_COLOR GL_CLAMP_FRAGMENT_COLOR_ARB
32#endif
33
34#if defined(OSG_GL3_AVAILABLE)
35 #define GL_CLAMP_VERTEX_COLOR 0x891A
36 #define GL_CLAMP_FRAGMENT_COLOR 0x891B
37#endif
38
39namespace osg {
40
43{
44 public :
45
47
48 ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode);
49
56
58
60 virtual int compare(const StateAttribute& sa) const
61 {
62 // Check for equal types, then create the rhs variable
63 // used by the COMPARE_StateAttribute_Parameter macros below.
65
66 // Compare each parameter in turn against the rhs.
70
71 return 0; // Passed all the above comparison macros, so must be equal.
72 }
73
74 void setClampVertexColor(GLenum mode) { _clampVertexColor = mode; }
75 GLenum getClampVertexColor() const { return _clampVertexColor; }
76
77 void setClampFragmentColor(GLenum mode) { _clampFragmentColor = mode; }
78 GLenum getClampFragmentColor() const { return _clampFragmentColor; }
79
80 void setClampReadColor(GLenum mode) { _clampReadColor = mode; }
81 GLenum getClampReadColor() const { return _clampReadColor; }
82
83 virtual void apply(State& state) const;
84
85 protected :
86
87 virtual ~ClampColor();
88
92
93};
94
95}
96
97#endif
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
GLenum getClampFragmentColor() const
Definition ClampColor:78
void setClampReadColor(GLenum mode)
Definition ClampColor:80
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition ClampColor:60
GLenum getClampVertexColor() const
Definition ClampColor:75
virtual ~ClampColor()
GLenum getClampReadColor() const
Definition ClampColor:81
GLenum _clampReadColor
Definition ClampColor:91
void setClampFragmentColor(GLenum mode)
Definition ClampColor:77
GLenum _clampVertexColor
Definition ClampColor:89
META_StateAttribute(osg, ClampColor, CLAMPCOLOR)
void setClampVertexColor(GLenum mode)
Definition ClampColor:74
virtual void apply(State &state) const
apply the OpenGL state attributes.
ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode)
GLenum _clampFragmentColor
Definition ClampColor:90
ClampColor(const ClampColor &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition ClampColor:51
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ CLAMPCOLOR
Definition StateAttribute:165
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.