1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Attempted to improve deinterlacing, gave the CRT full control over blend mode, switched back to 2000000Mhz audio.

This commit is contained in:
Thomas Harte 2016-04-14 22:20:47 -04:00
parent 323f1a24db
commit 104f44f27f
4 changed files with 9 additions and 8 deletions

View File

@ -32,7 +32,7 @@ namespace {
static const unsigned int real_time_clock_interrupt_1 = 16704;
static const unsigned int real_time_clock_interrupt_2 = 56704;
static const unsigned int clock_rate_audio_divider = 8;
static const unsigned int clock_rate_audio_divider = 1;
}
#define graphics_line(v) ((((v) >> 7) - first_graphics_line + field_divider_line) % field_divider_line)

View File

@ -38,9 +38,6 @@
// Activate the display link
CVDisplayLinkStart(_displayLink);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, const CVTimeStamp *outputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext)

View File

@ -49,7 +49,8 @@ const GLsizeiptr SourceVertexBufferDataSize = 87360; // a multiple of 2 * Output
// Runs are divided discretely by vertical syncs in order to put a usable bounds on the uniform used to track
// run age; that therefore creates a discrete number of fields that are stored. This number should be the
// number of historic fields that are required fully to
// number of historic fields that are required fully to complete a frame. It should be at least two and not
// more than four.
const int NumberOfFields = 4;
}

View File

@ -62,6 +62,9 @@ OpenGLOutputBuilder::OpenGLOutputBuilder(unsigned int buffer_depth) :
}
_buffer_builder = std::unique_ptr<CRTInputBufferBuilder>(new CRTInputBufferBuilder(buffer_depth));
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
// Create intermediate textures and bind to slots 0, 1 and 2
glActiveTexture(GL_TEXTURE0);
compositeTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
@ -226,11 +229,11 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
start = _run_builders[run]->start;
run = (run - 1 + NumberOfFields) % NumberOfFields;
}
glUniform4fv(timestampBaseUniform, 1, timestampBases);
if(count > 0)
{
// draw
glUniform4fv(timestampBaseUniform, 1, timestampBases);
GLsizei primitive_count = (GLsizei)(count / OutputVertexSize);
GLsizei max_count = (GLsizei)((OutputVertexBufferDataSize - start) / OutputVertexSize);
if(primitive_count < max_count)
@ -395,7 +398,7 @@ char *OpenGLOutputBuilder::get_output_vertex_shader()
"iSrcCoordinatesVarying = srcCoordinates;"
"srcCoordinatesVarying = vec2(srcCoordinates.x / textureSize.x, (srcCoordinates.y + 0.5) / textureSize.y);"
"float age = (timestampBase[int(lateralAndTimestampBaseOffset.y)] - timestamp) / ticksPerFrame;"
"alpha = 10.0 * exp(-age * 2.0);"
"alpha = exp(-age) + 0.2;"
"vec2 floatingPosition = (position / positionConversion) + lateralAndTimestampBaseOffset.x * scanNormal;"
"vec2 mappedPosition = (floatingPosition - boundsOrigin) / boundsSize;"
@ -439,7 +442,7 @@ char *OpenGLOutputBuilder::get_output_fragment_shader(const char *sampling_funct
"void main(void)"
"{"
"fragColour = vec4(rgb_sample(texID, srcCoordinatesVarying, iSrcCoordinatesVarying), alpha);" //*sin(lateralVarying)
"fragColour = vec4(rgb_sample(texID, srcCoordinatesVarying, iSrcCoordinatesVarying), clamp(alpha, 0.0, 1.0)*sin(lateralVarying));" //
"}"
, sampling_function);
}