openMSX
video
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
#include <optional>
8
9
namespace
openmsx
{
class
GLScaler; }
10
11
namespace
gl
{
12
13
struct
Context
14
{
17
Context
();
18
~Context
();
19
20
// Simple texture program. It expects
21
// uniforms:
22
// unifTexColor: values from texture map are multiplied by this 4D color
23
// unifTexMvp: Model-View-Projection-matrix
24
// attributes:
25
// 0: 4D vertex positions, get multiplied by Model-View-Projection-matrix
26
// 1: 2D texture coordinates
27
// textures:
28
// the to be applied texture must be bound to the 1st texture unit
29
ShaderProgram
progTex
;
30
GLint
unifTexColor
;
31
GLint
unifTexMvp
;
32
33
// Simple color-fill program. It expects
34
// uniforms:
35
// unifFillMvp: Model-View-Projection-matrix
36
// attributes:
37
// 0: 4D vertex positions, get multiplied by Model-View-Projection-matrix
38
// 1: 4D vertex color
39
ShaderProgram
progFill
;
40
GLint
unifFillMvp
;
41
42
// Model-View-Projection-matrix that maps integer vertex positions to host
43
// display pixel positions. (0,0) is the top-left pixel, (width-1,height-1) is
44
// the bottom-right pixel.
45
mat4
pixelMvp
;
46
47
// Fallback scaler
48
openmsx::GLScaler
&
getFallbackScaler
();
49
50
// Setup model-view-projection matrix. Should be called before drawing,
51
// at least once after the window resolution has changed. (E.g. call it
52
// once per frame).
53
void
setupMvpMatrix
(
gl::vec2
logicalSize);
54
55
private
:
56
std::unique_ptr<openmsx::GLScaler> fallbackScaler;
57
};
58
59
extern
std::optional<Context>
context
;
60
61
}
// namespace gl
62
63
#endif
GLUtil.hh
gl::ShaderProgram
Wrapper around an OpenGL program: a collection of vertex and fragment shaders.
Definition
GLUtil.hh:363
gl::matMxN< 4, 4, float >
gl::vecN
Definition
gl_vec.hh:32
openmsx::GLScaler
Abstract base class for OpenGL scalers.
Definition
GLScaler.hh:16
gl_mat.hh
gl
Definition
gl_mat.hh:23
gl::context
std::optional< Context > context
Definition
GLContext.cc:10
openmsx
This file implemented 3 utility functions:
Definition
Autofire.cc:11
gl::Context
Definition
GLContext.hh:14
gl::Context::Context
Context()
Initialize global openGL state.
Definition
GLContext.cc:12
gl::Context::progFill
ShaderProgram progFill
Definition
GLContext.hh:39
gl::Context::unifTexColor
GLint unifTexColor
Definition
GLContext.hh:30
gl::Context::setupMvpMatrix
void setupMvpMatrix(gl::vec2 logicalSize)
Definition
GLContext.cc:49
gl::Context::unifTexMvp
GLint unifTexMvp
Definition
GLContext.hh:31
gl::Context::progTex
ShaderProgram progTex
Definition
GLContext.hh:29
gl::Context::~Context
~Context()
gl::Context::pixelMvp
mat4 pixelMvp
Definition
GLContext.hh:45
gl::Context::getFallbackScaler
openmsx::GLScaler & getFallbackScaler()
Definition
GLContext.cc:41
gl::Context::unifFillMvp
GLint unifFillMvp
Definition
GLContext.hh:40
Generated on Thu Dec 19 2024 23:13:46 for openMSX by
1.9.8