diff options
Diffstat (limited to 'silx/gui/_glutils/Program.py')
-rw-r--r-- | silx/gui/_glutils/Program.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/silx/gui/_glutils/Program.py b/silx/gui/_glutils/Program.py index 48c12f5..87eec5f 100644 --- a/silx/gui/_glutils/Program.py +++ b/silx/gui/_glutils/Program.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2014-2017 European Synchrotron Radiation Facility +# Copyright (c) 2014-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -30,11 +30,11 @@ __date__ = "25/07/2016" import logging +import weakref import numpy -from . import gl -from .Context import getGLContext +from . import Context, gl _logger = logging.getLogger(__name__) @@ -61,7 +61,7 @@ class Program(object): self._vertexShader = vertexShader self._fragmentShader = fragmentShader self._attrib0 = attrib0 - self._programs = {} + self._programs = weakref.WeakKeyDictionary() @staticmethod def _compileGL(vertexShader, fragmentShader, attrib0): @@ -106,7 +106,7 @@ class Program(object): return program, attributes, uniforms def _getProgramInfo(self): - glcontext = getGLContext() + glcontext = Context.getCurrent() if glcontext not in self._programs: raise RuntimeError( "Program was not compiled for current OpenGL context.") @@ -149,7 +149,7 @@ class Program(object): def use(self): """Make use of the program, compiling it if necessary""" - glcontext = getGLContext() + glcontext = Context.getCurrent() if glcontext not in self._programs: self._programs[glcontext] = self._compileGL( |