diff --git a/fsl/fslview/controls/locationpanel.py b/fsl/fslview/controls/locationpanel.py index 7fa3d5530de5b2c3811160adeb0f09a4c9c86904..255ce56c31d777e467a40486112672471cafcdf6 100644 --- a/fsl/fslview/controls/locationpanel.py +++ b/fsl/fslview/controls/locationpanel.py @@ -209,7 +209,9 @@ class LocationPanel(fslpanel.FSLViewPanel): return # Register a listener on the DisplayOpts - # instance of the currently selected overlay + # instance of the currently selected overlay, + # so we can update the location if the + # overlay transforms/reference image change overlay = self._displayCtx.getSelectedOverlay() for ovl in self._overlayList: display = self._displayCtx.getDisplay(ovl) diff --git a/fsl/fslview/gl/gl21/glvolume_funcs.py b/fsl/fslview/gl/gl21/glvolume_funcs.py index 28e90ece3a81dbb7fcdbb1ba4f86ec9494a8eec8..e99987dff8f5d83fec5fa60b895925cf83d4f483 100644 --- a/fsl/fslview/gl/gl21/glvolume_funcs.py +++ b/fsl/fslview/gl/gl21/glvolume_funcs.py @@ -186,10 +186,12 @@ def _prepareVertexAttributes(self, vertices, voxCoords, texCoords): gl.glVertexAttribPointer( texPos, 3, gl.GL_FLOAT, gl.GL_FALSE, 36, ctypes.c_void_p(24)) - # The fast shader does not use voxel coordinates - # so, on some GL drivers, attempting to bind it - # will cause an error - if not self.display.softwareMode: + # The sw shader does not use voxel coordinates + # so attempting to binding would raise an error. + # So we only attempt to bind if softwareMode is + # false, and there is a shader uniform position + # for the voxel coordinates available. + if not self.display.softwareMode and voxPos != -1: gl.glVertexAttribPointer( voxPos, 3, gl.GL_FLOAT, gl.GL_FALSE, 36, ctypes.c_void_p(12)) gl.glEnableVertexAttribArray(self.voxCoordPos) @@ -245,7 +247,9 @@ def postDraw(self): gl.glDisableVertexAttribArray(self.vertexPos) gl.glDisableVertexAttribArray(self.texCoordPos) - if not self.display.softwareMode: + # See comments in _prepareVertexAttributes + # about softwareMode/voxel coordinates + if not self.display.softwareMode and self.voxCoordPos != -1: gl.glDisableVertexAttribArray(self.voxCoordPos) gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)