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 ()
 
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. More...
 
virtual void uploadBlock (unsigned srcStartY, unsigned srcEndY, unsigned lineWidth, FrameSource &paintFrame)
 

Protected Member Functions

 GLScaler (const std::string &progName)
 
void setup (bool superImpose)
 
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. More...
 

Protected Attributes

gl::ShaderProgram program [2]
 
GLint unifTexSize [2]
 

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 13 of file GLScaler.hh.

Constructor & Destructor Documentation

virtual openmsx::GLScaler::~GLScaler ( )
inlinevirtual

Definition at line 16 of file GLScaler.hh.

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

Definition at line 10 of file GLScaler.cc.

References gl::context.

Member Function Documentation

void openmsx::GLScaler::execute ( gl::ColorTexture src,
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 (textur 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 45 of file GLScaler.cc.

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

Referenced by openmsx::GLDefaultScaler::scaleImage(), openmsx::GLSaIScaler::scaleImage(), openmsx::GLScaleNxScaler::scaleImage(), openmsx::GLHQScaler::scaleImage(), openmsx::GLHQLiteScaler::scaleImage(), openmsx::GLRGBScaler::scaleImage(), openmsx::GLSimpleScaler::scaleImage(), and openmsx::GLTVScaler::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::GLTVScaler, openmsx::GLHQLiteScaler, openmsx::GLRGBScaler, openmsx::GLSimpleScaler, openmsx::GLHQScaler, openmsx::GLDefaultScaler, openmsx::GLSaIScaler, and openmsx::GLScaleNxScaler.

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

void openmsx::GLScaler::setup ( bool  superImpose)
protected
void openmsx::GLScaler::uploadBlock ( unsigned  srcStartY,
unsigned  srcEndY,
unsigned  lineWidth,
FrameSource paintFrame 
)
virtual

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

Definition at line 33 of file GLScaler.cc.

Member Data Documentation

gl::ShaderProgram openmsx::GLScaler::program[2]
protected
GLint openmsx::GLScaler::unifTexSize[2]
protected

Definition at line 78 of file GLScaler.hh.


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