Bug fix for Qt problem

Give some feedback on openEMS.

Moderators: thorsten, sebastian

F4INX
Posts: 7
Joined: Tue 15 Dec 2020, 18:25

Bug fix for Qt problem

Post by F4INX » Tue 15 Dec 2020, 18:27

I would have a feedback about a small bug I had with OpenEMS + Octave. AppCSXCAD.exe gave me the following error message :
qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: direct2d, minimal, offscreen, windows.
I solved it by adding on the beginning of my script:
unsetenv("QT_PLUGIN_PATH");
Without this line, AppCSXCAD.exe tries to use the version of Qt shipped with Octave.

Hale_812
Posts: 173
Joined: Fri 13 May 2016, 02:54

Re: Bug fix for Qt problem

Post by Hale_812 » Wed 16 Dec 2020, 05:23

Interesting.
And what is inside QT_PLUGIN_PATH ?

F4INX
Posts: 7
Joined: Tue 15 Dec 2020, 18:25

Re: Bug fix for Qt problem

Post by F4INX » Thu 24 Dec 2020, 00:23

Hale_812 wrote:
Wed 16 Dec 2020, 05:23
Interesting.
And what is inside QT_PLUGIN_PATH ?
The path of the Qt installation of Octave's gui.

thorsten
Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Bug fix for Qt problem

Post by thorsten » Sat 02 Jan 2021, 14:43

I think putting this line in the "CSXGeomPlot" function itself is the best solution?

Code: Select all

else % assume windows
    unsetenv("QT_PLUGIN_PATH"); 
    AppCSXCAD_bin = searchBinary('AppCSXCAD.exe',[dir filesep '..' filesep]);
end

F4INX
Posts: 7
Joined: Tue 15 Dec 2020, 18:25

Re: Bug fix for Qt problem

Post by F4INX » Sun 10 Jan 2021, 16:34

I will try that. If this works, would you consider putting this change in next release ?

schuph
Posts: 2
Joined: Thu 04 Feb 2021, 11:07

Re: Bug fix for Qt problem

Post by schuph » Thu 04 Feb 2021, 11:26

I installed Octave and openEMS (v0.0.35-65) yesterday and noticed the same issue as mentioned above when going through first steps tutorial. So I followed thorsten's suggestion.
thorsten wrote:
Sat 02 Jan 2021, 14:43
I think putting this line in the "CSXGeomPlot" function itself is the best solution?

Code: Select all

else % assume windows
    unsetenv("QT_PLUGIN_PATH"); 
    AppCSXCAD_bin = searchBinary('AppCSXCAD.exe',[dir filesep '..' filesep]);
end
In my case QT_PLUGIN_PATH = "C:\Users\schuph\AppData\Local\Programs\GNU Octave\Octave-6.1.0\mingw64\qt5\plugins\platforms".
Unfortunately doing this did not make any difference. Loading Qt platform plugin "windows" still wasn't possible.

Next thing I tried was following the suggestion on: https://derpfaff.de/2016/03/qt-fehler-b ... s-windows/. So I copied the platforms folder in the same directory as AppCSXCAD.exe and tried again. No success. Did I do anything wrong?

rml
Posts: 18
Joined: Fri 17 Aug 2012, 14:18

Re: Bug fix for Qt problem

Post by rml » Fri 05 Feb 2021, 23:49

At least that's how it works for me now:

Code: Select all

%View_CSX

%oe_ver='v0035-62';
oe_ver='v0035-65';

old_qt_plugin_path=getenv('QT_PLUGIN_PATH');
setenv('QT_PLUGIN_PATH',['E:\\p\\openEMS\\' oe_ver '\\qt5\\plugins']);
oldpath=addpath(['E:\p\openEMS\' oe_ver '\matlab']);

[CSX_xml, CSX_path]=uigetfile ("*.xml")
CSXGeomPlot([CSX_path '/' CSX_xml]);

setenv("QT_PLUGIN_PATH", old_qt_plugin_path)
path(oldpath);
The two suggestions had no effect in my case either. Good luck!

However, a "vtkOutputWindow" appears:

Code: Select all

...
ERROR: In ../../../VTK-8.2.0/Rendering/OpenGL2/vtkShaderProgram.cxx, line 447
vtkShaderProgram (0x5b64f70): 

ERROR: In ../../../VTK-8.2.0/Rendering/OpenGL2/vtkShaderProgram.cxx, line 446
vtkShaderProgram (0x5b64f70): 1: #version 140
2: #ifndef GL_ES
3: #define highp
4: #define mediump
5: #define lowp
6: #endif // GL_ES
7: #define attribute in
8: #define varying out
9: 
10: 
11: /*=========================================================================
12: 
13:   Program:   Visualization Toolkit
14:   Module:    vtkPolyData2DVS.glsl
15: 
16:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
17:   All rights reserved.
18:   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
19: 
20:      This software is distributed WITHOUT ANY WARRANTY; without even
21:      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22:      PURPOSE.  See the above copyright notice for more information.
23: 
24: =========================================================================*/
25: 
26: // all variables that represent positions or directions have a suffix
27: // indicating the coordinate system they are in. The possible values are
28: // MC - Model Coordinates
29: // WC - WC world coordinates
30: // VC - View Coordinates
31: // DC - Display Coordinates
32: 
33: in vec4 vertexWC;
34: 
35: // material property values
36: //VTK::Color::Dec
37: 
38: // Texture coordinates
39: in vec2 tcoordMC; out vec2 tcoordVCVSOutput;
40: 
41: // Apple Bug
42: //VTK::PrimID::Dec
43: 
44: uniform mat4 WCVCMatrix;  // World to view matrix
45: 
46: void main()
47: {
48:   // Apple Bug
49:   //VTK::PrimID::Impl
50: 
51:   gl_Position = WCVCMatrix*vertexWC;
52:   tcoordVCVSOutput = tcoordMC;
53:   //VTK::Color::Impl
54: }
...
Fortunately, you can simply close it.

schuph
Posts: 2
Joined: Thu 04 Feb 2021, 11:07

Re: Bug fix for Qt problem

Post by schuph » Tue 09 Feb 2021, 16:55

Where did you paste this code? Also in CSXGeomPlot.m? I'd really appreciate some explanation on what you did there. What confuses me the most is the definition of "oe_ver". Are you using multiple openEMS versions? In my case the path reads like ...\openEMS\qt5\plugins. Thank you! :)

rml
Posts: 18
Joined: Fri 17 Aug 2012, 14:18

Re: Bug fix for Qt problem

Post by rml » Tue 09 Feb 2021, 23:12

Hi,
it's true, I have several versions installed in parallel. That's why the paths look a bit unusual on my end. It is also true that my code snippet is not entirely self-explanatory ;)
Well, here is a CSXGeomPlot test version where the Octave QT5 path gets only temporarily replaced by the openEMS QT5 path.
CSXGeomPlot.m
(1.34 KiB) Downloaded 134 times

thorsten
Posts: 1438
Joined: Mon 27 Jun 2011, 12:26

Re: Bug fix for Qt problem

Post by thorsten » Sun 14 Feb 2021, 17:25

Hi there,

can you try to change the qt.conf file in the openEMS folder?
Adding the last line as below?:

Code: Select all

[Paths]
Prefix  = ./qt5
Plugins = ./qt5/plugins
I'm a bit puzzled why Qt is unable to find it's plugins. Of course newer Octave versions cause this because they have changed/set this environment variables.

Additionally can you tell me if just removing the env variables solves it or not (with and without the above added line). Just adding this line to the qt.conf would be a nicer solution then doing it inside the CSXGeomPlot.m

I currently don't have a windows machine to test for myself.

Thanks
Thorsten

Post Reply