def setup(self) -> Generator[float, None, None]:
     """Create and bind the atlas texture."""
     if self._image is None:
         atlas_iter = textureatlas.create_atlas(
             self._resource_pack.textures)
         try:
             while True:
                 yield next(atlas_iter)
         except StopIteration as e:
             (
                 self._image,
                 self._texture_bounds,
                 self._image_width,
                 self._image_height,
             ) = e.value
예제 #2
0
 def _create_atlas(self) -> Generator[float, None, None]:
     """Create and bind the atlas texture."""
     atlas_iter = textureatlas.create_atlas(self._resource_pack.textures)
     try:
         while True:
             yield next(atlas_iter)
     except StopIteration as e:
         texture_atlas, self._texture_bounds, width, height = e.value
     glBindTexture(GL_TEXTURE_2D, self._gl_texture_atlas)
     glTexImage2D(
         GL_TEXTURE_2D,
         0,
         GL_RGBA,
         width,
         height,
         0,
         GL_RGBA,
         GL_UNSIGNED_BYTE,
         texture_atlas,
     )
     glBindTexture(GL_TEXTURE_2D, 0)
     log.info("Finished setting up texture atlas in OpenGL")