Hello Michael,

On 10/16/2014 03:15 PM, Michael Raab wrote:
we had (again) a customer with an older Quadro graphics board which
unfortunately does not even support vertex array objects. As there was
no check for their support before calling the appropriate GL functions,
I added 2 tests for their extension (GL_ARB_vertex_array_object) to make
sure the application does not crash. Code it attached.

thanks! I think there are still some code paths that could hit this problem though, I'm proposing the attached instead. What do you think?

        Cheers,
                Carsten
diff --git a/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeometry.cpp b/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeometry.cpp
index 7d2e731..e3628cc 100644
--- a/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeometry.cpp
+++ b/Source/System/NodeCores/Drawables/Geometry/Base/OSGGeometry.cpp
@@ -378,6 +378,7 @@ UInt32 Geometry::handleClassicGL(DrawEnv                 *pEnv,
             glEndList();
         }
         else if(_sfUseVAO.getValue() == false ||
+            !pWin->hasExtension(_arbVertexArrayObject) ||
             (prop &   GeoPumpGroup::AllVAOMask) != GeoPumpGroup::AllVAOMask)
         {
             GeoPumpGroup::SplitGeoPump pump = 
@@ -536,6 +537,7 @@ UInt32 Geometry::handleAttGL(DrawEnv                 *pEnv,
             glEndList();
         }
         else if(_sfUseVAO.getValue() == false ||
+            !pWin->hasExtension(_arbVertexArrayObject) ||
             (prop &   GeoPumpGroup::AllVAOMask) != GeoPumpGroup::AllVAOMask)
         {
             GeoPumpGroup::SplitGeoPump pump = 
@@ -653,6 +655,14 @@ UInt32 Geometry::handleVAOGL(DrawEnv                 *pEnv,
     Window           *pWin      = pEnv->getWindow();
     GLHandlerOptions  glOptions = { uiOptions };
 
+    if(!pWin->hasExtension(_arbVertexArrayObject))
+    {
+        SWARNING << "Geometry::handleVAOGL: Extension "
+                 << "'GL_ARB_vertex_array_object' not supported by window "
+                 << pWin << std::endl;
+        return 0;
+    }
+
     if(mode == Window::initialize || mode == Window::needrefresh ||
        mode == Window::reinitialize)
     {
@@ -721,6 +731,15 @@ void Geometry::handleVAODestroyGL(DrawEnv                 *pEnv,
     UInt32                   glid;
     Window                  *pWin = pEnv->getWindow();
 
+    if(!pWin->hasExtension(_arbVertexArrayObject))
+    {
+        SWARNING << "Geometry::handleVAODestroyGL: Extension "
+                 << "'GL_ARB_vertex_array_object' not supported by window "
+                 << pWin
+                 << std::endl;
+        return;
+    }
+
     if(mode == Window::destroy)
     {
         OSGGETGLFUNCBYID_GL3_ES(glDeleteVertexArrays,
@@ -854,6 +873,7 @@ void Geometry::drawPrimitives(DrawEnv *pEnv, UInt32 uiNumInstances)
         }
     }
     else if( _sfUseVAO.getValue() == false ||
+            !pWin->hasExtension(_arbVertexArrayObject) ||
             (prop &   GeoPumpGroup::AllVAOMask) != GeoPumpGroup::AllVAOMask)
     {
 #if (!defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)) &&  \
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to