From 935b2e102bf8709abc6620b229597ee4545c62b5 Mon Sep 17 00:00:00 2001 From: mtarini Date: Mon, 20 Apr 2009 16:30:35 +0000 Subject: [PATCH] added a test on existence of glPointParameterfv before its use in point-based mesh rendering to avoid crashes. --- wrap/gl/trimesh.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wrap/gl/trimesh.h b/wrap/gl/trimesh.h index 836b1a66..6ef23c5d 100644 --- a/wrap/gl/trimesh.h +++ b/wrap/gl/trimesh.h @@ -634,11 +634,13 @@ void DrawPoints() { glPointSize(GetHintParamf(HNPPointSize)); - float camDist=CameraDistance(); - float quadratic[] = { 0.0f, 0.0f, 1.0f/(camDist*camDist) }; - glPointParameterfv( GL_POINT_DISTANCE_ATTENUATION, quadratic ); - glPointParameterf( GL_POINT_SIZE_MAX, 16.0f ); - glPointParameterf( GL_POINT_SIZE_MIN, 1.0f ); + if (glPointParameterfv) { + float camDist = CameraDistance(); + float quadratic[] = { 0.0f, 0.0f, 1.0f/(camDist*camDist) , 0.0f }; + glPointParameterfv( GL_POINT_DISTANCE_ATTENUATION, quadratic ); + glPointParameterf( GL_POINT_SIZE_MAX, 16.0f ); + glPointParameterf( GL_POINT_SIZE_MIN, 1.0f ); + } if(m->vn!=(int)m->vert.size()) {