openMSX
GLTVScaler.cc
Go to the documentation of this file.
1#include "GLTVScaler.hh"
2#include "RenderSettings.hh"
3
4namespace openmsx {
5
7 : GLScaler("tv")
8 , renderSettings(renderSettings_)
9{
10 for (auto i : xrange(2)) {
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
Abstract base class for OpenGL scalers.
Definition GLScaler.hh:16
void setup(bool superImpose)
Setup scaler.
Definition GLScaler.cc:40
std::array< gl::ShaderProgram, 2 > program
Definition GLScaler.hh:85
void execute(const gl::ColorTexture &src, const 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:48
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
GLTVScaler(RenderSettings &renderSettings)
Definition GLTVScaler.cc:6
Class containing all settings for renderers.
float getScanlineGap() const
The amount of space [0..1] between scanlines.
This file implemented 3 utility functions:
Definition Autofire.cc:11
constexpr auto xrange(T e)
Definition xrange.hh:132