Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MacOs - GL errors #1257

Closed
LaurentGarcia opened this issue Jul 3, 2020 · 11 comments
Closed

MacOs - GL errors #1257

LaurentGarcia opened this issue Jul 3, 2020 · 11 comments

Comments

@LaurentGarcia
Copy link

Description of Issue

Everytime that I launch the usdview in MacOs I got in the console multiple messages with same content:

b"ERROR: 0:1: '' : version '140' is not supported\n"
b"ERROR: 0:1: '' : version '140' is not supported\n"
b'ERROR: One or more attached shaders not successfully compiled\n'
Traceback (most recent call last):
File "/opt/local/USD/lib/python/pxr/Usdviewq/stageView.py", line 1749, in paintGL
self.DrawAxis(viewProjectionMatrix)
File "/opt/local/USD/lib/python/pxr/Usdviewq/stageView.py", line 1074, in DrawAxis
glslProgram = self.GetSimpleGLSLProgram()
File "/opt/local/USD/lib/python/pxr/Usdviewq/stageView.py", line 1066, in GetSimpleGLSLProgram
["mvpMatrix", "color"])
File "/opt/local/USD/lib/python/pxr/Usdviewq/stageView.py", line 117, in init
GL.glDeleteShader(vertexShader)
File "/usr/local/lib/python3.7/site-packages/OpenGL/error.py", line 234, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1281,
description = b'invalid value',
baseOperation = glDeleteShader,
cArguments = (2,)
)

Steps to Reproduce

  1. usdview any usdscene and the viewport shows the geo but in red shade color

System Information (OS, Hardware)

Catalina , 8 Cores i9 - AMD 5500m

Package Versions

Last USD stable version

Build Flags

Installed with the python script

@poljere
Copy link
Contributor

poljere commented Jul 6, 2020

Thanks for reporting this issue Laurent. Looks like it is trying to compile 1.40 GLSL shaders (compatible with OpenGL 3) on MacOS. But, that should not be the case since for MacOS we should be using a GL compatibility profile (OpenGL 2) which should end up compiling the 1.2 GLSL fallback shaders.

Unfortunately, we are not running into this issue on our end.

One thing you can try is to verify the version of OpenGL being using in stageView.py by printing _glMajorVersion before shader compilation. Another idea could be to see if the same happens when you run the Dev branch instead of the Master branch. Finally, you can try to check what are your "Core" / "Compatibility" profile GL versions, either by writing a bit of code or just using something like the "OpenGL Extensions Viewer".

Thanks Laurent.

@jtran56
Copy link

jtran56 commented Jul 10, 2020

Filed as internal issue #USD-6205.

@nmontmarquette
Copy link

nmontmarquette commented Aug 1, 2020

Just adding own info to the ticket, in case it might be of some use.
I have the same issue as @LaurentGarcia.

Added printing of _glMajorVersion:

INFO: self._glMajorVersion: 50

Hardware model: Apple MacBook Pro 15-inch 2018

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.6
BuildVersion:	19G73

Graphic Adapter & OpenGL Versions

$ glxinfo -v | grep --color -i version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL version string: 2.1 ATI-3.10.15
OpenGL shading language version string: 1.20

EDIT: I figure the following:
The GL.glGetString(GL.GL_VERSION) method, at least on my system, returns a byte array, not a string. I didn't check official documentation yet.

The the naive conversion ends up converting the binary value of "2" to 50, rather than integer 2.

https://github.com/PixarAnimationStudios/USD/blob/71b4baace2044ea4400ba802e91667f9ebe342f0/pxr/usdImaging/usdviewq/stageView.py#L86

On my system I simply replaced with:

        # The 'GL.glGetString(GL.GL_VERSION)' method returns a byte array, not a string        
        self._glMajorVersion = int(str(GL.glGetString(GL.GL_VERSION), 'utf-8')[0])

@poljere
Copy link
Contributor

poljere commented Aug 3, 2020

I wonder if @LaurentGarcia was running into the same parsing issue.. @LaurentGarcia do you mind trying the proposed fix from @nmontmarquette?

@amotarzi
Copy link

amotarzi commented Aug 8, 2020

Also adding own info to the ticket if helpful:

/Applications/usdview.command ; exit;
amotarzi@Amos-MacBook-Pro ~ % /Applications/usdview.command ; exit;
qt.qpa.fonts: Populating font family aliases took 967 ms. Replace uses of missing font family "Gotham Rounded" with one that exists to avoid this cost. 
Warning: in operator() at line 67 of /Users/amotarzi/Documents/Github/USD/pxr/imaging/hgiGL/hgi.cpp -- HgiGL minimum OpenGL requirements not met. Please ensure that OpenGL is initialized and supports version 4.5.
Traceback (most recent call last):
  File "/Users/amotarzi/Documents/Github/USD_BUILD/USD-Core/lib/python/pxr/Usdviewq/stageView.py", line 1793, in paintGL
    task.Execute(None)
  File "/Users/amotarzi/Documents/Github/USD_BUILD/USD-Core/lib/python/pxr/Usdviewq/stageView.py", line 384, in Execute
    GL.glBindVertexArray(0)
  File "/Library/Python/2.7/site-packages/OpenGL/platform/baseplatform.py", line 415, in __call__
    return self( *args, **named )
  File "/Library/Python/2.7/site-packages/OpenGL/error.py", line 234, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
	err = 1282,
	description = 'invalid operation',
	baseOperation = glBindVertexArray,
	cArguments = (0,)
)

System Information (OS, Hardware)

Catalina 15.6, Macbook Pro

Package Version

USD 20.05

@poljere
Copy link
Contributor

poljere commented Aug 10, 2020

Hi @amotarzi, do you get the same issue listed above if you update to latest release 20.08? Also, do you mind trying the proposed fix from @nmontmarquette? Unfortunately, we can't reproduce the issue listed here on our end yet, but it would be helpful to see if your issue is the same as the one described above.

@LaurentGarcia
Copy link
Author

I am back from my long holidays break!. In my case it's not working, in fact I believe is because I am using the latest version of MacOS. Apple has definitively discontinued/deprecated completely OpenGL and seems like python libraries doesn't support the newest OS. I am trying to make an easy example in Python importing basic GL stuff and I am getting:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 35, in GL
return ctypesloader.loadLibrary(
File "/usr/local/lib/python3.8/site-packages/OpenGL/platform/ctypesloader.py", line 36, in loadLibrary
return _loadLibraryWindows(dllType, name, mode)
File "/usr/local/lib/python3.8/site-packages/OpenGL/platform/ctypesloader.py", line 89, in _loadLibraryWindows
return dllType( name, mode )
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/init.py", line 373, in init
self._handle = _dlopen(self._name, mode)
OSError: ('dlopen(OpenGL, 10): image not found', 'OpenGL', None)

Probably the best idea for the future is make a transition to Metal :-)

@erwincoumans
Copy link

erwincoumans commented Dec 16, 2020

@LaurentGarcia I have no problem using OpenGL 3.x core profile on the latest MAC OS 11.1 (both Intel and M1 arm). Maybe they finally dropped "compatibility" mode?

@dgovil
Copy link
Collaborator

dgovil commented Dec 16, 2020

@LaurentGarcia The issue you're facing with PyOpenGL is due to Big Sur changes in how system libraries are stored. OpenGL is still available, but the mechanism being used to load it fr PyOpenGL is incompatible.

See #1372 (comment) for the fix.

Python 3.9 has the necessary changes applied to work out of the box.

@davidgyu
Copy link
Member

We believe this is fixed in v22.05. An earlier fix for #957 addressed some aspects of this in v21.11 But the good news for v22.05 is that the Storm renderer in usdview will now use Metal on systems like yours. i.e. if you are running Catalina, Big Sur, or Monterey on a system with a discrete GPU you will have Storm for Metal in usdview.

@sunyab
Copy link
Contributor

sunyab commented Apr 25, 2022

Closing this out per @davidgyu's comments. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants