func (c *Context) createTexture(width int, height int) uint32 {
	var id uint32
	c.api.GenTextures(1, &id)
	c.api.BindTexture(texture2D, id)
	c.api.TexImage2D(
		texture2D,
		0,
		rgba,
		int32(width),
		int32(height),
		0,
		rgba,
		unsignedByte,
		c.api.Ptr(nil),
	)
	c.api.TexParameteri(texture2D, textureMinFilter, nearest)
	c.api.TexParameteri(texture2D, textureMagFilter, nearest)
	c.api.TexParameteri(texture2D, textureWrapS, clampToBorder)
	c.api.TexParameteri(texture2D, textureWrapT, clampToBorder)
	return id
}
FIXME resize image (internally) if OpenGL does support only a power-of-two dimensions.
package gl
import (
	"fmt"
	"github.com/jacekolszak/pixiq/image"
)
func (c *Context) NewAcceleratedImage(width, height int) *AcceleratedImage {
	if width < 0 {
		panic("negative width")
	}
	if height < 0 {
		panic("negative height")
	}
	if width > c.capabilities.maxTextureSize {
		panic(fmt.Sprintf("width higher than MAX_TEXTURE_SIZE (%d pixels)", c.capabilities.maxTextureSize))
	}
	if height > c.capabilities.maxTextureSize {
		panic(fmt.Sprintf("height higher than MAX_TEXTURE_SIZE (%d pixels)", c.capabilities.maxTextureSize))
	}
	textureID := c.createTexture(width, height)
	frameBufferID := c.createTextureFramebuffer(textureID)
	img := &AcceleratedImage{
		textureID:     textureID,
		frameBufferID: frameBufferID,
		width:         width,
		height:        height,
		api:           c.api,
	}
	c.allImages[img] = img
	img.onDelete = func() {
		delete(c.allImages, img)
	}
	clearWithTransparentColor := c.NewClearCommand()
	clearWithTransparentColor.Run(img.wholeSelection(), []image.AcceleratedImageSelection{})
	return img
}