1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSG_POLYGONMODE
15#define OSG_POLYGONMODE 1
17#include <osg/StateAttribute>
20#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
21 #define GL_POINT 0x1B00
22 #define GL_LINE 0x1B01
23 #define GL_FILL 0x1B02
28/** State Class for setting OpenGL's polygon culling mode.
30class OSG_EXPORT PolygonMode : public StateAttribute
48 PolygonMode(Face face,Mode mode);
50 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
51 PolygonMode(const PolygonMode& pm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
52 StateAttribute(pm,copyop),
53 _modeFront(pm._modeFront),
54 _modeBack(pm._modeBack) {}
56 META_StateAttribute(osg, PolygonMode, POLYGONMODE);
58 /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
59 virtual int compare(const StateAttribute& sa) const
61 // check the types are equal and then create the rhs variable
62 // used by the COMPARE_StateAttribute_Parameter macros below.
63 COMPARE_StateAttribute_Types(PolygonMode,sa)
65 // compare each parameter in turn against the rhs.
66 COMPARE_StateAttribute_Parameter(_modeFront)
67 COMPARE_StateAttribute_Parameter(_modeBack)
69 return 0; // passed all the above comparison macros, must be equal.
72 void setMode(Face face,Mode mode);
73 Mode getMode(Face face) const;
75 inline bool getFrontAndBack() const { return _modeFront==_modeBack; }
77 virtual void apply(State& state) const;
81 virtual ~PolygonMode();