diff --git a/bin/meshviewer b/bin/meshviewer index 968fba3..725a636 100644 --- a/bin/meshviewer +++ b/bin/meshviewer @@ -91,7 +91,8 @@ from psbody.mesh.meshviewer import ( MESH_VIEWER_DEFAULT_HEIGHT, ZMQ_HOST, MeshViewerLocal, - MeshViewerRemote) + MeshViewerRemote, + _test_for_opengl) logging.basicConfig(level=logging.INFO) @@ -374,6 +375,8 @@ def take_snapshot(client, args): if __name__ == "__main__": - args = parser_root.parse_args() - dispatch_command(args) + if _test_for_opengl(): + args = parser_root.parse_args() + dispatch_command(args) + sys.exit(0) diff --git a/mesh/meshviewer.py b/mesh/meshviewer.py index e457759..b7d774d 100755 --- a/mesh/meshviewer.py +++ b/mesh/meshviewer.py @@ -95,14 +95,15 @@ def _run_self(args, stdin=None, stdout=None, stderr=None): def _test_for_opengl(): + print("Checking OpenGL...") try: - # from OpenGL.GLUT import glutInit GLUT.glutInit() except Exception as e: + print("OpenGL not available") print(e, file=sys.stderr) - print('failure') - else: - print('success') + return False + print("Success!") + return True test_for_opengl_cached = None