openMSX
Classes | Typedefs | Functions | Variables
gl Namespace Reference

Classes

class  BufferObject
 
class  ColorTexture
 
struct  Context
 
class  FragmentShader
 Wrapper around an OpenGL fragment shader: a program executed on the GPU that computes the colors of pixels. More...
 
class  FrameBufferObject
 
class  matMxN
 
struct  Null
 
class  PixelBuffer
 Wrapper around a pixel buffer. More...
 
class  Shader
 Wrapper around an OpenGL shader: a program executed on the GPU. More...
 
class  ShaderProgram
 Wrapper around an OpenGL program: a collection of vertex and fragment shaders. More...
 
class  Texture
 Most basic/generic texture: only contains a texture ID. More...
 
class  vecN
 
class  vecN< 2, T >
 
class  vecN< 3, T >
 
class  vecN< 4, T >
 
class  VertexShader
 Wrapper around an OpenGL vertex shader: a program executed on the GPU that computes per-vertex stuff. More...
 

Typedefs

using mat2 = matMxN< 2, 2, float >
 
using mat3 = matMxN< 3, 3, float >
 
using mat4 = matMxN< 4, 4, float >
 
using vec2 = vecN< 2, float >
 
using vec3 = vecN< 3, float >
 
using vec4 = vecN< 4, float >
 
using ivec2 = vecN< 2, int >
 
using ivec3 = vecN< 3, int >
 
using ivec4 = vecN< 4, int >
 

Functions

template<int M, int N, typename T >
constexpr matMxN< M, N, T > operator+ (const matMxN< M, N, T > &A, const matMxN< M, N, T > &B)
 
template<int M, int N, typename T >
constexpr matMxN< M, N, T > operator- (const matMxN< M, N, T > &A, const matMxN< M, N, T > &B)
 
template<int M, int N, typename T >
constexpr matMxN< M, N, T > operator- (const matMxN< M, N, T > &A)
 
template<int M, int N, typename T >
constexpr matMxN< M, N, T > operator* (T x, const matMxN< M, N, T > &A)
 
template<int M, int N, typename T >
constexpr matMxN< M, N, T > operator* (const matMxN< M, N, T > &A, T x)
 
template<int M, int N, typename T >
constexpr vecN< M, T > operator* (const matMxN< M, N, T > &A, const vecN< N, T > &x)
 
template<int M, int N, int O, typename T >
constexpr matMxN< M, O, T > operator* (const matMxN< M, N, T > &A, const matMxN< N, O, T > &B)
 
template<int M, int N, typename T >
constexpr matMxN< N, M, T > transpose (const matMxN< M, N, T > &A)
 
template<typename T >
constexpr T determinant (const matMxN< 2, 2, T > &A)
 
template<typename T >
constexpr T determinant (const matMxN< 3, 3, T > &A)
 
template<typename T >
constexpr T determinant (const matMxN< 4, 4, T > &A)
 
template<typename T >
constexpr matMxN< 2, 2, T > inverse (const matMxN< 2, 2, T > &A)
 
template<typename T >
constexpr matMxN< 3, 3, T > inverse (const matMxN< 3, 3, T > &A)
 
template<typename T >
constexpr matMxN< 4, 4, T > inverse (const matMxN< 4, 4, T > &A)
 
template<int M, int N, typename T >
constexpr T norm2_2 (const matMxN< M, N, T > &A)
 
template<int M, int N, typename T >
std::ostream & operator<< (std::ostream &os, const matMxN< M, N, T > &A)
 
constexpr mat4 scale (const vec3 &xyz)
 
constexpr mat4 scale (const mat4 &A, const vec3 &xyz)
 
constexpr mat4 translate (const vec3 &xyz)
 
constexpr mat4 translate (mat4 &A, const vec3 &xyz)
 
mat4 rotate (float angle, const vec3 &axis)
 
mat4 rotate (const mat4 &A, float angle, const vec3 &axis)
 
mat4 rotateX (float angle)
 
mat4 rotateX (const mat4 &A, float angle)
 
mat4 rotateY (float angle)
 
mat4 rotateY (const mat4 &A, float angle)
 
mat4 rotateZ (float angle)
 
mat4 rotateZ (const mat4 &A, float angle)
 
constexpr mat4 ortho (float left, float right, float bottom, float top, float nearVal, float farVal)
 
constexpr mat4 ortho (float width, float height)
 
constexpr mat4 frustum (float left, float right, float bottom, float top, float nearVal, float farVal)
 
float rsqrt (float x)
 
double rsqrt (double x)
 
template<typename T >
constexpr T radians (T d)
 
template<typename T >
constexpr T degrees (T r)
 
template<int N, typename T >
constexpr vecN< N, T > operator- (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr vecN< N, T > operator+ (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > operator- (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > operator* (T x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > operator* (const vecN< N, T > &x, T y)
 
template<int N, typename T >
constexpr vecN< N, T > operator* (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > recip (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr vecN< N, T > operator/ (T x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > operator/ (const vecN< N, T > &x, T y)
 
template<int N, typename T >
constexpr vecN< N, T > operator/ (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > min (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr T min_component (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr vecN< N, T > max (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > clamp (const vecN< N, T > &x, const vecN< N, T > &minVal, const vecN< N, T > &maxVal)
 
template<int N, typename T >
constexpr vecN< N, T > clamp (const vecN< N, T > &x, T minVal, T maxVal)
 
template<int N, typename T >
constexpr T sum (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr vecN< N, T > sum_broadcast (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr T dot (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr vecN< N, T > dot_broadcast (const vecN< N, T > &x, const vecN< N, T > &y)
 
template<int N, typename T >
constexpr T length2 (const vecN< N, T > &x)
 
template<int N, typename T >
length (const vecN< N, T > &x)
 
template<int N, typename T >
vecN< N, T > normalize (const vecN< N, T > &x)
 
template<typename T >
constexpr vecN< 3, T > cross (const vecN< 3, T > &a, const vecN< 3, T > &b)
 
template<int N, typename T >
vecN< N, int > round (const vecN< N, T > &x)
 
template<int N, typename T >
constexpr vecN< N, int > trunc (const vecN< N, T > &x)
 
template<int N, typename T >
std::ostream & operator<< (std::ostream &os, const vecN< N, T > &x)
 
void checkGLError (std::string_view prefix)
 

Variables

std::optional< Contextcontext
 

Typedef Documentation

◆ ivec2

using gl::ivec2 = typedef vecN<2, int>

Definition at line 181 of file gl_vec.hh.

◆ ivec3

using gl::ivec3 = typedef vecN<3, int>

Definition at line 182 of file gl_vec.hh.

◆ ivec4

using gl::ivec4 = typedef vecN<4, int>

Definition at line 183 of file gl_vec.hh.

◆ mat2

using gl::mat2 = typedef matMxN<2, 2, float>

Definition at line 118 of file gl_mat.hh.

◆ mat3

using gl::mat3 = typedef matMxN<3, 3, float>

Definition at line 119 of file gl_mat.hh.

◆ mat4

using gl::mat4 = typedef matMxN<4, 4, float>

Definition at line 120 of file gl_mat.hh.

◆ vec2

using gl::vec2 = typedef vecN<2, float>

Definition at line 178 of file gl_vec.hh.

◆ vec3

using gl::vec3 = typedef vecN<3, float>

Definition at line 179 of file gl_vec.hh.

◆ vec4

using gl::vec4 = typedef vecN<4, float>

Definition at line 180 of file gl_vec.hh.

Function Documentation

◆ checkGLError()

void gl::checkGLError ( std::string_view  prefix)

Definition at line 19 of file GLUtil.cc.

◆ clamp() [1/2]

template<int N, typename T >
constexpr vecN< N, T > gl::clamp ( const vecN< N, T > &  x,
const vecN< N, T > &  minVal,
const vecN< N, T > &  maxVal 
)
constexpr

Definition at line 329 of file gl_vec.hh.

References max(), and min().

Referenced by clamp(), and TEST_CASE().

◆ clamp() [2/2]

template<int N, typename T >
constexpr vecN< N, T > gl::clamp ( const vecN< N, T > &  x,
minVal,
maxVal 
)
constexpr

Definition at line 336 of file gl_vec.hh.

References clamp().

◆ cross()

template<typename T >
constexpr vecN< 3, T > gl::cross ( const vecN< 3, T > &  a,
const vecN< 3, T > &  b 
)
constexpr

Definition at line 390 of file gl_vec.hh.

◆ degrees()

template<typename T >
constexpr T gl::degrees ( r)
constexpr

Definition at line 210 of file gl_vec.hh.

References Math::pi.

Referenced by TEST_CASE().

◆ determinant() [1/3]

template<typename T >
constexpr T gl::determinant ( const matMxN< 2, 2, T > &  A)
constexpr

Definition at line 201 of file gl_mat.hh.

Referenced by inverse(), inverse(), and TEST_CASE().

◆ determinant() [2/3]

template<typename T >
constexpr T gl::determinant ( const matMxN< 3, 3, T > &  A)
constexpr

Definition at line 208 of file gl_mat.hh.

◆ determinant() [3/3]

template<typename T >
constexpr T gl::determinant ( const matMxN< 4, 4, T > &  A)
constexpr

Definition at line 217 of file gl_mat.hh.

References dot().

◆ dot()

template<int N, typename T >
constexpr T gl::dot ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 357 of file gl_vec.hh.

References sum().

Referenced by determinant(), inverse(), length2(), and TEST_CASE().

◆ dot_broadcast()

template<int N, typename T >
constexpr vecN< N, T > gl::dot_broadcast ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 362 of file gl_vec.hh.

References sum_broadcast().

Referenced by TEST_CASE().

◆ frustum()

constexpr mat4 gl::frustum ( float  left,
float  right,
float  bottom,
float  top,
float  nearVal,
float  farVal 
)
constexpr

Definition at line 197 of file gl_transform.hh.

Referenced by TEST_CASE().

◆ inverse() [1/3]

template<typename T >
constexpr matMxN< 2, 2, T > gl::inverse ( const matMxN< 2, 2, T > &  A)
constexpr

Definition at line 235 of file gl_mat.hh.

References determinant().

Referenced by inverse(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ inverse() [2/3]

template<typename T >
constexpr matMxN< 3, 3, T > gl::inverse ( const matMxN< 3, 3, T > &  A)
constexpr

Definition at line 244 of file gl_mat.hh.

References determinant().

◆ inverse() [3/3]

template<typename T >
constexpr matMxN< 4, 4, T > gl::inverse ( const matMxN< 4, 4, T > &  A)
constexpr

Definition at line 261 of file gl_mat.hh.

References dot(), i3, and inverse().

◆ length()

template<int N, typename T >
T gl::length ( const vecN< N, T > &  x)
inline

Definition at line 376 of file gl_vec.hh.

References length2().

Referenced by TEST_CASE(), and TEST_CASE().

◆ length2()

template<int N, typename T >
constexpr T gl::length2 ( const vecN< N, T > &  x)
constexpr

Definition at line 369 of file gl_vec.hh.

References dot().

Referenced by approxEq(), length(), and normalize().

◆ max()

template<int N, typename T >
constexpr vecN< N, T > gl::max ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 320 of file gl_vec.hh.

References xrange().

Referenced by clamp(), and TEST_CASE().

◆ min()

template<int N, typename T >
constexpr vecN< N, T > gl::min ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 302 of file gl_vec.hh.

References xrange().

Referenced by clamp(), and TEST_CASE().

◆ min_component()

template<int N, typename T >
constexpr T gl::min_component ( const vecN< N, T > &  x)
constexpr

Definition at line 311 of file gl_vec.hh.

References xrange().

Referenced by TEST_CASE().

◆ norm2_2()

template<int M, int N, typename T >
constexpr T gl::norm2_2 ( const matMxN< M, N, T > &  A)
constexpr

Definition at line 318 of file gl_mat.hh.

References sum(), t, and xrange().

Referenced by TEST_CASE().

◆ normalize()

template<int N, typename T >
vecN< N, T > gl::normalize ( const vecN< N, T > &  x)
inline

Definition at line 383 of file gl_vec.hh.

References length2(), and rsqrt().

Referenced by TEST_CASE(), and TEST_CASE().

◆ operator*() [1/7]

template<int M, int N, int O, typename T >
constexpr matMxN< M, O, T > gl::operator* ( const matMxN< M, N, T > &  A,
const matMxN< N, O, T > &  B 
)
constexpr

Definition at line 179 of file gl_mat.hh.

References xrange().

◆ operator*() [2/7]

template<int M, int N, typename T >
constexpr vecN< M, T > gl::operator* ( const matMxN< M, N, T > &  A,
const vecN< N, T > &  x 
)
constexpr

Definition at line 170 of file gl_mat.hh.

References xrange().

◆ operator*() [3/7]

template<int M, int N, typename T >
constexpr matMxN< M, N, T > gl::operator* ( const matMxN< M, N, T > &  A,
x 
)
constexpr

Definition at line 161 of file gl_mat.hh.

References xrange().

◆ operator*() [4/7]

template<int N, typename T >
constexpr vecN< N, T > gl::operator* ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 263 of file gl_vec.hh.

References xrange().

◆ operator*() [5/7]

template<int N, typename T >
constexpr vecN< N, T > gl::operator* ( const vecN< N, T > &  x,
y 
)
constexpr

Definition at line 254 of file gl_vec.hh.

References xrange().

◆ operator*() [6/7]

template<int M, int N, typename T >
constexpr matMxN< M, N, T > gl::operator* ( x,
const matMxN< M, N, T > &  A 
)
constexpr

Definition at line 152 of file gl_mat.hh.

References xrange().

◆ operator*() [7/7]

template<int N, typename T >
constexpr vecN< N, T > gl::operator* ( x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 245 of file gl_vec.hh.

References xrange().

◆ operator+() [1/2]

template<int M, int N, typename T >
constexpr matMxN< M, N, T > gl::operator+ ( const matMxN< M, N, T > &  A,
const matMxN< M, N, T > &  B 
)
constexpr

Definition at line 127 of file gl_mat.hh.

References xrange().

◆ operator+() [2/2]

template<int N, typename T >
constexpr vecN< N, T > gl::operator+ ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 227 of file gl_vec.hh.

References xrange().

◆ operator-() [1/4]

template<int M, int N, typename T >
constexpr matMxN< M, N, T > gl::operator- ( const matMxN< M, N, T > &  A)
constexpr

Definition at line 145 of file gl_mat.hh.

◆ operator-() [2/4]

template<int M, int N, typename T >
constexpr matMxN< M, N, T > gl::operator- ( const matMxN< M, N, T > &  A,
const matMxN< M, N, T > &  B 
)
constexpr

Definition at line 136 of file gl_mat.hh.

References xrange().

◆ operator-() [3/4]

template<int N, typename T >
constexpr vecN< N, T > gl::operator- ( const vecN< N, T > &  x)
constexpr

Definition at line 220 of file gl_vec.hh.

◆ operator-() [4/4]

template<int N, typename T >
constexpr vecN< N, T > gl::operator- ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 236 of file gl_vec.hh.

References xrange().

◆ operator/() [1/3]

template<int N, typename T >
constexpr vecN< N, T > gl::operator/ ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 295 of file gl_vec.hh.

References recip().

◆ operator/() [2/3]

template<int N, typename T >
constexpr vecN< N, T > gl::operator/ ( const vecN< N, T > &  x,
y 
)
constexpr

Definition at line 288 of file gl_vec.hh.

◆ operator/() [3/3]

template<int N, typename T >
constexpr vecN< N, T > gl::operator/ ( x,
const vecN< N, T > &  y 
)
constexpr

Definition at line 281 of file gl_vec.hh.

References recip().

◆ operator<<() [1/2]

template<int M, int N, typename T >
std::ostream & gl::operator<< ( std::ostream &  os,
const matMxN< M, N, T > &  A 
)

Definition at line 327 of file gl_mat.hh.

References xrange().

◆ operator<<() [2/2]

template<int N, typename T >
std::ostream & gl::operator<< ( std::ostream &  os,
const vecN< N, T > &  x 
)

Definition at line 420 of file gl_vec.hh.

References xrange().

◆ ortho() [1/2]

constexpr mat4 gl::ortho ( float  left,
float  right,
float  bottom,
float  top,
float  nearVal,
float  farVal 
)
constexpr

Definition at line 169 of file gl_transform.hh.

Referenced by gl::Context::setupMvpMatrix(), and TEST_CASE().

◆ ortho() [2/2]

constexpr mat4 gl::ortho ( float  width,
float  height 
)
constexpr

Definition at line 187 of file gl_transform.hh.

◆ radians()

template<typename T >
constexpr T gl::radians ( d)
constexpr

Definition at line 206 of file gl_vec.hh.

References Math::pi.

Referenced by TEST_CASE(), and TEST_CASE().

◆ recip()

template<int N, typename T >
constexpr vecN< N, T > gl::recip ( const vecN< N, T > &  x)
constexpr

Definition at line 272 of file gl_vec.hh.

References xrange().

Referenced by operator/(), and operator/().

◆ rotate() [1/2]

mat4 gl::rotate ( const mat4 A,
float  angle,
const vec3 axis 
)
inline

Definition at line 84 of file gl_transform.hh.

References rotate().

◆ rotate() [2/2]

mat4 gl::rotate ( float  angle,
const vec3 axis 
)
inline

Definition at line 58 of file gl_transform.hh.

Referenced by rotate(), and TEST_CASE().

◆ rotateX() [1/2]

mat4 gl::rotateX ( const mat4 A,
float  angle 
)
inline

Definition at line 105 of file gl_transform.hh.

◆ rotateX() [2/2]

mat4 gl::rotateX ( float  angle)
inline

Definition at line 93 of file gl_transform.hh.

Referenced by TEST_CASE().

◆ rotateY() [1/2]

mat4 gl::rotateY ( const mat4 A,
float  angle 
)
inline

Definition at line 130 of file gl_transform.hh.

◆ rotateY() [2/2]

mat4 gl::rotateY ( float  angle)
inline

Definition at line 118 of file gl_transform.hh.

Referenced by TEST_CASE().

◆ rotateZ() [1/2]

mat4 gl::rotateZ ( const mat4 A,
float  angle 
)
inline

Definition at line 155 of file gl_transform.hh.

◆ rotateZ() [2/2]

mat4 gl::rotateZ ( float  angle)
inline

Definition at line 143 of file gl_transform.hh.

Referenced by TEST_CASE().

◆ round()

template<int N, typename T >
vecN< N, int > gl::round ( const vecN< N, T > &  x)
inline

Definition at line 399 of file gl_vec.hh.

References xrange().

Referenced by TEST_CASE().

◆ rsqrt() [1/2]

double gl::rsqrt ( double  x)
inline

Definition at line 200 of file gl_vec.hh.

◆ rsqrt() [2/2]

float gl::rsqrt ( float  x)
inline

Definition at line 196 of file gl_vec.hh.

Referenced by normalize(), and TEST_CASE().

◆ scale() [1/2]

constexpr mat4 gl::scale ( const mat4 A,
const vec3 xyz 
)
constexpr

Definition at line 26 of file gl_transform.hh.

◆ scale() [2/2]

constexpr mat4 gl::scale ( const vec3 xyz)
constexpr

Definition at line 19 of file gl_transform.hh.

Referenced by openmsx::GLScopedClip::GLScopedClip(), TEST_CASE(), and TEST_CASE().

◆ sum()

template<int N, typename T >
constexpr T gl::sum ( const vecN< N, T > &  x)
constexpr

Definition at line 343 of file gl_vec.hh.

References xrange().

Referenced by dot(), norm2_2(), sum_broadcast(), and TEST_CASE().

◆ sum_broadcast()

template<int N, typename T >
constexpr vecN< N, T > gl::sum_broadcast ( const vecN< N, T > &  x)
constexpr

Definition at line 350 of file gl_vec.hh.

References sum().

Referenced by dot_broadcast(), and TEST_CASE().

◆ translate() [1/2]

constexpr mat4 gl::translate ( const vec3 xyz)
constexpr

Definition at line 36 of file gl_transform.hh.

Referenced by TEST_CASE(), and TEST_CASE().

◆ translate() [2/2]

constexpr mat4 gl::translate ( mat4 A,
const vec3 xyz 
)
constexpr

Definition at line 45 of file gl_transform.hh.

◆ transpose()

template<int M, int N, typename T >
constexpr matMxN< N, M, T > gl::transpose ( const matMxN< M, N, T > &  A)
constexpr

Definition at line 188 of file gl_mat.hh.

References xrange().

Referenced by TEST_CASE(), and TEST_CASE().

◆ trunc()

template<int N, typename T >
constexpr vecN< N, int > gl::trunc ( const vecN< N, T > &  x)
constexpr

Definition at line 411 of file gl_vec.hh.

References xrange().

Referenced by openmsx::GLImage::GLImage(), and TEST_CASE().

Variable Documentation

◆ context

std::optional< Context > gl::context