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 #include <osg/PatchParameter>
14 #include <osg/State>
15 #include <osg/Notify>
16 #include <osg/io_utils>
17 
18 using namespace osg;
19 
PatchParameter(GLint vertices)20 PatchParameter::PatchParameter(GLint vertices):
21     _vertices(vertices),
22     _patchDefaultInnerLevel(1.0f,1.0f),
23     _patchDefaultOuterLevel(1.0f,1.0f,1.0f,1.0f)
24 {
25 }
26 
27 
~PatchParameter()28 PatchParameter::~PatchParameter()
29 {
30 }
31 
apply(State & state) const32 void PatchParameter::apply(State& state) const
33 {
34     GLExtensions* extensions = state.get<GLExtensions>();
35     if (extensions->areTessellationShadersSupported )
36     {
37 
38         extensions->glPatchParameteri( GL_PATCH_VERTICES, _vertices );
39         extensions->glPatchParameterfv( GL_PATCH_DEFAULT_INNER_LEVEL, _patchDefaultInnerLevel.ptr() );
40         extensions->glPatchParameterfv( GL_PATCH_DEFAULT_OUTER_LEVEL, _patchDefaultOuterLevel.ptr() );
41     }
42 }
43