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::BufferObject vbo[3];
31  gl::BufferObject elementsBuffer;
32  gl::Texture texture; // must come after size
33  int borderSize;
34  int bgA[4], borderA;
35  uint8_t bgR[4], bgG[4], bgB[4];
36  uint8_t borderR, borderG, borderB;
37 };
38 
39 } // namespace openmsx
40 
41 #endif
gl::BufferObject
Definition: GLUtil.hh:441
gl::Texture
Most basic/generic texture: only contains a texture ID.
Definition: GLUtil.hh:41
SDLSurfacePtr
Wrapper around a SDL_Surface.
Definition: SDLSurfacePtr.hh:34
BaseImage.hh
gl::vecN
Definition: gl_vec.hh:36
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:14
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:129
openmsx::BaseImage
Definition: BaseImage.hh:12
openmsx::OutputSurface
A frame buffer where pixels can be written to.
Definition: OutputSurface.hh:20
openmsx::GLImage::GLImage
GLImage(OutputSurface &output, const std::string &filename)
Definition: GLImage.cc:55
GLUtil.hh
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5