Any OPENGL wizards?

More
23 Dec 2020 03:50 #192921 by cakeslob
Replied by cakeslob on topic Any OPENGL wizards?
no vismach doesnt work on the pi4, which is why i started looking into it again. When I checked on the weekend, the error it throws out it for the same reasons it gives me a glgenlist on qt5_graphics , except this one is for glLightfv
GL_INVALID_OPERATION is generated if glLight is executed between the execution of glBegin and the corresponding execution of glEnd.
that is the first error for qtvismach, since it was similar i didnt look into it until just now, and it confirms the things i was saying earlier. first link to pop up are these few for a game that has the same issue we are having, it seems common enouth that there is many threads on the topic

forum.openmw.org/viewtopic.php?f=47&t=6153
forum.openmw.org/viewtopic.php?f=8&t=6942

I'm pretty sure you've got something wrong with your OpenGL includes. The most likely culpret is that you've built OSG against GLES instead of regular OpenGL.

You'll need to build OSG 3.6.5 with DesktopGL and not GLES. That is always the biggest problem.

or some reason with compiled from source I get the error that rhioun got when used from repository. With my limited understanding it looks like in my case Qt is compiled against OpenGLES3, so they just switched places. Is this so? And if yes, should I also compile Qt?

Yeah, I hit that with Debian/Ubuntu. They compiled Qt on arm with libGLESv2 isntead of libGL, then they compiled OSG (osgQt) against the libGLESv2 Qt5, so that too must have been libGLESv2. I'll be honest, it doesn't work with OpenMW. OpenMW expects libGL.


there is a bug report that talks about the issue
bugs.debian.org/cgi-bin/bugreport.cgi?bug=838792
osg is some kind of qt application for their game openMW as far as i can tell.

Please Log in or Create an account to join the conversation.

More
23 Dec 2020 04:41 #192926 by cakeslob
Replied by cakeslob on topic Any OPENGL wizards?

I wonder if this means changing to qopengl would help?

Lol I just looked at qtvismach to test QopenGLWidget and....Surprise that is what I'm already using.

from my understanding of qglwidget vs qopenglwidget that was supposed to solve the problem between the desktop and embedded gl platforms, but that apparently isnt the case.

Maybe making a simple QopenGLWidget program on the pi4 to prove it works?

thats what i have been basing my searches from, which narrows it down to video game cross compatibility, the problem has been the errors i get from qt5_graphics have been to broad with no rpi examples and not as much help. searching that light error with vismach turned up instant results

As I understand it, all linuxcnc opengl programs use legacy code/techniques.

which narrows it down to an issue with qt, the other gui use glgenlist in the same way and they all work very well

There is some people working on GTK3 updates to GladeVCP, and my guess is they will need to update openGL too - so maybe more example code.

is that this one? github.com/LinuxCNC/linuxcnc/pull/943 I didnt dive to deep into how it works , but i installed the limuxcmc branch, and axis seems to work fine, no errors and it displays everything alright

I think this piece of code will work on any platform, as it is lightweight.

looks cool, ill let you know what happenes on rpi4

Please Log in or Create an account to join the conversation.

More
30 Dec 2020 05:32 #193490 by persei8
Replied by persei8 on topic Any OPENGL wizards?
Just when I abandoned all hope of having my pi4 run the cnc machine, I see this. Thanks for looking further into this. Unfortunately, the conversation is above my pay grade so I'm not going to be much (any) help.
Jim

Please Log in or Create an account to join the conversation.

More
26 Jan 2021 01:54 #196593 by cakeslob
Replied by cakeslob on topic Any OPENGL wizards?
dont sell your self short, ive seen what you can do
I need some help understanding a few things and someone to check my work to see if im on the right track
I am following this, it checks off all the boxes, as to my understanding of the problem.
github.com/koendv/qt5-opengl-raspberrypi

my understanding of the problem:
-qtvcp preview wont load despite using the same opengl/glu commands as gtk and axis(minigl?)
-qt5 when it installs on arm uses a different graphics library(gles version) to use the hardware acceleration
-qtvcp preview uses the qGLwidget which is not cross compatible, as it calls on things from the desktop version graphics library which
uses opengl

solution:
-install qt5 with the desktop graphics library
the rpi4 can do software rendering on up to opengl3.3 . software rendering axis and gtk is noticeable slower and less appealing visually, but it only seems to have increased cpu usage by a few percent. so I see no reason software rendering of the qtvcp preview would be to much different

so i started here,
github.com/koendv/qt5-opengl-raspberrypi

Qt5.12 LTS with OpenGL for Raspberry
This package installs Qt5.12 LTS "long term support" with desktop OpenGL on a raspberry pi 4 running Raspbian Buster. The package is suitable for compiling desktop-style, windowed Qt apps under X11. The OpenGL support is in software, using Mesa.


this appears to be the one, 18-24 hour mark on the build, it failed, it couldnt locate a file i couldnt find earlier but for something i dont think i need. in the guide it starts using apt install instead of sudo apt-get install which is probably where i went wrong, not doing it in root maybe. Im not really sure to be honest Ive never really compiled something this large.
Also, after reading the whole guide(which seems to go full circle), do i need to build this from source or did the git already do that??
do i just download the qt5-opengl-dev_5.12.5_armhf.deb and install that then install qt5?
this takes a bit too long for my brand of trial and error, so I will read more, but if anyone can offer some advice that would be appreciated,

Please Log in or Create an account to join the conversation.

More
26 Jan 2021 05:40 #196604 by persei8
Replied by persei8 on topic Any OPENGL wizards?
You got farther than I did. I think your understanding of the problem is correct. I haven't seen this tutorial so I will study it. My Pi4 is just sitting on the desk, not even powered on, so it might as well be compiling. I've noticed many times someone says just do apt install but it won't work unless you use sudo. Maybe they are in a su shell and don't need sudo. I'm pretty sure you can't install system files without being the root user. It looks to me like the author already created the deb package ready for installation.
I did manage to get vtk working in the qtvcp framework, but on large programs, it takes a lot of cpu making me think maybe its not using the gpu. The errors when using the qt5_graphics module were error 28 - invalid operation, making me think that an opengl implementation on the rpi would be software rendered as the gpu firmware is incompatible. I hope this makes sense, I'm no expert.

Please Log in or Create an account to join the conversation.

More
26 Jan 2021 19:45 #196655 by persei8
Replied by persei8 on topic Any OPENGL wizards?
So I installed qt5-opengl-dev_5.12.5_armhf.deb on a fresh raspbian os install, then linuxcnc, then pyqt5. Linuxcnc starts up and copies the example sim config to the config directory but as soon as an opengl function is called:
Traceback (most recent call last):
  File "./qt5_graphics.py", line 670, in initializeGL
    self.object = self.makeObject()
  File "./qt5_graphics.py", line 944, in makeObject
    genList = GL.glGenLists(1)
  File "/usr/lib/python2.7/dist-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
    return self( *args, **named )
  File "/usr/lib/python2.7/dist-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
	err = 1282,
	description = 'invalid operation',
	baseOperation = glGenLists,
	cArguments = (1,),
	result = 0L
)
Aborted
Oh well.

Please Log in or Create an account to join the conversation.

More
27 Jan 2021 02:04 #196697 by cakeslob
Replied by cakeslob on topic Any OPENGL wizards?
Ok, yeah, thats what happened with my first attempt(non compile) before i broke everything. I dont think we will get a simple install and we are good though, one step you might have to do is select the qt5-opengl profile in qtchooser. before loading. I am unclear if you can just make a qtchooser profile/config, or if you need to separately install for each profile. on my image before i broke it had some other options like qt5/qt4/qt5-armhf/qt4-armhf/qt5-opengl, stuff like that for loading different profiles. also try both graphics drivers,
glxinfo | grep "version"
you can see what graphics drivers/versions are running. one driver is opengl3.3 and the gpu driver is opengl 2.1, i dont remember which is which

It looks to me like the author already created the deb package ready for installation.

ok, thats what i was thinking also.

I did manage to get vtk working in the qtvcp framework, but on large programs, it takes a lot of cpu making me think maybe its not using the gpu.

yes, nice work, but your one screenshot scared me away with the huge cpu usage ,

the errors when using the qt5_graphics module were error 28 - invalid operation, making me think that an opengl implementation on the rpi would be software rendered as the gpu firmware is incompatible. I hope this makes sense, I'm no expert.

yeah, that what im thinking. whatever the other gui';s use for fo their opengl, works with both rpi graphics drivers, with noticeable performance /visual decline when doing software rendering, but not by very much, only a few %. using software rendering with the mesa driver (the graphics one), gives us opengl 3.3 out of the box. there is no reason it shouldnt work, but i just dont know how to make QT call on anyting else other than libglesv2.so which I dont think it should be doing.

which leads me to qtvismach
cmo used the newer qtopenglwidget lib, which is supposed to be some kind of cross platform thing. so it should work on rpi4.
on initial inspection, it has the same problem as qt5_graphics, where opengl/glu calls cant be implemented. those were the kind of graphical errors from qt you get when you try to run the backplot. to get the errors, you need to isolate vismach as an individual window instead of embedded into axis. on further inspection, there is one extra line in the terminal, regarding an error involving calling on libGLESv2.so. I had come across this error while researching the backplot issue, I think it is a good sign, it refers to calling on one graphics driver but cant because its busy, that was as far as i got before i broke my graphics drivers on my main image, so ive been trying to recover from that. I will be doing my further testing using this image posted here, forum.linuxcnc.org/9-installing-linuxcnc...es-not-work?start=60
I would like to see if using a kernel closer to mainline will be of any help, but i would like to see if it has something to do with the older RT kernels referring to the machine hardware as BCM2385 while the new kernel reports BCM2711, it might make no difference depending on where the software gets its version id from

Please Log in or Create an account to join the conversation.

More
30 Apr 2021 01:26 - 30 Apr 2021 02:53 #207423 by cakeslob
Replied by cakeslob on topic Any OPENGL wizards?
What (if any) version of QT is the minimum requirement for qtvcp? Perhaps its unrelated to non-raspibian/arm builds. I though I saw one before, but couldnt find anything when I went to look. I only ask because I saw a similar issue, with similar cross platform circumstances, which was solved by building a newer version of QT and pyqt from source and not using the apt manager . The native rpi build is 5.12 im fairly sure, I will have to set aside some time to try this.

from the raspberrypi forums

Okay, I got it working. From what I can tell, the versions of qt5 and pyqt5 that are available in the normal raspbian repos are too old to support OpenGL in qt5, so the fix is to build qt5 and pyqt5 from source. Here are the steps I used to do that:

  • First, I started with a pristine version of the latest Raspberry Pi OS with desktop. The first time I tried this I used an 8 GB sdcard but that turned out to be too small to hold all the build dependencies so I ended up replacing the card with a 64 GB.
  • Then I used the steps outlined here to build qt5 and pyqt5 from source. github.com/tiagordc/rpi-build-qt-pyqt The steps outlined at that link worked flawlessly for me.
  • Finally, when installing the python modules needed for my project (pyserial, pyopengl, etc) I just used "pip3 install pyserial" etc.
  • I DID NOT use apt-get to install any other qt5, pyqt5 or opengl related dependencies since I don't want to disturb my new nicely built libraries.

Once all of the above was complete, my pyqt5 application opened like a champ with the opengl widget contained within it. I think the build process took me about 6 hours on a RPi 4 w/ 8 GB, although I was walking away for long periods so it might have been less than that.

Last edit: 30 Apr 2021 02:53 by cakeslob.

Please Log in or Create an account to join the conversation.

More
30 Apr 2021 14:32 #207459 by cmorley
Replied by cmorley on topic Any OPENGL wizards?
i develop with 5.5.1
QtPlasma requires a newer version then that to run.

Please Log in or Create an account to join the conversation.

More
06 Jul 2021 22:46 #213910 by persei8
Replied by persei8 on topic Any OPENGL wizards?
So finally got around to this again. I managed to compile and install Qt5 and PyQt5 along with linuxcnc on a rpi4/4G. I ran update-alternatives to make the 'python' command use python3.7. However, when starting linuxcnc, it complains:
ImportError: No module named PyQt5
In an interactive session using python3.7, the command 'from Pyqt5 import QtWidgets' causes no error.
In an interactive session using python2.7, the command 'from Pyqt5 import QtWidgets' causes the error.
This leads me to believe that qtvcp is using python2.7 regardless of the system default.
Any help appreciated.
Jim

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.203 seconds
Powered by Kunena Forum