openMSX
GLTVScaler.cc
Go to the documentation of this file.
1 #include "GLTVScaler.hh"
2 #include "RenderSettings.hh"
3 
4 namespace openmsx {
5 
7  : GLScaler("tv")
8  , renderSettings(renderSettings_)
9 {
10  for (int i = 0; i < 2; ++i) {
11  program[i].activate();
12  unifMinScanline[i] =
13  program[i].getUniformLocation("minScanline");
14  unifSizeVariance[i] =
15  program[i].getUniformLocation("sizeVariance");
16  }
17 }
18 
20  gl::ColorTexture& src, gl::ColorTexture* superImpose,
21  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
22  unsigned dstStartY, unsigned dstEndY, unsigned dstWidth,
23  unsigned logSrcHeight)
24 {
25  setup(superImpose != nullptr);
26  int i = superImpose ? 1 : 0;
27  // These are experimentally established functions that look good.
28  // By design, both are 0 for scanline 0.
29  float gap = renderSettings.getScanlineGap();
30  glUniform1f(unifMinScanline [i], 0.1f * gap + 0.2f * gap * gap);
31  glUniform1f(unifSizeVariance[i], 0.7f * gap - 0.3f * gap * gap);
32  execute(src, superImpose,
33  srcStartY, srcEndY, srcWidth,
34  dstStartY, dstEndY, dstWidth,
35  logSrcHeight, true);
36 }
37 
38 } // namespace openmsx
openmsx::GLScaler::program
gl::ShaderProgram program[2]
Definition: GLScaler.hh:78
openmsx::RenderSettings
Class containing all settings for renderers.
Definition: RenderSettings.hh:22
openmsx::RenderSettings::getScanlineGap
float getScanlineGap() const
The amount of space [0..1] between scanlines.
Definition: RenderSettings.hh:105
gl::ColorTexture
Definition: GLUtil.hh:100
gl::ShaderProgram::activate
void activate() const
Makes this program the active shader program.
Definition: GLUtil.cc:298
openmsx::GLScaler::execute
void execute(gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight, bool textureFromZero=false)
Helper method to draw a rectangle with multiple texture coordinates.
Definition: GLScaler.cc:45
openmsx::GLTVScaler::scaleImage
void scaleImage(gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight) override
Scales the image in the given area, which must consist of lines which are all equally wide.
Definition: GLTVScaler.cc:19
gl::ShaderProgram::getUniformLocation
GLint getUniformLocation(const char *name) const
Gets a reference to a uniform variable declared in the shader source.
Definition: GLUtil.cc:290
openmsx::GLScaler::setup
void setup(bool superImpose)
Definition: GLScaler.cc:39
RenderSettings.hh
openmsx::GLTVScaler::GLTVScaler
GLTVScaler(RenderSettings &renderSettings)
Definition: GLTVScaler.cc:6
openmsx::GLScaler
Abstract base class for OpenGL scalers.
Definition: GLScaler.hh:14
GLTVScaler.hh
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5