def __init__(self, id=None, name='TextureMap', width=1024, height=1024, data=None, mipmap=False, **kwargs):
        """2D Color Texture class. Width and height can be set, and will generate a new OpenGL texture if no id is given."""
        super(Texture, self).__init__(**kwargs)

        self._slot = next(self._slot_counter)
        if self._slot >= self.max_texture_limit:
            raise MemoryError("More Textures have been created than your graphics Hardware can handle.")
        self.name = name
        self.mipmap = mipmap

        if id != None:
            self.id = id
            self.data = data  # This is used for anything that might be garbage collected (i.e. pyglet textures)
        else:
            self.id = create_opengl_object(gl.glGenTextures)
            self.width = width
            self.height = height
            self.bind()
            self._genTex2D()
            self._apply_filter_settings()

        self.unbind()
def __init__ ( self , id = None , name = 'TextureMap' , width = 1024 , height = 1024 , data = None , mipmap = False , ** kwargs ) : super ( Texture , self ) . __init__ ( ** kwargs ) self . _slot = next ( self . _slot_counter ) if self . _slot >= self . max_texture_limit : raise MemoryError ( "More Textures have been created than your graphics Hardware can handle." ) self . name = name self . mipmap = mipmap if id != None : self . id = id self . data = data else : self . id = create_opengl_object ( gl . glGenTextures ) self . width = width self . height = height self . bind ( ) self . _genTex2D ( ) self . _apply_filter_settings ( ) self . unbind ( )
2D Color Texture class. Width and height can be set, and will generate a new OpenGL texture if no id is given.