
from PyQt5.QtGui import QOpenGLTexture, QImage

from UM.View.GL.Texture import Texture
from UM.View.GL.OpenGL import OpenGL

##  Texture subclass using PyQt for the OpenGL implementation.
class QtTexture(Texture):
    def __init__(self):
        super().__init__()

        self._qt_texture = QOpenGLTexture(QOpenGLTexture.Target2D)
        self._gl = OpenGL.getInstance().getBindingsObject()

    def getTextureId(self):
        return self._qt_texture.textureId()

    def bind(self, unit):
        self._qt_texture.bind(unit)

    def release(self, unit):
        self._qt_texture.release(unit)

    def load(self, file_name):
        image = QImage(file_name).mirrored()
        self._qt_texture.setData(image)


from PyQt5.QtGui import QOpenGLTexture, QImage

from UM.View.GL.Texture import Texture
from UM.View.GL.OpenGL import OpenGL

##  Texture subclass using PyQt for the OpenGL implementation.
class QtTexture(Texture):
    def __init__(self):
        super().__init__()

        self._qt_texture = QOpenGLTexture(QOpenGLTexture.Target2D)
        self._qt_texture.setMinMagFilters(QOpenGLTexture.Linear, QOpenGLTexture.Linear)
        self._gl = OpenGL.getInstance().getBindingsObject()

    def getTextureId(self):
        return self._qt_texture.textureId()

    def bind(self, unit):
        self._qt_texture.bind(unit)

    def release(self, unit):
        self._qt_texture.release(unit)

    def load(self, file_name):
        image = QImage(file_name).mirrored()
        self._qt_texture.setData(image)

Set Texture minification/magnification filters to Linear
Set Texture minification/magnification filters to Linear

This improves the quality of textures that need to be rendered at a
smaller
size.

  
  from PyQt5.QtGui import QOpenGLTexture, QImage
  
  from UM.View.GL.Texture import Texture
  from UM.View.GL.OpenGL import OpenGL
  
  ##  Texture subclass using PyQt for the OpenGL implementation.
  class QtTexture(Texture):
      def __init__(self):
          super().__init__()
  
          self._qt_texture = QOpenGLTexture(QOpenGLTexture.Target2D)
+         self._qt_texture.setMinMagFilters(QOpenGLTexture.Linear, QOpenGLTexture.Linear)
          self._gl = OpenGL.getInstance().getBindingsObject()
  
      def getTextureId(self):
          return self._qt_texture.textureId()
  
      def bind(self, unit):
          self._qt_texture.bind(unit)
  
      def release(self, unit):
          self._qt_texture.release(unit)
  
      def load(self, file_name):
          image = QImage(file_name).mirrored()
          self._qt_texture.setData(image)
  
Set Texture minification/magnification filters to Linear
## Code Before:

from PyQt5.QtGui import QOpenGLTexture, QImage

from UM.View.GL.Texture import Texture
from UM.View.GL.OpenGL import OpenGL

##  Texture subclass using PyQt for the OpenGL implementation.
class QtTexture(Texture):
    def __init__(self):
        super().__init__()

        self._qt_texture = QOpenGLTexture(QOpenGLTexture.Target2D)
        self._gl = OpenGL.getInstance().getBindingsObject()

    def getTextureId(self):
        return self._qt_texture.textureId()

    def bind(self, unit):
        self._qt_texture.bind(unit)

    def release(self, unit):
        self._qt_texture.release(unit)

    def load(self, file_name):
        image = QImage(file_name).mirrored()
        self._qt_texture.setData(image)

## Instruction:
Set Texture minification/magnification filters to Linear
## Code After:

from PyQt5.QtGui import QOpenGLTexture, QImage

from UM.View.GL.Texture import Texture
from UM.View.GL.OpenGL import OpenGL

##  Texture subclass using PyQt for the OpenGL implementation.
class QtTexture(Texture):
    def __init__(self):
        super().__init__()

        self._qt_texture = QOpenGLTexture(QOpenGLTexture.Target2D)
        self._qt_texture.setMinMagFilters(QOpenGLTexture.Linear, QOpenGLTexture.Linear)
        self._gl = OpenGL.getInstance().getBindingsObject()

    def getTextureId(self):
        return self._qt_texture.textureId()

    def bind(self, unit):
        self._qt_texture.bind(unit)

    def release(self, unit):
        self._qt_texture.release(unit)

    def load(self, file_name):
        image = QImage(file_name).mirrored()
        self._qt_texture.setData(image)
