diff options
-rw-r--r-- | simulation.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/simulation.py b/simulation.py index 535310f..5ebe9f6 100644 --- a/simulation.py +++ b/simulation.py @@ -153,8 +153,17 @@ class Lattice: self.platform = cl.get_platforms()[platform] if opengl: - self.context = cl.Context( - properties=[(cl.context_properties.PLATFORM, self.platform)] + get_gl_sharing_context_properties()) + try: + self.context = cl.Context( + properties = [ + (cl.context_properties.PLATFORM, self.platform) + ] + get_gl_sharing_context_properties()) + except: + self.context = cl.Context( + properties = [ + (cl.context_properties.PLATFORM, self.platform) + ] + get_gl_sharing_context_properties(), + devices = [ self.platform.get_devices()[0] ]) else: self.context = cl.Context( properties=[(cl.context_properties.PLATFORM, self.platform)]) |