(self, image)
| 178 | gl.glBindTexture(gl.GL_TEXTURE_2D, prev_id) |
| 179 | |
| 180 | def update(self, image): |
| 181 | if image is not None: |
| 182 | image = prepare_texture_data(image) |
| 183 | assert self.is_compatible(image=image) |
| 184 | with self.bind(): |
| 185 | fmt = get_texture_format(self.dtype, self.channels) |
| 186 | gl.glPushClientAttrib(gl.GL_CLIENT_PIXEL_STORE_BIT) |
| 187 | gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, 1) |
| 188 | gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, fmt.internalformat, self.width, self.height, 0, fmt.format, fmt.type, image) |
| 189 | if self.mipmap: |
| 190 | gl.glGenerateMipmap(gl.GL_TEXTURE_2D) |
| 191 | gl.glPopClientAttrib() |
| 192 | |
| 193 | def draw(self, *, pos=0, zoom=1, align=0, rint=False, color=1, alpha=1, rounding=0): |
| 194 | zoom = np.broadcast_to(np.asarray(zoom, dtype='float32'), [2]) |
no test coverage detected