From 9727d8ff069299d1ee41027397fd49766a89bbc5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 2 Mar 2002 09:24:05 +0000 Subject: [PATCH] Added a GL vesion number check to LightModel, and small typo fix in Registry. --- src/osg/LightModel.cpp | 18 +++++++++++------- src/osgDB/Registry.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/osg/LightModel.cpp b/src/osg/LightModel.cpp index acac51896..051187dfe 100644 --- a/src/osg/LightModel.cpp +++ b/src/osg/LightModel.cpp @@ -35,14 +35,18 @@ LightModel::~LightModel() void LightModel::apply(State&) const { glLightModelfv(GL_LIGHT_MODEL_AMBIENT,_ambient.ptr()); - - if (_colorControl==SEPERATE_SPECULAR_COLOR) + + static bool s_seperateSpecularSupported = strcmp((const char *)glGetString(GL_VERSION),"1.2")>=0; + if (s_seperateSpecularSupported) { - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPERATE_SPECULAR_COLOR); - } - else - { - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR); + if (_colorControl==SEPERATE_SPECULAR_COLOR) + { + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPERATE_SPECULAR_COLOR); + } + else + { + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR); + } } glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,_localViewer); diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 957f3291b..0515b6568 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -177,7 +177,7 @@ void Registry::removeDotOsgWrapper(DotOsgWrapper* wrapper) EraseMacro(_nodeWrapperMap,wrapper); } -#undef EraseMaroc +#undef EraseMacro void Registry::addReaderWriter(ReaderWriter* rw) {