- auto const canvas_size = _canvas_size.load();
- int const canvas_width = canvas_size.GetWidth();
- int const canvas_height = canvas_size.GetHeight();
-
- float const image_x = float(_size->width) / canvas_width;
- float const image_y = float(_size->height) / canvas_height;
-
- auto x_pixels_to_gl = [canvas_width](int x) {
- return (x * 2.0f / canvas_width) - 1.0f;
- };
-
- auto y_pixels_to_gl = [canvas_height](int y) {
- return (y * 2.0f / canvas_height) - 1.0f;
- };
-
- auto inter_position = player_video().first->inter_position();
- auto inter_size = player_video().first->inter_size();
-
- float const border_x1 = x_pixels_to_gl (inter_position.x) + 1.0f - image_x;
- float const border_y1 = y_pixels_to_gl (inter_position.y) + 1.0f - image_y;
- float const border_x2 = x_pixels_to_gl (inter_position.x + inter_size.width) + 1.0f - image_x;
- float const border_y2 = y_pixels_to_gl (inter_position.y + inter_size.height) + 1.0f - image_y;
-
- float vertices[] = {
- // positions // texture coords
- image_x, image_y, 0.0f, 1.0f, 0.0f, // top right (index 0)
- image_x, -image_y, 0.0f, 1.0f, 1.0f, // bottom right (index 1)
- -image_x, -image_y, 0.0f, 0.0f, 1.0f, // bottom left (index 2)
- -image_x, image_y, 0.0f, 0.0f, 0.0f, // top left (index 3)
- border_x1, border_y1, 0.0f, 0.0f, 0.0f, // border bottom left (index 4)
- border_x1, border_y2, 0.0f, 0.0f, 0.0f, // border top left (index 5)
- border_x2, border_y2, 0.0f, 0.0f, 0.0f, // border top right (index 6)
- border_x2, border_y1, 0.0f, 0.0f, 0.0f, // border bottom right (index 7)
- };
-
- /* Set the vertex shader's input data (GL_ARRAY_BUFFER) */
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
- check_gl_error ("glBufferData");
-
- _have_storage = true;