Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for OpenGL before running meshviewer #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions bin/meshviewer
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
9 changes: 5 additions & 4 deletions mesh/meshviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down