Added CMake support for specifying what OpenGL target and features that the OpenSceneGraph build should use.
Added use of the new Cmake generated #define's for optionally compiling parts of the OpenSceneGraph's OpenGL support for the various OpenGL targets
This commit is contained in:
@@ -29,6 +29,10 @@ AlphaFunc::~AlphaFunc()
|
||||
|
||||
void AlphaFunc::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glAlphaFunc((GLenum)_comparisonFunc,_referenceValue);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: AlphaFunc::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ unsigned int ClipPlane::getClipPlaneNum() const
|
||||
|
||||
void ClipPlane::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glClipPlane((GLenum)(GL_CLIP_PLANE0+_clipPlaneNum),_clipPlane.ptr());
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: ClipPlane::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ ColorMatrix::~ColorMatrix()
|
||||
|
||||
void ColorMatrix::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
unsigned int contextID = state.getContextID();
|
||||
|
||||
static bool s_ARB_imaging = isGLExtensionSupported(contextID,"GL_ARB_imaging");
|
||||
@@ -37,4 +38,7 @@ void ColorMatrix::apply(State& state) const
|
||||
glLoadMatrix(_matrix.ptr());
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: ColorMatrix::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ BoundingBox DrawPixels::computeBound() const
|
||||
|
||||
void DrawPixels::drawImplementation(RenderInfo&) const
|
||||
{
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
glRasterPos3f(_position.x(),_position.y(),_position.z());
|
||||
|
||||
if (_useSubImage)
|
||||
@@ -109,5 +110,8 @@ void DrawPixels::drawImplementation(RenderInfo&) const
|
||||
(GLenum)_image->getDataType(),
|
||||
_image->data() );
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: DrawPixels::drawImplementation(RenderInfo&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ static DeletedDisplayListCache s_deletedDisplayListCache;
|
||||
|
||||
GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHint)
|
||||
{
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedDisplayListCache);
|
||||
|
||||
DisplayListMap& dll = s_deletedDisplayListCache[contextID];
|
||||
@@ -76,6 +77,10 @@ GLuint Drawable::generateDisplayList(unsigned int contextID, unsigned int sizeHi
|
||||
return glGenLists( 1 );
|
||||
}
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Drawable::generateDisplayList(..) - not supported."<<std::endl;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int s_minimumNumberOfDisplayListsToRetainInCache = 0;
|
||||
@@ -91,6 +96,7 @@ unsigned int Drawable::getMinimumNumberOfDisplayListsToRetainInCache()
|
||||
|
||||
void Drawable::deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint)
|
||||
{
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
if (globj!=0)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedDisplayListCache);
|
||||
@@ -98,10 +104,14 @@ void Drawable::deleteDisplayList(unsigned int contextID,GLuint globj, unsigned i
|
||||
// insert the globj into the cache for the appropriate context.
|
||||
s_deletedDisplayListCache[contextID].insert(DisplayListMap::value_type(sizeHint,globj));
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Drawable::deleteDisplayList(..) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Drawable::flushAllDeletedDisplayLists(unsigned int contextID)
|
||||
{
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedDisplayListCache);
|
||||
|
||||
DisplayListMap& dll = s_deletedDisplayListCache[contextID];
|
||||
@@ -114,6 +124,9 @@ void Drawable::flushAllDeletedDisplayLists(unsigned int contextID)
|
||||
}
|
||||
|
||||
dll.clear();
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Drawable::deleteDisplayList(..) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Drawable::discardAllDeletedDisplayLists(unsigned int contextID)
|
||||
@@ -126,6 +139,7 @@ void Drawable::discardAllDeletedDisplayLists(unsigned int contextID)
|
||||
|
||||
void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availableTime)
|
||||
{
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
// if no time available don't try to flush objects.
|
||||
if (availableTime<=0.0) return;
|
||||
|
||||
@@ -197,6 +211,9 @@ void Drawable::flushDeletedDisplayLists(unsigned int contextID, double& availabl
|
||||
if (noDeleted!=0) notify(INFO)<<"Number display lists deleted = "<<noDeleted<<" elapsed time"<<elapsedTime<<std::endl;
|
||||
|
||||
availableTime -= elapsedTime;
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Drawable::flushDeletedDisplayLists(..) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
Drawable::Drawable()
|
||||
@@ -209,8 +226,13 @@ Drawable::Drawable()
|
||||
// to false in your constructor. This will prevent any display
|
||||
// lists from being automatically created and safeguard the
|
||||
// dynamic updating of data.
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
_supportsDisplayList = true;
|
||||
_useDisplayList = true;
|
||||
#else
|
||||
_supportsDisplayList = false;
|
||||
_useDisplayList = false;
|
||||
#endif
|
||||
|
||||
_supportsVertexBufferObjects = false;
|
||||
_useVertexBufferObjects = false;
|
||||
@@ -454,8 +476,10 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!_useDisplayList) return;
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// current OpenGL context.
|
||||
unsigned int contextID = renderInfo.getContextID();
|
||||
@@ -478,7 +502,9 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
|
||||
drawImplementation(renderInfo);
|
||||
|
||||
glEndList();
|
||||
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Drawable::compileGLObjects(RenderInfo&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Drawable::setThreadSafeRefUnref(bool threadSafe)
|
||||
@@ -537,7 +563,8 @@ void Drawable::setSupportsDisplayList(bool flag)
|
||||
{
|
||||
// if value unchanged simply return.
|
||||
if (_supportsDisplayList==flag) return;
|
||||
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
// if previously set to true then need to check about display lists.
|
||||
if (_supportsDisplayList)
|
||||
{
|
||||
@@ -552,6 +579,9 @@ void Drawable::setSupportsDisplayList(bool flag)
|
||||
|
||||
// set with new value.
|
||||
_supportsDisplayList=flag;
|
||||
#else
|
||||
_supportsDisplayList=false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Drawable::setUseDisplayList(bool flag)
|
||||
@@ -559,6 +589,7 @@ void Drawable::setUseDisplayList(bool flag)
|
||||
// if value unchanged simply return.
|
||||
if (_useDisplayList==flag) return;
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
// if was previously set to true, remove display list.
|
||||
if (_useDisplayList)
|
||||
{
|
||||
@@ -584,6 +615,9 @@ void Drawable::setUseDisplayList(bool flag)
|
||||
_useDisplayList = false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
_useDisplayList = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -601,13 +635,13 @@ void Drawable::setUseVertexBufferObjects(bool flag)
|
||||
{
|
||||
dirtyDisplayList();
|
||||
}
|
||||
|
||||
|
||||
_useVertexBufferObjects = flag;
|
||||
|
||||
}
|
||||
|
||||
void Drawable::dirtyDisplayList()
|
||||
{
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
unsigned int i;
|
||||
for(i=0;i<_globjList.size();++i)
|
||||
{
|
||||
@@ -617,6 +651,7 @@ void Drawable::dirtyDisplayList()
|
||||
_globjList[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ Fog::~Fog()
|
||||
|
||||
void Fog::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glFogi( GL_FOG_MODE, _mode );
|
||||
glFogf( GL_FOG_DENSITY, _density );
|
||||
glFogf( GL_FOG_START, _start );
|
||||
@@ -48,4 +49,7 @@ void Fog::apply(State& state) const
|
||||
{
|
||||
glFogi(GL_FOG_COORDINATE_SOURCE,_fogCoordinateSource);
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Fog::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ void FragmentProgram::dirtyFragmentProgramObject()
|
||||
|
||||
void FragmentProgram::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
|
||||
const unsigned int contextID = state.getContextID();
|
||||
const Extensions* extensions = getExtensions(contextID,true);
|
||||
|
||||
@@ -188,6 +190,9 @@ void FragmentProgram::apply(State& state) const
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW); // restore matrix mode
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: FragmentProgram::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FragmentProgram::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
@@ -23,15 +23,21 @@
|
||||
|
||||
void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime)
|
||||
{
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
osg::Drawable::flushDeletedDisplayLists(contextID,availableTime);
|
||||
#endif
|
||||
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
|
||||
#endif
|
||||
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
|
||||
osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
|
||||
osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
|
||||
osg::Texture::flushDeletedTextureObjects(contextID,currentTime,availableTime);
|
||||
osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
|
||||
}
|
||||
|
||||
@@ -39,28 +45,41 @@ void osg::flushAllDeletedGLObjects(unsigned int contextID)
|
||||
{
|
||||
double currentTime = DBL_MAX;
|
||||
double availableTime = DBL_MAX;
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
osg::Drawable::flushAllDeletedDisplayLists(contextID);
|
||||
#endif
|
||||
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
|
||||
#endif
|
||||
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
|
||||
osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
|
||||
osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
|
||||
osg::Texture::flushAllDeletedTextureObjects(contextID);
|
||||
osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
|
||||
}
|
||||
|
||||
void osg::discardAllDeletedGLObjects(unsigned int contextID)
|
||||
{
|
||||
osg::GLBufferObject::discardAllDeletedBufferObjects(contextID);
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
osg::Drawable::discardAllDeletedDisplayLists(contextID);
|
||||
#endif
|
||||
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID);
|
||||
osg::VertexProgram::discardDeletedVertexProgramObjects(contextID);
|
||||
#endif
|
||||
|
||||
osg::GLBufferObject::discardAllDeletedBufferObjects(contextID);
|
||||
osg::FrameBufferObject::discardDeletedFrameBufferObjects(contextID);
|
||||
osg::Program::discardDeletedGlPrograms(contextID);
|
||||
osg::RenderBuffer::discardDeletedRenderBuffers(contextID);
|
||||
osg::Shader::discardDeletedGlShaders(contextID);
|
||||
osg::Texture::discardAllDeletedTextureObjects(contextID);
|
||||
osg::VertexProgram::discardDeletedVertexProgramObjects(contextID);
|
||||
osg::OcclusionQueryNode::discardDeletedQueryObjects(contextID);
|
||||
}
|
||||
|
||||
@@ -99,10 +99,9 @@ void Light::setLightNum(int num)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Light::captureLightState()
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() );
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() );
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() );
|
||||
@@ -113,10 +112,14 @@ void Light::captureLightState()
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, &_constant_attenuation );
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, &_linear_attenuation );
|
||||
glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, &_quadratic_attenuation );
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Light::captureLightState() - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Light::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() );
|
||||
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() );
|
||||
glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() );
|
||||
@@ -127,4 +130,7 @@ void Light::apply(State&) const
|
||||
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, _constant_attenuation );
|
||||
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, _linear_attenuation );
|
||||
glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, _quadratic_attenuation );
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Light::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include <osg/GL>
|
||||
#include <osg/LightModel>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -48,6 +50,7 @@ LightModel::~LightModel()
|
||||
|
||||
void LightModel::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,_ambient.ptr());
|
||||
|
||||
static bool s_separateSpecularSupported = strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0;
|
||||
@@ -65,5 +68,8 @@ void LightModel::apply(State&) const
|
||||
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,_localViewer);
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,_twoSided);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: LightModel::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ void LineStipple::setPattern(GLushort pattern)
|
||||
|
||||
void LineStipple::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
glLineStipple(_factor, _pattern);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: LineStipple::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#include <osg/LogicOp>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -30,6 +31,10 @@ LogicOp::~LogicOp()
|
||||
|
||||
void LogicOp::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glLogicOp(static_cast<GLenum>(_opcode));
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: LogicOp::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <osg/Material>
|
||||
#include <osg/BoundsChecking>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -351,6 +352,7 @@ void Material::setAlpha(Face face,float alpha)
|
||||
|
||||
void Material::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
if (_colorMode==OFF)
|
||||
{
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
@@ -432,5 +434,7 @@ void Material::apply(State&) const
|
||||
glMaterialf( GL_FRONT, GL_SHININESS, _shininessFront );
|
||||
glMaterialf( GL_BACK, GL_SHININESS, _shininessBack );
|
||||
}
|
||||
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Material::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ void Point::setMaxSize(float maxSize)
|
||||
|
||||
void Point::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glPointSize(_size);
|
||||
|
||||
const unsigned int contextID = state.getContextID();
|
||||
@@ -93,6 +94,9 @@ void Point::apply(State& state) const
|
||||
extensions->glPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE, _fadeThresholdSize);
|
||||
extensions->glPointParameterf(GL_POINT_SIZE_MIN, _minSize);
|
||||
extensions->glPointParameterf(GL_POINT_SIZE_MAX, _maxSize);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: Point::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ bool PointSprite::checkValidityOfAssociatedModes(osg::State& state) const
|
||||
|
||||
void PointSprite::apply(osg::State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
if(!isPointSpriteSupported(state.getContextID())) return;
|
||||
|
||||
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, 1);
|
||||
@@ -59,6 +60,9 @@ void PointSprite::apply(osg::State& state) const
|
||||
|
||||
if (extensions->isPointSpriteCoordOriginSupported())
|
||||
extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,_coordOriginMode);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: PointSprite::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct IntializedSupportedPair
|
||||
|
||||
@@ -68,6 +68,7 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
|
||||
|
||||
void PolygonMode::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
if (_modeFront==_modeBack)
|
||||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
|
||||
@@ -77,5 +78,8 @@ void PolygonMode::apply(State&) const
|
||||
glPolygonMode(GL_FRONT,(GLenum)_modeFront);
|
||||
glPolygonMode(GL_BACK,(GLenum)_modeBack);
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: PolygonMode::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,10 @@ void PolygonStipple::setMask(const GLubyte* givenMask)
|
||||
|
||||
void PolygonStipple::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
glPolygonStipple(_mask);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: PolygonStipple::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <osg/GL>
|
||||
#include <osg/ShadeModel>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -27,5 +28,9 @@ ShadeModel::~ShadeModel()
|
||||
|
||||
void ShadeModel::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glShadeModel((GLenum)_mode);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: ShadeModel::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ TexEnv::~TexEnv()
|
||||
|
||||
void TexEnv::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
if (_mode==ADD)
|
||||
{
|
||||
static bool isTexEnvAddSupported = isGLExtensionSupported(state.getContextID(),"GL_ARB_texture_env_add");
|
||||
@@ -45,4 +46,7 @@ void TexEnv::apply(State& state) const
|
||||
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, _color.ptr());
|
||||
}
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: TexEnv::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ TexEnvCombine::~TexEnvCombine()
|
||||
|
||||
void TexEnvCombine::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
unsigned int contextID = state.getContextID();
|
||||
|
||||
static bool s_isTexEnvCombineSupported =
|
||||
@@ -103,6 +104,9 @@ void TexEnvCombine::apply(State& state) const
|
||||
// we will resort the settung the OpenGL default of GL_MODULATE.
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: TexEnvCombine::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
void TexEnvCombine::setCombine_RGB(GLint cm) { _combine_RGB = cm; }
|
||||
void TexEnvCombine::setCombine_Alpha(GLint cm) { _combine_Alpha = cm; }
|
||||
|
||||
@@ -28,6 +28,7 @@ TexEnvFilter::~TexEnvFilter()
|
||||
|
||||
void TexEnvFilter::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
// note from RO, need to adapt to do testing per graphics context.
|
||||
static float glVersion = asciiToFloat( (const char *)glGetString( GL_VERSION ) );
|
||||
static bool s_isTexLodBias = glVersion>=1.4 || isGLExtensionSupported(state.getContextID(),"GL_EXT_texture_lod_bias");
|
||||
@@ -36,4 +37,7 @@ void TexEnvFilter::apply(State& state) const
|
||||
{
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, _lodBias);
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: TexEnvFilter::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void TexGen::setPlanesFromMatrix(const Matrixd& matrix)
|
||||
|
||||
void TexGen::apply(State&) const
|
||||
{
|
||||
|
||||
#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)
|
||||
if (_mode == OBJECT_LINEAR || _mode == EYE_LINEAR)
|
||||
{
|
||||
GLenum glmode = _mode == OBJECT_LINEAR ? GL_OBJECT_PLANE : GL_EYE_PLANE;
|
||||
@@ -125,5 +125,7 @@ void TexGen::apply(State&) const
|
||||
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, _mode );
|
||||
glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, _mode );
|
||||
}
|
||||
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: TexGen::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ TexMat::~TexMat()
|
||||
|
||||
void TexMat::apply(State& state) const
|
||||
{
|
||||
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glMatrixMode( GL_TEXTURE );
|
||||
glLoadMatrix(_matrix.ptr());
|
||||
|
||||
@@ -43,4 +43,7 @@ void TexMat::apply(State& state) const
|
||||
}
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: TexMat::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ void VertexProgram::dirtyVertexProgramObject()
|
||||
|
||||
void VertexProgram::apply(State& state) const
|
||||
{
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
|
||||
const unsigned int contextID = state.getContextID();
|
||||
const Extensions* extensions = getExtensions(contextID,true);
|
||||
|
||||
@@ -188,6 +190,9 @@ void VertexProgram::apply(State& state) const
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW); // restore matrix mode
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: VertexProgram::apply(State&) - not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void VertexProgram::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
Reference in New Issue
Block a user