mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Attempted to deal with the precision issues causing 'television' output currently to differ from 'monitor' output. Documented TextureTarget while I'm here.
This commit is contained in:
parent
6f52ed14d6
commit
20aa9e291d
@ -229,6 +229,7 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
}
|
||||
|
||||
// transfer to screen
|
||||
glFinish();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
|
||||
compositeTexture->bind_texture();
|
||||
perform_output_stage(output_width, output_height, composite_output_shader_program.get());
|
||||
@ -362,12 +363,12 @@ char *OpenGLOutputBuilder::get_input_vertex_shader()
|
||||
"{"
|
||||
"ivec2 textureSize = textureSize(texID, 0);"
|
||||
"iInputPositionVarying = inputPosition;"
|
||||
"inputPositionVarying = inputPosition / vec2(textureSize);" // + 0.5
|
||||
"inputPositionVarying = (inputPosition + vec2(0.0, 0.5)) / vec2(textureSize);"
|
||||
|
||||
"phaseVarying = (phaseCyclesPerTick * phaseTime + phaseAmplitudeAndAlpha.x) * 2.0 * 3.141592654;"
|
||||
"alphaVarying = phaseAmplitudeAndAlpha.z;"
|
||||
|
||||
"vec2 eyePosition = 2.0*(outputPosition / outputTextureSize) - vec2(1.0);"
|
||||
"vec2 eyePosition = 2.0*(outputPosition / outputTextureSize) - vec2(1.0) + vec2(0.5)/textureSize;"
|
||||
"gl_Position = vec4(eyePosition, 0.0, 1.0);"
|
||||
"}");
|
||||
}
|
||||
|
@ -13,12 +13,31 @@
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
/*!
|
||||
A @c TextureTarget is a framebuffer that can be bound as a texture. So this class
|
||||
handles render-to-texture framebuffer objects.
|
||||
*/
|
||||
class TextureTarget {
|
||||
public:
|
||||
/*!
|
||||
Creates a new texture target.
|
||||
|
||||
Throws ErrorFramebufferIncomplete if creation fails.
|
||||
|
||||
@param width The width of target to create.
|
||||
@param height The height of target to create.
|
||||
*/
|
||||
TextureTarget(GLsizei width, GLsizei height);
|
||||
~TextureTarget();
|
||||
|
||||
/*!
|
||||
Binds this target as a framebuffer and sets the @c glViewport accordingly.
|
||||
*/
|
||||
void bind_framebuffer();
|
||||
|
||||
/*!
|
||||
Binds this target as a texture.
|
||||
*/
|
||||
void bind_texture();
|
||||
|
||||
enum {
|
||||
|
Loading…
x
Reference in New Issue
Block a user