5#ifndef INCLUDE_FIFECHAN_BACKENDS_OPENGL_IMAGE_HPP_
6#define INCLUDE_FIFECHAN_BACKENDS_OPENGL_IMAGE_HPP_
13 #include <OpenGL/gl.h>
22#include "fifechan/color.hpp"
23#include "fifechan/image.hpp"
24#include "fifechan/platform.hpp"
63 Image(GLuint textureHandle,
int width,
int height,
bool autoFree);
Abstract holder for image data.
OpenGL-specific implementation of Image.
int getWidth() const override
Gets the width of the image.
bool mAutoFree
Whether the texture handle should be freed on destruction.
int getHeight() const override
Gets the height of the image.
void free() override
Frees an image.
void convertToDisplayFormat() override
Converts the image, if possible, to display format.
int mWidth
Logical image width in pixels.
virtual GLuint getTextureHandle() const
Gets the OpenGL texture handle for the image.
virtual int getTextureWidth() const
Gets the width of texture.
void putPixel(int x, int y, Color const &color) override
Puts a pixel with a certain color at coordinate (x, y).
int mTextureHeight
Actual texture height (power-of-two) used by GL.
Color getPixel(int x, int y) override
Gets the color of a pixel at coordinate (x, y) in the image.
GLuint mTextureHandle
OpenGL texture handle backing this image (if any).
int mTextureWidth
Actual texture width (power-of-two) used by GL.
Image(std::span< unsigned int const > pixels, int width, int height, bool convertToDisplayFormat=true)
Constructor.
virtual int getTextureHeight() const
Gets the height of the texture.
std::vector< unsigned int > mPixels
Pixel buffer copy for the image (RGBA packed).
int mHeight
Logical image height in pixels.