Blue screen when running B1 example using Qt

Hi everyone, so I have been able to succesfully build and instal Geant 4 on my computer (I have windows 10), so whenever i run the exampleB1.exe using the Qt console (currently using Qt 5) it just shows a blue screen…and the console shows the following error: QGLWidget::renderText is not supported under OpenGL/ES.

Issue similar (if not identical) to

I’ve moved this to the Vis forum as the issue is with a successfully compiled Geant4 and application.

1 Like

This looks like the same problem reported by Alex in QGLWidget::renderText Error. Alex, have you made any progress with this?

I have been trying to understand what is going on but I am not sure what I’ve got on my hands.

Reading from here and here, it may be that when running a geant4 executable Qt is by default using the OpenGL/ES (ANGLE) libraries which are a subset of the standard full opengl32 libraries and do not support the RenderText method. According to the links, having Qt to implement widgets using opengl32 libraries and not openGL/ES seems to be done along the lines below

QApplication a( argc, argv );
a.setAttribute( Qt::AA_UseDesktopOpenGL );
//MainWindow and stuff like that after this...

Looking at the souce code, the RenderText method seems to be invoked in G4OpenGLQtViewer::DrawText while the Qt session is initiated in G4UIQt::SessionStart. Maybe it would be worth adding the UseDesktopOpenGL one-liner somewhere there…? I have not tried it because I am not confident in C++.

Another point that I came across is the version of openGL in my Win10 system.
My (ancient) CPU is only supported by the Intel HD Graphics 3000 which has stopped updates in 2015. That means that my openGL is still at version 3.1 (and cannot be further updated)

So being a bit limited by my system, I am not sure if my attempts are doomed to fail.

All in all, I am not entirely convinced that the RenderText error is the reason I do not see any graphics in the QWidget :smiley:
Maybe it would be interesting to see if the above make sense in Mayra’s case.

Try adding your suggestion

  qApp->setAttribute( Qt::AA_UseDesktopOpenGL );

just before line 116 in

  new QApplication (*p_argn, args);

Let us know what happens.

Magic! Thank you John, it worked!

For the record, the steps I followed were getting a “clean” geant4_10_06_p02, open the E:\Geant4\geant4_10_06_p02\source\interfaces\common\src\ and edit it as John suggested above. After edit, lines 115-116 should look like
After this modification, follow the standard G4 installation procedure and hopefully the problem will be solved.

Hi Alex
That’s great. Thanks for persisting with this. I will look at getting this into the next release. I will consult our Qt experts. It looks like a Windows issue, or maybe even a specific Windows version, and we will probably protect that line with #ifdef Windows.version, because in general we don’t want to tie ourselves to OpenGL as the underlying Qt graphics.
But I’m glad it works for you now and others can also benefit.