Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MacOSX: Fix aspect ratio problems.

The viewport size is now memorized in a member variable instead of in the GL
context. Equalizer still uses the viewport settings from the context.
  • Loading branch information...
commit 846b773b174ec83366ae30000ec258b2987e00d6 1 parent 067e685
Martin Lambers marlam authored
12 src/player_equalizer.cpp
View
@@ -158,9 +158,9 @@ class video_output_opengl_eq_window : public video_output_opengl
{
}
- void eq_display(bool toggle_swap_eyes, float x, float y, float w, float h)
+ void eq_display(bool toggle_swap_eyes, float x, float y, float w, float h, const int viewport[4])
{
- video_output_opengl::display(toggle_swap_eyes, x, y, w, h);
+ video_output_opengl::display(toggle_swap_eyes, x, y, w, h, viewport);
}
void eq_initialize(int src_width, int src_height, float src_aspect_ratio,
@@ -812,9 +812,9 @@ class eq_window : public eq::Window
{
}
- void display(bool toggle_swap_eyes, float x, float y, float w, float h)
+ void display(bool toggle_swap_eyes, float x, float y, float w, float h, const int viewport[4])
{
- _video_output.eq_display(toggle_swap_eyes, x, y, w, h);
+ _video_output.eq_display(toggle_swap_eyes, x, y, w, h, viewport);
}
protected:
@@ -929,7 +929,9 @@ class eq_channel : public eq::Channel
// Display
eq_window *window = static_cast<eq_window *>(getWindow());
bool toggle_swap_eyes = (getEye() == eq::EYE_RIGHT);
- window->display(toggle_swap_eyes, quad_x, quad_y, quad_w, quad_h);
+ GLint viewport[4];
+ glGetIntegerv(GL_VIEWPORT, viewport);
+ window->display(toggle_swap_eyes, quad_x, quad_y, quad_w, quad_h, viewport);
}
};
11 src/video_output_opengl.cpp
View
@@ -364,7 +364,7 @@ static void draw_quad(float x, float y, float w, float h)
glEnd();
}
-void video_output_opengl::display(bool toggle_swap_eyes, float x, float y, float w, float h)
+void video_output_opengl::display(bool toggle_swap_eyes, float x, float y, float w, float h, const int viewport[4])
{
clear();
if (!_have_valid_data[_active_tex_set])
@@ -384,8 +384,6 @@ void video_output_opengl::display(bool toggle_swap_eyes, float x, float y, float
{
std::swap(left, right);
}
- int viewport[4];
- glGetIntegerv(GL_VIEWPORT, viewport);
if ((_mode == even_odd_rows || _mode == checkerboard) && (screen_pos_y() + viewport[1]) % 2 == 0)
{
std::swap(left, right);
@@ -612,8 +610,11 @@ void video_output_opengl::reshape(int w, int h)
int vp_x = (w - vp_w) / 2;
int vp_y = (h - vp_h) / 2;
- // Setup viewport and save new size
- glViewport(vp_x, vp_y, vp_w, vp_h);
+ // Save new size
+ _viewport[0] = vp_x;
+ _viewport[1] = vp_y;
+ _viewport[2] = vp_w;
+ _viewport[3] = vp_h;
if (!_state.fullscreen)
{
_win_width = w;
6 src/video_output_opengl.h
View
@@ -72,6 +72,8 @@ class video_output_opengl : public video_output
bool _initialized;
// XXX: Hack: work around broken SRGB texture implementations
bool _srgb_textures_are_broken;
+ // OpenGL Viewport for drawing the video frame
+ GLint _viewport[4];
protected:
/* In a sub-class that provides an OpenGL context, call the following
@@ -90,8 +92,8 @@ class video_output_opengl : public video_output
void clear();
// Display the current texture set. The first version of this function is used
// by Equalizer; simple windows will use the second version.
- void display(bool toggle_swap_eyes, float x, float y, float w, float h);
- void display() { display(false, -1.0f, -1.0f, 2.0f, 2.0f); }
+ void display(bool toggle_swap_eyes, float x, float y, float w, float h, const int viewport[4]);
+ void display() { display(false, -1.0f, -1.0f, 2.0f, 2.0f, _viewport); }
// Call this when the GL window was resized:
void reshape(int w, int h);
Please sign in to comment.
Something went wrong with that request. Please try again.