diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-09-13 00:21:44 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | 60874f7b18adfc95493e94f6f8cd44773f7afe7b (patch) | |
| tree | 9d470f672aa9871376e3fc18d3fc721b2cb21c09 | |
| parent | f984990795e548e2c4160d17d0fa54a40c8b1311 (diff) | |
Extract indices array and make some offset constants.
| -rw-r--r-- | src/wx/gl_video_view.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 6bbf87c9d..49a30d733 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -285,6 +285,22 @@ GLVideoView::ensure_context () } } + +/* Offset of video texture triangles in indices */ +static constexpr int indices_video_texture = 0; +/* Offset of border lines in indices */ +static constexpr int indices_border = 6; + +static constexpr unsigned int indices[] = { + 0, 1, 3, // video texture triangle #1 + 1, 2, 3, // video texture triangle #2 + 4, 5, // border line #1 + 5, 6, // border line #2 + 6, 7, // border line #3 + 7, 4, // border line #4 +}; + + void GLVideoView::setup_shaders () { @@ -312,15 +328,6 @@ GLVideoView::setup_shaders () get_information (GL_VERSION); get_information (GL_SHADING_LANGUAGE_VERSION); - unsigned int indices[] = { - 0, 1, 3, // texture triangle #1 - 1, 2, 3, // texture triangle #2 - 4, 5, // border line #1 - 5, 6, // border line #2 - 6, 7, // border line #3 - 7, 4, // border line #4 - }; - glGenVertexArrays(1, &_vao); check_gl_error ("glGenVertexArrays"); GLuint vbo; @@ -461,10 +468,10 @@ GLVideoView::draw (Position<int>, dcp::Size) glBindVertexArray(_vao); check_gl_error ("glBindVertexArray"); glUniform1i(_fragment_type, _optimise_for_j2k ? 1 : 2); - glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_INT, reinterpret_cast<void*>(indices_video_texture)); if (_viewer->outline_content()) { glUniform1i(_fragment_type, 1); - glDrawElements (GL_LINES, 8, GL_UNSIGNED_INT, reinterpret_cast<void*>(6 * sizeof(int))); + glDrawElements (GL_LINES, 8, GL_UNSIGNED_INT, reinterpret_cast<void*>(indices_border * sizeof(int))); check_gl_error ("glDrawElements"); } |
