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
(
int
width,
int
height);
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
private
:
51
std::unique_ptr<openmsx::GLScaler> fallbackScaler;
52
53
};
54
55
extern
std::optional<Context>
context
;
56
57
}
// namespace gl
58
59
#endif
GLUtil.hh
gl::ShaderProgram
Wrapper around an OpenGL program: a collection of vertex and fragment shaders.
Definition:
GLUtil.hh:387
gl::matMxN< 4, 4, float >
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:9
gl::Context
Definition:
GLContext.hh:14
gl::Context::progFill
ShaderProgram progFill
Definition:
GLContext.hh:39
gl::Context::unifTexColor
GLint unifTexColor
Definition:
GLContext.hh:30
gl::Context::unifTexMvp
GLint unifTexMvp
Definition:
GLContext.hh:31
gl::Context::Context
Context(int width, int height)
Initialize global openGL state.
Definition:
GLContext.cc:12
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:45
gl::Context::unifFillMvp
GLint unifFillMvp
Definition:
GLContext.hh:40
Generated on Mon Sep 18 2023 23:13:11 for openMSX by
1.9.4