Skip to content

Commit

Permalink
[usdviewq] Fixed GL version test to include minor version
Browse files Browse the repository at this point in the history
Fixed the version test in usdview to check that the GL version is
at least version 3.1 before enabling "#version 140" shader code.

Fixes #957
Fixes #1001

(Internal change: 2176535)
  • Loading branch information
davidgyu authored and pixar-oss committed Jul 15, 2021
1 parent 0503259 commit 234c577
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pxr/usdImaging/usdviewq/stageView.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self, VS3, FS3, VS2, FS2, uniformDict):
# <version_number> = <major_number>.<minor_number>[.<release_number>]
versionNumberString = versionString.split()[0]
self._glMajorVersion = int(versionNumberString.split('.')[0])
self._glMinorVersion = int(versionNumberString.split('.')[1])

# requires PyOpenGL 3.0.2 or later for glGenVertexArrays.
self.useVAO = (self._glMajorVersion >= 3 and
Expand All @@ -99,7 +100,8 @@ def __init__(self, VS3, FS3, VS2, FS2, uniformDict):
vertexShader = GL.glCreateShader(GL.GL_VERTEX_SHADER)
fragmentShader = GL.glCreateShader(GL.GL_FRAGMENT_SHADER)

if (self._glMajorVersion >= 3):
# requires OpenGL 3.1 or greater for version 140 shader source
if (self._glMajorVersion, self._glMinorVersion) >= (3, 1):
vsSource = VS3
fsSource = FS3
else:
Expand Down

0 comments on commit 234c577

Please sign in to comment.