openMSX
GLImage.hh
Go to the documentation of this file.
1#ifndef GLTEXTURE_HH
2#define GLTEXTURE_HH
3
4#include "BaseImage.hh"
5#include "GLUtil.hh"
6#include <array>
7#include <cstdint>
8#include <span>
9#include <string>
10
11class SDLSurfacePtr;
12
13namespace openmsx {
14
15class GLImage final : public BaseImage
16{
17public:
18 GLImage(OutputSurface& output, const std::string& filename);
20 GLImage(OutputSurface& output, const std::string& filename, float scaleFactor);
21 GLImage(OutputSurface& output, const std::string& filename, gl::ivec2 size);
22 GLImage(OutputSurface& output, gl::ivec2 size, uint32_t rgba);
23 GLImage(OutputSurface& output, gl::ivec2 size, std::span<const uint32_t, 4> rgba,
24 int borderSize, uint32_t borderRGBA);
25
26 void draw(OutputSurface& output, gl::ivec2 pos,
27 uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) override;
28
29private:
30 void initBuffers();
31
32private:
33 std::array<gl::BufferObject, 3> vbo;
34 gl::BufferObject elementsBuffer;
35 gl::Texture texture{gl::Null()}; // must come after size
36 int borderSize{0};
37 std::array<uint16_t, 4> bgA; // 0..256
38 uint16_t borderA{0}; // 0..256
39 std::array<uint8_t, 4> bgR, bgG, bgB;
40 uint8_t borderR{0}, borderG{0}, borderB{0};
41};
42
43} // namespace openmsx
44
45#endif
std::string image
Definition: HDImageCLI.cc:13
int g
Wrapper around a SDL_Surface.
Most basic/generic texture: only contains a texture ID.
Definition: GLUtil.hh:40
gl::ivec2 size
Definition: BaseImage.hh:31
void draw(OutputSurface &output, gl::ivec2 pos, uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) override
Definition: GLImage.cc:127
GLImage(OutputSurface &output, const std::string &filename)
Definition: GLImage.cc:57
A frame buffer where pixels can be written to.
This file implemented 3 utility functions:
Definition: Autofire.cc:9