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 <cstdint>
7 #include <string>
8 
9 class SDLSurfacePtr;
10 
11 namespace openmsx {
12 
13 class GLImage final : public BaseImage
14 {
15 public:
16  GLImage(OutputSurface& output, const std::string& filename);
17  GLImage(OutputSurface& output, SDLSurfacePtr image);
18  GLImage(OutputSurface& output, const std::string& filename, float scaleFactor);
19  GLImage(OutputSurface& output, const std::string& filename, gl::ivec2 size);
20  GLImage(OutputSurface& output, gl::ivec2 size, unsigned rgba);
21  GLImage(OutputSurface& output, gl::ivec2 size, const unsigned* rgba,
22  int borderSize, unsigned borderRGBA);
23 
24  void draw(OutputSurface& output, gl::ivec2 pos,
25  uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) override;
26 
27 private:
28  void initBuffers();
29 
30  gl::VertexArray vao;
31  gl::BufferObject vbo[3];
32  gl::BufferObject elementsBuffer;
33  gl::Texture texture; // must come after size
34  int borderSize;
35  int bgA[4], borderA;
36  uint8_t bgR[4], bgG[4], bgB[4];
37  uint8_t borderR, borderG, borderB;
38 };
39 
40 } // namespace openmsx
41 
42 #endif
gl::BufferObject
Definition: GLUtil.hh:431
gl::Texture
Most basic/generic texture: only contains a texture ID.
Definition: GLUtil.hh:35
SDLSurfacePtr
Wrapper around a SDL_Surface.
Definition: SDLSurfacePtr.hh:33
BaseImage.hh
gl::vecN
Definition: gl_vec.hh:35
openmsx::BaseImage::size
gl::ivec2 size
Definition: BaseImage.hh:31
openmsx::filename
constexpr const char *const filename
Definition: FirmwareSwitch.cc:10
g
int g
Definition: ScopedAssign_test.cc:20
openmsx::GLImage
Definition: GLImage.hh:13
openmsx::GLImage::draw
void draw(OutputSurface &output, gl::ivec2 pos, uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) override
Definition: GLImage.cc:130
openmsx::BaseImage
Definition: BaseImage.hh:11
openmsx::OutputSurface
A frame buffer where pixels can be written to.
Definition: OutputSurface.hh:19
openmsx::GLImage::GLImage
GLImage(OutputSurface &output, const std::string &filename)
Definition: GLImage.cc:55
GLUtil.hh
gl::VertexArray
Definition: GLUtil.hh:452
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5