1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-22 00:29:41 +00:00

Merge pull request #545 from TomHarte/LeftBorder

Adds a left gutter to complement the right.
This commit is contained in:
Thomas Harte 2018-09-09 21:53:25 -04:00 committed by GitHub
commit 21a9bd927a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

View File

@ -228,7 +228,8 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
last_output_width_ = output_width;
last_output_height_ = output_height;
// Configure a right gutter to crop the right-hand 2% of the display.
// Configure right and left gutters to crop the left- and right-hand 1% of the display.
left_overlay_.reset(new OpenGL::Rectangle(output_shader_program_->get_left_extent() * 0.98f, -1.0f, -1.0f, 2.0f));
right_overlay_.reset(new OpenGL::Rectangle(output_shader_program_->get_right_extent() * 0.98f, -1.0f, 1.0f, 2.0f));
}
output_shader_program_->bind();
@ -238,6 +239,7 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
// mask off the gutter
glDisable(GL_BLEND);
left_overlay_->draw(0.0, 0.0, 0.0);
right_overlay_->draw(0.0, 0.0, 0.0);
}

View File

@ -118,6 +118,7 @@ class OpenGLOutputBuilder {
// The fix: just always treat that area as invisible. This is acceptable thanks to
// the concept of overscan. One is allowed not to display extreme ends of the image.
std::unique_ptr<OpenGL::Rectangle> right_overlay_;
std::unique_ptr<OpenGL::Rectangle> left_overlay_;
public:
// These two are protected by output_mutex_.

View File

@ -96,6 +96,7 @@ void OutputShader::set_output_size(unsigned int output_width, unsigned int outpu
GLfloat outputAspectRatioMultiplier = (static_cast<float>(output_width) / static_cast<float>(output_height)) / (4.0f / 3.0f);
GLfloat bonusWidth = (outputAspectRatioMultiplier - 1.0f) * visible_area.size.width;
left_extent_ = (-1.0f / outputAspectRatioMultiplier) / visible_area.size.width;
right_extent_ = (1.0f / outputAspectRatioMultiplier) / visible_area.size.width;
visible_area.origin.x -= bonusWidth * 0.5f;
@ -105,6 +106,10 @@ void OutputShader::set_output_size(unsigned int output_width, unsigned int outpu
set_uniform("boundsSize", (GLfloat)visible_area.size.width, (GLfloat)visible_area.size.height);
}
float OutputShader::get_left_extent() {
return left_extent_;
}
float OutputShader::get_right_extent() {
return right_extent_;
}

View File

@ -88,12 +88,18 @@ public:
*/
void set_input_width_scaler(float input_scaler);
/*!
@returns The location, in eye coordinates, of the left edge of the output area.
*/
float get_left_extent();
/*!
@returns The location, in eye coordinates, of the right edge of the output area.
*/
float get_right_extent();
private:
float left_extent_ = 0.0f;
float right_extent_ = 0.0f;
};