Jump to content

Missing OpenGL library for IMU 3.0 3D view


Recommended Posts

The current macOS Brick Viewer version (2.4.20) can't find the OpenGL library to display the 3D view of the IMU 3.0 Bricklet.
I'm on macOS 12.0.1.

What OpenGl library are you looking for? PyOpenGL or something else?
In the source I could only find QT packages which I'm sure I have installed.

Cheers
Claudio

Link to comment
Share on other sites

I don't have macOS 12 at hand for testing. It works on macOS 10.15.7.

We're using just Qt with directly loading the low level operating system OpenGL library. This is due to problems with the wrapping of the QtOpenGL module in PyQt at the time of developing this code.

You can find the relevant code here:

https://github.com/Tinkerforge/brickv/blob/master/src/brickv/render_widget.py

Try running this two lines in Python on you Mac:

import ctypes.util
ctypes.util.find_library('OpenGL')

I assume that the find_library call returns None for you, meaning it cannot find the system's OpenGL library. It's unclear to me why.

In the long run we might just switch from OpenGL to Qt3D for this.

Link to comment
Share on other sites

After running

import ctypes.util
print(ctypes.util.find_library('OpenGL'))

I get

Quote

/System/Library/Frameworks/OpenGL.framework/OpenGL

It seems that it does find the library though.

Link to comment
Share on other sites

Are you using the pre-build .dmg we provide for download? Or are you running brickv from source?

If you're using the pre-build .dmg this might be some kind of packaging bug.

If you're running from source, then I'm confused.

On 11/24/2021 at 12:05 PM, cl- said:

The current macOS Brick Viewer version (2.4.20) can't find the OpenGL library to display the 3D view of the IMU 3.0 Bricklet.

Does it say "OpenGL library not found. Disabling 3D view." in the bottom on the brickv window?

You can see from the code here, that this message is triggered by the ctypes.util.find_library('OpenGL') call returning None:

https://github.com/Tinkerforge/brickv/blob/2e4a03ec4d5429144febe7d4a4eb2ed3e0503dd8/src/brickv/render_widget.py#L42

https://github.com/Tinkerforge/brickv/blob/2e4a03ec4d5429144febe7d4a4eb2ed3e0503dd8/src/brickv/render_widget.py#L100

So I don't really understand why that call works if you try it by hand, but doesn't seem to work in brickv.

If you're currently using the pre-build .dmg, could you try running from source to see if this makes a difference?

Link to comment
Share on other sites

Unfortunately, I can't run Brick Viewer from source, as installing the requirements (pip3 install -r src/requirements.txt) fails.

It has a problem with tzlocal

Quote

Collecting tzlocal
  Using cached tzlocal-4.1-py3-none-any.whl (19 kB)
ERROR: Could not find a version that satisfies the requirement PyQt5_sip<4.20,>=4.19.11 (from pyqt5) (from versions: 12.7.0, 12.7.1, 12.7.2, 12.8.0, 12.8.1, 12.9.0)
ERROR: No matching distribution found for PyQt5_sip<4.20,>=4.19.11

I'm using a Homebrew Python3 version and it seems that the dependencies cannot be made compatible.

I'll try fixing it and get back to you asap.

Link to comment
Share on other sites

Sorry, you are right, tzlocal was not the problem indeed.

I changed the PyQt5 dependency in requirements.txt to

PyQt5

and that fixed it. I can now see the 3D view for the IMU v3 Bricklet.

On 11/30/2021 at 1:12 PM, photron said:

Does it say "OpenGL library not found. Disabling 3D view." in the bottom on the brickv window?

Yes that was exactly what it said.

Screenshot 2021-12-01 at 16.38.20.png

Link to comment
Share on other sites

Okay, so it can work.

But we still don't know if it is because of the packaging or the different PyQt5 version.

You could try building the Brick Viewer .dmg file. For that you need to run "build_pkg.py --no-sign" in the virtualenv. The --no-sign option tells it to not sign the binaries, as you cannot do that on our behalf. Afterwards try the resulting .dmg file that is created in the same directory as the build_pkg.py file.

If Brick Viewer from that .dmg has the same OpenGL problem, then it is triggered by the packaging.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...