1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Increased brightness in television mode, added a clear if screen resolution changes.

This commit is contained in:
Thomas Harte 2016-04-28 22:04:47 -04:00
parent 3638414b37
commit 23ea832f41
3 changed files with 17 additions and 15 deletions

View File

@ -93,7 +93,9 @@ OpenGLOutputBuilder::OpenGLOutputBuilder(unsigned int buffer_depth) :
_output_buffer_data_pointer(0),
_drawn_output_buffer_data_pointer(0),
_source_buffer_data_pointer(0),
_drawn_source_buffer_data_pointer(0)
_drawn_source_buffer_data_pointer(0),
_last_output_width(0),
_last_output_height(0)
{
_buffer_builder = std::unique_ptr<CRTInputBufferBuilder>(new CRTInputBufferBuilder(buffer_depth));
@ -315,9 +317,6 @@ void OpenGLOutputBuilder::perform_output_stage(unsigned int output_width, unsign
{
if(shader)
{
// clear the buffer
// glClear(GL_COLOR_BUFFER_BIT);
// draw all pending lines
GLsizei drawing_zones[4];
int number_of_drawing_zones = getCircularRanges(_drawn_output_buffer_data_pointer, _output_buffer_data_pointer, OutputVertexBufferDataSize, 6*OutputVertexSize, drawing_zones);
@ -334,7 +333,15 @@ void OpenGLOutputBuilder::perform_output_stage(unsigned int output_width, unsign
glBindVertexArray(output_vertex_array);
// update uniforms (implicitly binding the shader)
shader->set_output_size(output_width, output_height, _visible_area);
if(_last_output_width != output_width || _last_output_height != output_height)
{
glClear(GL_COLOR_BUFFER_BIT);
shader->set_output_size(output_width, output_height, _visible_area);
_last_output_width = output_width;
_last_output_height = output_height;
}
else
shader->bind();
// draw
for(int c = 0; c < number_of_drawing_zones; c++)
@ -453,6 +460,8 @@ void OpenGLOutputBuilder::set_output_device(OutputDevice output_device)
{
_output_device = output_device;
_composite_src_output_y = 0;
_last_output_width = 0;
_last_output_height = 0;
}
}

View File

@ -49,10 +49,7 @@ class OpenGLOutputBuilder {
// Methods used by the OpenGL code
void prepare_rgb_output_shader();
void prepare_composite_output_shader();
std::unique_ptr<OpenGL::OutputShader> prepare_output_shader(char *fragment_shader, bool use_usampler, GLenum source_texture_unit);
void prepare_composite_input_shader();
std::unique_ptr<OpenGL::Shader> prepare_intermediate_shader(const char *input_position, const char *header, char *fragment_shader, GLenum texture_unit, bool extends);
void prepare_output_vertex_array();
void prepare_source_vertex_array();
@ -64,18 +61,14 @@ class OpenGLOutputBuilder {
// transient buffers indicating composite data not yet decoded
uint16_t _composite_src_output_y, _cleared_composite_output_y;
char *get_input_vertex_shader(const char *input_position, const char *header);
char *get_input_fragment_shader();
char *get_y_filter_fragment_shader();
char *get_chrominance_filter_fragment_shader();
std::unique_ptr<OpenGL::OutputShader> rgb_shader_program, composite_output_shader_program;
std::unique_ptr<OpenGL::IntermediateShader> composite_input_shader_program, composite_y_filter_shader_program, composite_chrominance_filter_shader_program;
GLuint output_array_buffer, output_vertex_array;
GLuint source_array_buffer, source_vertex_array;
unsigned int _last_output_width, _last_output_height;
GLuint textureName, shadowMaskTextureName;
GLuint defaultFramebuffer;

View File

@ -74,7 +74,7 @@ std::unique_ptr<OutputShader> OutputShader::make_shader(const char *fragment_met
"void main(void)"
"{"
"fragColour = vec4(%s, 0.6*cos(lateralVarying));"
"fragColour = vec4(%s, 0.7*cos(lateralVarying));"
"}",
sampler_type, fragment_methods, colour_expression);