mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Adds a left border to complement the right.
This commit is contained in:
parent
7b9c1bb69c
commit
d73d3b4480
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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_.
|
||||
|
@ -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_;
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user