Skip to content

Commit

Permalink
fix(iv): iv shows constant brown and GL error messages on start-up. (A…
Browse files Browse the repository at this point in the history
…cademySoftwareFoundation#4451)

This fixes a problem seen on RHEL 9.2 Linux when launching an image in
iv, eg:
  iv testsuite/texture-overscan/ref/out-exact.exr

The image displayed as a constant brown and the terminal showed:
  GL error create program 1281 - Invalid value
  GL error After attach vertex shader. 1281 - Invalid value

The fix is to initialize m_shader_program and m_vertex_shader in the
class constructor.


ERROR ANALYSIS:

The bug was introduced in 5fe4441 "feat(iv): OCIO color managed display
(AcademySoftwareFoundation#4031)".

Before that commit, create_shaders() initialized those members to 0
before they were used.

After that commit:

* uninitialized m_shader_program is passed to glDeleteProgram() (near
the top of create_shaders) ), causing the
"create program" warning (there isn't an print_error call after
glDeleteProgram so the error is reported as "create program").

* ununitialized m_vertex_shader is non-0 when checked by if
(!m_vertex_shader), causing the vertex shader not to be created and
causing the later call to glAttachShader() with uninitialized
m_vertex_shader to fail. That causes the second error message, and lack
of a vertex shader apparently causes the image to display as constant
brown.

Signed-off-by: David Adler <[email protected]>
  • Loading branch information
dadler authored Sep 27, 2024
1 parent e5ad995 commit 3e4f2cc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/iv/ivgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ IvGL::IvGL(QWidget* parent, ImageViewer& viewer)
: QOpenGLWidget(parent)
, m_viewer(viewer)
, m_shaders_created(false)
, m_vertex_shader(0)
, m_shader_program(0)
, m_tex_created(false)
, m_zoom(1.0)
, m_centerx(0)
Expand Down

0 comments on commit 3e4f2cc

Please sign in to comment.