OpenSceneGraph 3.6.5
Multisample
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_MULTISAMPLE
15#define OSG_MULTISAMPLE 1
16
17
18#include <osg/GL>
19#include <osg/StateAttribute>
20#include <osg/ref_ptr>
21
22
23#ifndef GL_ARB_multisample
24#define GL_MULTISAMPLE_ARB 0x809D
25#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
26#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
27#define GL_SAMPLE_COVERAGE_ARB 0x80A0
28#define GL_SAMPLE_BUFFERS_ARB 0x80A8
29#define GL_SAMPLES_ARB 0x80A9
30#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
31#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
32#define GL_MULTISAMPLE_BIT_ARB 0x20000000
33#endif
34#ifndef GL_NV_multisample_filter_hint
35#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
36#endif
37
38
39namespace osg {
40
43{
44 public :
45
46 enum Mode
47 {
48 FASTEST = GL_FASTEST,
49 NICEST = GL_NICEST,
50 DONT_CARE = GL_DONT_CARE
51 };
52
54
57 StateAttribute(trans,copyop),
58 _coverage(trans._coverage),
59 _invert(trans._invert),
60 _mode(trans._mode) {}
61
63
65 virtual int compare(const StateAttribute& sa) const
66 {
67 // check the types are equal and then create the rhs variable
68 // used by the COMPARE_StateAttribute_Parameter macros below.
70
71 // compare each parameter in turn against the rhs.
75
76 return 0; // passed all the above comparison macros, must be equal.
77 }
78
79 void setSampleCoverage(float coverage, bool invert)
80 {
81 _coverage = coverage;
82 _invert = invert;
83 }
84 inline void setCoverage(float coverage) { _coverage=coverage; }
85 inline float getCoverage() const { return _coverage; }
86
87 inline void setInvert(bool invert) { _invert=invert; }
88 inline bool getInvert() const { return _invert; }
89
90 inline void setHint(Mode mode) { _mode = mode; }
91 inline Mode getHint() const { return _mode; }
92
93 virtual void apply(State& state) const;
94
95 protected :
96
97 virtual ~Multisample();
98
99 float _coverage;
102};
103
104}
105
106#endif
107
108
109
#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
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
Multisample(const Multisample &trans, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition Multisample:56
Mode getHint() const
Definition Multisample:91
virtual int compare(const StateAttribute &sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition Multisample:65
void setCoverage(float coverage)
Definition Multisample:84
bool _invert
Definition Multisample:100
float _coverage
Definition Multisample:99
virtual void apply(State &state) const
apply the OpenGL state attributes.
void setInvert(bool invert)
Definition Multisample:87
Mode _mode
Definition Multisample:101
virtual ~Multisample()
bool getInvert() const
Definition Multisample:88
Mode
Definition Multisample:47
@ FASTEST
Definition Multisample:48
@ DONT_CARE
Definition Multisample:50
@ NICEST
Definition Multisample:49
void setHint(Mode mode)
Definition Multisample:90
void setSampleCoverage(float coverage, bool invert)
Definition Multisample:79
META_StateAttribute(osg, Multisample, MULTISAMPLE)
float getCoverage() const
Definition Multisample:85
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ MULTISAMPLE
Definition StateAttribute:158
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.