openMSX
GLContext.hh
Go to the documentation of this file.
1 #ifndef GL_CONTEXT_HH
2 #define GL_CONTEXT_HH
3 
4 #include "GLUtil.hh"
5 #include "gl_mat.hh"
6 #include <memory>
7 
8 namespace openmsx { class GLScaler; }
9 
10 namespace gl {
11 
12 struct Context
13 {
16  Context(int width, int height);
17  ~Context();
18 
19  // Simple texture program. It expects
20  // uniforms:
21  // unifTexColor: values from texture map are multiplied by this 4D color
22  // unifTexMvp: Model-View-Projection-matrix
23  // attributes:
24  // 0: 4D vertex positions, get multiplied by Model-View-Projection-matrix
25  // 1: 2D texture coordinates
26  // textures:
27  // the to be applied texture must be bound to the 1st texture unit
29  GLuint unifTexColor;
30  GLuint unifTexMvp;
31 
32  // Simple color-fill program. It expects
33  // uniforms:
34  // unifFillMvp: Model-View-Projection-matrix
35  // attributes:
36  // 0: 4D vertex positions, get multiplied by Model-View-Projection-matrix
37  // 1: 4D vertex color
39  GLuint unifFillMvp;
40 
41  // Model-View-Projection-matrix that maps integer vertex positions to host
42  // display pixel positions. (0,0) is the top-left pixel, (width-1,height-1) is
43  // the bottom-right pixel.
45 
46  // Fallback scaler
47  openmsx::GLScaler& getFallbackScaler();
48 
49 private:
50  std::unique_ptr<openmsx::GLScaler> fallbackScaler;
51 
52 };
53 
54 extern std::unique_ptr<Context> context;
55 
56 } // namespace gl
57 
58 #endif
GLuint unifFillMvp
Definition: GLContext.hh:39
mat4 pixelMvp
Definition: GLContext.hh:44
std::unique_ptr< Context > context
Definition: GLContext.cc:9
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
GLuint unifTexMvp
Definition: GLContext.hh:30
ShaderProgram progFill
Definition: GLContext.hh:38
Abstract base class for OpenGL scalers.
Definition: GLScaler.hh:13
GLuint unifTexColor
Definition: GLContext.hh:29
Wrapper around an OpenGL program: a collection of vertex and fragment shaders.
Definition: GLUtil.hh:393
ShaderProgram progTex
Definition: GLContext.hh:28
Definition: gl_mat.hh:24