From a9732aa0466dc9c5bfdef1e8db5e858fcad8168d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 18 Aug 2002 11:16:31 +0000 Subject: [PATCH] Added check to disable color binding when the secondary colour extension doesn't exist. --- src/osg/Geometry.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 28405f950..784e70179 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -242,17 +242,18 @@ void Geometry::drawImmediateMode(State& state) } + static SecondaryColor3ubvProc s_glSecondaryColor3ubv = + (SecondaryColor3ubvProc) osg::getGLExtensionFuncPtr("glSecondaryColor3ubv","glSecondaryColor3ubvEXT"); + static SecondaryColor3fvProc s_glSecondaryColor3fv = + (SecondaryColor3fvProc) osg::getGLExtensionFuncPtr("glSecondaryColor3fv","glSecondaryColor3fvEXT"); + AttributeBinding secondaryColorBinding = _secondaryColorBinding; - if (secondaryColorBinding!=BIND_OFF && !secondaryColorPointer) + if (secondaryColorBinding!=BIND_OFF && (!secondaryColorPointer || !s_glSecondaryColor3ubv || !s_glSecondaryColor3fv)) { // switch off if not supported or have a valid data. secondaryColorBinding = BIND_OFF; } - static SecondaryColor3ubvProc s_glSecondaryColor3ubv = - (SecondaryColor3ubvProc) osg::getGLExtensionFuncPtr("glSecondaryColor3ubv","glSecondaryColor3ubvEXT"); - static SecondaryColor3fvProc s_glSecondaryColor3fv = - (SecondaryColor3fvProc) osg::getGLExtensionFuncPtr("glSecondaryColor3fv","glSecondaryColor3fvEXT"); switch (secondaryColorBinding) { @@ -297,7 +298,7 @@ void Geometry::drawImmediateMode(State& state) AttributeBinding fogCoordBinding = _fogCoordBinding; - if (fogCoordBinding!=BIND_OFF && (!s_glFogCoordfv || !fogCoordPointer)) + if (fogCoordBinding!=BIND_OFF && (!fogCoordPointer || !s_glFogCoordfv)) { // swithc off if not supported or have a valid data. fogCoordBinding = BIND_OFF;