openMSX
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
openmsx::GLScaler Class Referenceabstract

Abstract base class for OpenGL scalers. More...

#include <GLScaler.hh>

Inheritance diagram for openmsx::GLScaler:
Inheritance graph
[legend]
Collaboration diagram for openmsx::GLScaler:
Collaboration graph
[legend]

Public Member Functions

virtual ~GLScaler ()=default
 
void setup (bool superImpose)
 Setup scaler.
 
virtual void scaleImage (gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight)=0
 Scales the image in the given area, which must consist of lines which are all equally wide.
 
virtual void uploadBlock (unsigned srcStartY, unsigned srcEndY, unsigned lineWidth, FrameSource &paintFrame)
 

Protected Member Functions

 GLScaler (const std::string &progName)
 
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.
 

Protected Attributes

std::array< gl::BufferObject, 2 > vbo
 
std::array< gl::ShaderProgram, 2 > program
 
std::array< GLint, 2 > unifTexSize
 
std::array< GLint, 2 > unifMvpMatrix
 

Detailed Description

Abstract base class for OpenGL scalers.

A scaler is an algorithm that converts low-res graphics to hi-res graphics.

Definition at line 15 of file GLScaler.hh.

Constructor & Destructor Documentation

◆ ~GLScaler()

virtual openmsx::GLScaler::~GLScaler ( )
virtualdefault

◆ GLScaler()

openmsx::GLScaler::GLScaler ( const std::string &  progName)
explicitprotected

Definition at line 13 of file GLScaler.cc.

References program, tmpStrCat(), unifMvpMatrix, unifTexSize, and xrange().

Member Function Documentation

◆ execute()

void openmsx::GLScaler::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 
)
protected

Helper method to draw a rectangle with multiple texture coordinates.

This method is similar to Texture::drawRect() but it calculates a seconds set of texture coordinates. The first tex-coords are used for the MSX texture (texture unit 0), and are calculated from src{Start,End}Y and src.getHeight(). The second set of tex-coord are used for the superimpose texture (texture unit 1) and are calculated from src{Start,End}Y and logSrcHeight.

Parameters
src
superImpose
srcStartY
srcEndY
srcWidth
dstStartY
dstEndY
dstWidth
logSrcHeight
textureFromZeroIf true, the texture coordinates of subpixels will start from zero: for example in 4x zoom the source coordinates will be 0.0, 0.25, 0.5, 0.75. If false, the texture coordinates of subpixels will be centered: for example in 4x zoom the source coordinates will be 0.125, 0.375, 0.625, 0.875.

Definition at line 48 of file GLScaler.cc.

References gl::Texture::bind(), gl::ColorTexture::getHeight(), unifTexSize, and vbo.

Referenced by openmsx::GLDefaultScaler::scaleImage(), openmsx::GLHQLiteScaler::scaleImage(), openmsx::GLHQScaler::scaleImage(), openmsx::GLRGBScaler::scaleImage(), openmsx::GLScaleNxScaler::scaleImage(), openmsx::GLSimpleScaler::scaleImage(), and openmsx::GLTVScaler::scaleImage().

◆ scaleImage()

virtual void openmsx::GLScaler::scaleImage ( gl::ColorTexture src,
gl::ColorTexture superImpose,
unsigned  srcStartY,
unsigned  srcEndY,
unsigned  srcWidth,
unsigned  dstStartY,
unsigned  dstEndY,
unsigned  dstWidth,
unsigned  logSrcHeight 
)
pure virtual

Scales the image in the given area, which must consist of lines which are all equally wide.

Scaling factor depends on the concrete scaler.

Parameters
srcSource: texture containing the frame to be scaled.
superImposeTexture containing the to-be-superimposed image (can be nullptr).
srcStartYY-coordinate of the top source line (inclusive).
srcEndYY-coordinate of the bottom source line (exclusive).
srcWidthThe number of pixels per line for the given area.
dstStartYY-coordinate of the top destination line (inclusive).
dstEndYY-coordinate of the bottom destination line (exclusive).
dstWidthThe number of pixels per line on the output screen.
logSrcHeightThe logical height of the complete src texture (actual texture height can be double as high in case of non-interlace). This is needed to translate src-Y-coordinates to superImpose-Y-coordinates.

Implemented in openmsx::GLDefaultScaler, openmsx::GLHQLiteScaler, openmsx::GLHQScaler, openmsx::GLRGBScaler, openmsx::GLScaleNxScaler, openmsx::GLSimpleScaler, and openmsx::GLTVScaler.

Referenced by openmsx::GLHQLiteScaler::scaleImage(), openmsx::GLHQScaler::scaleImage(), openmsx::GLRGBScaler::scaleImage(), openmsx::GLScaleNxScaler::scaleImage(), and openmsx::GLSimpleScaler::scaleImage().

◆ setup()

void openmsx::GLScaler::setup ( bool  superImpose)

◆ uploadBlock()

void openmsx::GLScaler::uploadBlock ( unsigned  srcStartY,
unsigned  srcEndY,
unsigned  lineWidth,
FrameSource paintFrame 
)
virtual

Reimplemented in openmsx::GLHQLiteScaler, and openmsx::GLHQScaler.

Definition at line 34 of file GLScaler.cc.

Member Data Documentation

◆ program

std::array<gl::ShaderProgram, 2> openmsx::GLScaler::program
protected

◆ unifMvpMatrix

std::array<GLint, 2> openmsx::GLScaler::unifMvpMatrix
protected

Definition at line 87 of file GLScaler.hh.

Referenced by GLScaler(), and setup().

◆ unifTexSize

std::array<GLint, 2> openmsx::GLScaler::unifTexSize
protected

Definition at line 86 of file GLScaler.hh.

Referenced by execute(), and GLScaler().

◆ vbo

std::array<gl::BufferObject, 2> openmsx::GLScaler::vbo
protected

Definition at line 84 of file GLScaler.hh.

Referenced by execute().


The documentation for this class was generated from the following files: