From 1e99558fbd3ada8741244cdb4aa2848186e5b358 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 29 Jan 2015 13:14:49 +0300 Subject: [PATCH] 0025762: Visualization, TKOpenGl - fix debug assertion within OpenGl_Workspace::UploadRaytraceData() --- src/OpenGl/OpenGl_Workspace_Raytrace.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/OpenGl/OpenGl_Workspace_Raytrace.cxx b/src/OpenGl/OpenGl_Workspace_Raytrace.cxx index cff5b57b65..acf15d182c 100644 --- a/src/OpenGl/OpenGl_Workspace_Raytrace.cxx +++ b/src/OpenGl/OpenGl_Workspace_Raytrace.cxx @@ -1832,13 +1832,16 @@ Standard_Boolean OpenGl_Workspace::UploadRaytraceData() } const NCollection_Handle >& aBVH = myRaytraceGeometry.BVH(); - - aResult &= mySceneNodeInfoTexture->SubData (myGlContext, 0, aBVH->Length(), - reinterpret_cast (&aBVH->NodeInfoBuffer().front())); - aResult &= mySceneMinPointTexture->SubData (myGlContext, 0, aBVH->Length(), - reinterpret_cast (&aBVH->MinPointBuffer().front())); - aResult &= mySceneMaxPointTexture->SubData (myGlContext, 0, aBVH->Length(), - reinterpret_cast (&aBVH->MaxPointBuffer().front())); + const Standard_Integer aBvhLength = aBVH->Length(); + if (aBvhLength > 0) + { + aResult &= mySceneNodeInfoTexture->SubData (myGlContext, 0, aBVH->Length(), + reinterpret_cast (&aBVH->NodeInfoBuffer().front())); + aResult &= mySceneMinPointTexture->SubData (myGlContext, 0, aBVH->Length(), + reinterpret_cast (&aBVH->MinPointBuffer().front())); + aResult &= mySceneMaxPointTexture->SubData (myGlContext, 0, aBVH->Length(), + reinterpret_cast (&aBVH->MaxPointBuffer().front())); + } for (Standard_Integer aNodeIdx = 0; aNodeIdx < aBVH->Length(); ++aNodeIdx) {