For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

(samples) Tutorial GUI: 1. Shows No Icons, 2. > MNU_NEW Reports Errors;

Steve Petrie's picture
Forums: 

Greetings to Open CASCADE Forum from an OCCT newbie ...

Operating Environment:

   Linux Debian 9

   OpenCASCADE-7.3.0 (built from source using cmake-gui & make)

   Open CASCADE Tutorial (built from source using Code::Blocks: 0 errors, 0 warnings)

Debian Packages Installed as OCCT prerequisites::

apt-get install g++
apt-get install libfreetype6-dev
apt-get install libftgl2
apt-get install tcl-dev
apt-get install tk-dev
apt-get install libgl-dev
apt-get install libfreeimage-dev
apt-get install libgl2ps-dev
apt-get install libvtk6.3
apt-get install doxygen
apt-get install qtdeclarative5-dev
apt-get install libxmu-dev
apt-get install libxi-dev

Problem With Execution:

The Tutorial starts and displays its main window. And does respond to mouse clicks on menu items.

However -- there are two (2) problems:

Problem #1: The Tutorial window shows no graphic icons

Only textual substitutes appear e.g.  MNU_FILE, MNU_VIEW, etc.

Problem #2:  Actioning a Tutorial menu item generates error messages in the console window from which the Tutorial was launched.

For example:

> MNU_NEW (opens a Document:1.1 window inside the main Tutorial window)

x Document:1.1 window (close Document:1.1 window)

x main window(close main window)

Reports Errors In The bash shell console window:
=============================
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug# ./run_tutorial.sh
START: run_tutorial.sh ...
START: env.sh ...
START: custom.sh ...
... FINISH: custom.sh
... FINISH: env.sh
SESSION_MANAGER=
QTDIR=/usr/lib/x86_64-linux-gnu/qt5
PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
STATION=Linux
RES_DIR=/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug/Linux/res
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
TKOpenGl | Type: Other | ID: 0 | Severity: Medium | Message:
  OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer
QObject::connect: No such signal QMdiArea::windowActivated (QWidget*) in /home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/Common/ApplicationCommon.cxx:421

... FINISH: run_tutorial.sh
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug#
=============================

There are graphic image files present:
=============================
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug/res# ls -lv
total 152
-rwxrwxrwx 1 steve steve  284 May 25 15:13 Bottle.png
-rwxrwxrwx 1 steve steve  342 May 25 15:13 SampleImportExport.png
-rwxrwxrwx 1 steve steve  230 May 25 15:13 antialiasing.png
-rwxrwxrwx 1 steve steve  225 May 25 15:13 cascade.png
-rwxrwxrwx 1 steve steve  212 May 25 15:13 close.png
-rwxrwxrwx 1 steve steve  291 May 25 15:13 cursor_rotate.png
-rwxrwxrwx 1 steve steve  245 May 25 15:13 cursor_zoom.png
-rwxrwxrwx 1 steve steve  241 May 25 15:13 document.png
-rwxrwxrwx 1 steve steve  214 May 25 15:13 help.png
-rwxrwxrwx 1 steve steve 1355 May 25 15:13 lamp.png
-rwxrwxrwx 1 steve steve  177 May 25 15:13 new.png
-rwxrwxrwx 1 steve steve  223 May 25 15:13 raytracing.png
-rwxrwxrwx 1 steve steve  217 May 25 15:13 reflections.png
-rwxrwxrwx 1 steve steve  264 May 25 15:13 shadows.png
-rwxrwxrwx 1 steve steve  199 May 25 15:13 tile.png
-rwxrwxrwx 1 steve steve  256 May 25 15:13 tool-shading.png
-rwxrwxrwx 1 steve steve  288 May 25 15:13 tool_color.png
-rwxrwxrwx 1 steve steve  203 May 25 15:13 tool_delete.png
-rwxrwxrwx 1 steve steve  293 May 25 15:13 tool_material.png
-rwxrwxrwx 1 steve steve  256 May 25 15:13 tool_shading.png
-rwxrwxrwx 1 steve steve  318 May 25 15:13 tool_transparency.png
-rwxrwxrwx 1 steve steve  259 May 25 15:13 tool_wireframe.png
-rwxrwxrwx 1 steve steve  392 May 25 15:13 view_axo.png
-rwxrwxrwx 1 steve steve  233 May 25 15:13 view_back.png
-rwxrwxrwx 1 steve steve  233 May 25 15:13 view_bottom.png
-rwxrwxrwx 1 steve steve  199 May 25 15:13 view_comp_off.png
-rwxrwxrwx 1 steve steve  180 May 25 15:13 view_comp_on.png
-rwxrwxrwx 1 steve steve  231 May 25 15:13 view_fitall.png
-rwxrwxrwx 1 steve steve  224 May 25 15:13 view_fitarea.png
-rwxrwxrwx 1 steve steve  238 May 25 15:13 view_front.png
-rwxrwxrwx 1 steve steve  205 May 25 15:13 view_glpan.png
-rwxrwxrwx 1 steve steve  231 May 25 15:13 view_left.png
-rwxrwxrwx 1 steve steve  178 May 25 15:13 view_pan.png
-rwxrwxrwx 1 steve steve  204 May 25 15:13 view_reset.png
-rwxrwxrwx 1 steve steve  230 May 25 15:13 view_right.png
-rwxrwxrwx 1 steve steve  224 May 25 15:13 view_rotate.png
-rwxrwxrwx 1 steve steve  235 May 25 15:13 view_top.png
-rwxrwxrwx 1 steve steve  222 May 25 15:13 view_zoom.png
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug/res#
=============================

I attach:
   -- The three (3) relevant shell script files;
   -- An image of the Tutorial window;

Suggestions / comments welcome !!

Steve

Steve Petrie's picture

I have made some progress in diagnosing this problem.

In source code file samples/qt/Tutorial/src/Main.cxx there are four (4) calls to member function load(...) in instances of Qt class QTranslator.

Here is a snippet with all four (4) of these calls:

=============================

    QString resTutDir = ApplicationTut::getTutResourceDir();QTranslator strTrans( 0 );
    Standard_Boolean isOK = strTrans.load( "Common-string", resDir );
    if( isOK )
      a.installTranslator( &strTrans );

    QTranslator iconTrans( 0 );
    isOK = iconTrans.load( "Common-icon", resDir );
    if( isOK )
      a.installTranslator( &iconTrans );

    QTranslator strTutTrans( 0 );
    isOK = strTutTrans.load( "Tutorial-string", resTutDir );
    if( isOK )
      a.installTranslator( &strTutTrans );

    QTranslator iconTutTrans( 0 );
    isOK = iconTutTrans.load( "Tutorial-icon", resTutDir );
    if( isOK )
      a.installTranslator( &iconTutTrans );

=============================

Note: there is no "else" clause with the " if( isOK )" conditional statements, so a failure to load(...) the related item:

1. is silently ignored;

2. does not stop execution of the program.

* * *

* * *

I have introduced diagnostic reporting for these four(4) calls to load(...), revealing that in fact the load(..) calls are all failing.

Here is the modified first call to the load(...) member function.

=============================
QTranslator strTrans( 0 );
// 20180705 steve ...
Standard_Boolean isOK = strTrans.load( "/home/steve/apps/OpenCASCADE-7.3.0/_download/opencascade-7.3.0/samples/qt/Common/src/Common-string.ts" );
//  Standard_Boolean isOK = strTrans.load( "Common-string", resDir, "", ".ts" );
//  Standard_Boolean isOK = strTrans.load( "Common-string", resDir );
//  Standard_Boolean isOK = strTrans.load( "Common-string.ts", resDir );
    // ... steve.
    if( isOK )
    // 20180705 steve ...
      {a.installTranslator( &strTrans );}
    else {const std::string CoutMsg3("FAILED TO LOAD <Common-string>"); cout << CoutPfx + CoutMsg3 << endl;}
    // ... steve.
=============================

* * *

* * *

Here is paste from the bash shell console window, from which the Tutorial executable is launched:

=============================
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug# ./run_tutorial.sh
START: run_tutorial.sh ...
START: env.sh ...
START: custom.sh ...
... FINISH: custom.sh
... FINISH: env.sh
---------------------
Environment Variables:
---------------------
SESSION_MANAGER=
QTDIR=/usr/lib/x86_64-linux-gnu/qt5
PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
STATION=Linux
RES_DIR=/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug/res
---------------------
CASROOT=
---------------------
CSF_ResourcesDefaults=/home/steve/apps/OpenCASCADE-7.3.0/_download/opencascade-7.3.0/samples/qt
CSF_XmlOcafResource=
CSF_MDTVTexturesDirectory=
CSF_ShadersDirectory=
---------------------
CSF_OCCTBinPath=
CSF_OCCTLibPath=
CSF_OCCTIncludePath=
CSF_OCCTResourcePath=
CSF_OCCTDataPath=
CSF_OCCTSamplesPath=
CSF_OCCTTestsPath=
CSF_OCCTDocPath=
---------------------
TCL_DIR=
TCL_VERSION_WITH_DOT=
TK_DIR=
TK_VERSION_WITH_DOT=
FREETYPE_DIR=
FREEIMAGE_DIR=
GL2PS_DIR=
TBB_DIR=
VTK_DIR=
FFMPEG_DIR=
---------------------
Main.cxx:main(...):   resDir</home/steve/apps/OpenCASCADE-7.3.0/_download/opencascade-7.3.0/samples/qt/Common/src>
Main.cxx:main(...):resTutDir</samples>
Main.cxx:main(...):FAILED TO LOAD <Common-string>
Main.cxx:main(...):FAILED TO LOAD <Common-icon>
Main.cxx:main(...):FAILED TO LOAD <Tutorial-string>
Main.cxx:main(...):FAILED TO LOAD <Tutorial-icon>
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
TKOpenGl | Type: Other | ID: 0 | Severity: Medium | Message:
  OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer
QObject::connect: No such signal QMdiArea::windowActivated (QWidget*) in /home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/Common/ApplicationCommon.cxx:421
... FINISH: run_tutorial.sh
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/bin/Debug#
=============================

Note the diagnostic messages produced by my modifications to Main.cxx:

=============================
Main.cxx:main(...):   resDir</home/steve/apps/OpenCASCADE-7.3.0/_download/opencascade-7.3.0/samples/qt/Common/src>
Main.cxx:main(...):resTutDir</samples>
Main.cxx:main(...):FAILED TO LOAD <Common-string>
Main.cxx:main(...):FAILED TO LOAD <Common-icon>
Main.cxx:main(...):FAILED TO LOAD <Tutorial-string>
Main.cxx:main(...):FAILED TO LOAD <Tutorial-icon>
=============================

I have tried many different values for the parameters of the call to load(...), but nothing seems to work.

Since the load(...) member function returns only a boolean result, no details are available indicating the cause of the failure.

Next, I am going to examine the source code of the load(...) function to try to determine the cause of the load failures.

Meanwhile, any comments / suggestions from Forum members would be greatly appreciated !!

Steve

Steve Petrie's picture

I have made more progress in diagnosing problems with building and running the Open CASCADE 7.3.0 Qt Tutorial (samples/qt/) on Linux Debian 9.

These error messages, as well as subsequent ones revealed (also related to loading *.qm files), are now gone:
...
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
QCursor: Cannot create bitmap cursor; invalid bitmap(s)
...

* * *

The Qt Tutorial GUI now displays icon graphics, instead of the upper-case textual substitutions, that were previously-appearing.

See attached  screen snapshots:
01_Screenshot from 2018-07-17 17-39-02.png -- initial main window display;
02_Screenshot from 2018-07-17 17-42-03.png -- with empty new window "Document 1:1";

* * *

The MakeBottle button now works, displaying the bottle in 3D in the "Document 1:1" window. Various views of the bottle are available by clicking buttons.

See attached screen snapshots:
03_Screenshot from 2018-07-17 17-44-59.png -- with bottle newly created;
04_Screenshot from 2018-07-17 17-46-37.png -- different view of the bottle;

* * *
* * *

However, some problems remain to be fixed:

1. Error messages appearing in the console window of the shell from which the Qt Tutorial is launched:
...
libpng warning: bKGD: invalid index
TKOpenGl | Type: Other | ID: 0 | Severity: Medium | Message:
  OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer
QObject::connect: No such signal QMdiArea::windowActivated (QWidget*) in /home/steve/apps/OpenCASCADE-7.3.0/_test/Open CASCADE Tutorial/Common/src/ApplicationCommon.cxx:421

...

These error messages appear in the shell console window, when the New button is clicked on the main window menu.

The "libpng warning: bKGD: invalid index" message: is a known minor problem. a broken icon file (view_pan.png). The generic substitution icon is sufficient for now.

The "OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer" message: is indicating some failure in the functionality of OpenGL rendering.

And there is indeed a rendering failure, when the window displaying the perfectly-rendered initial view of the bottle, is resized by e.g. dragging out the lower right corner of the "Document 1:1" window.

Even while the mouse drag is in progress, and after the drag button is released, a corrupted rendering starts to appear in the lower right corner of the window, and in a few seconds, has progressed to the window's top left corner. eventually completely replacing the image of the bottle with garbage.

See screen snapshots:
05_Screenshot from 2018-07-17 17-48-11.png -- window dragged (image shrinking, mouse button still down);
06_Screenshot from 2018-07-17 17-48-15.png -- window dragged (image shrinking, mouse button still down);
07_Screenshot from 2018-07-17 17-48-29.png -- window drag released (image shrinking);
08_Screenshot from 2018-07-17 17-48-36.png -- window drag released (image shrinking completed);

* * *
* * *

Inspection of function OpenGl_Window.cxx:OpenGl_Window::CreateWindow(...) reveals that the specific OpenGL visual being chosen for window "Document 1:1", depends on the value of a C++ macro variable: HAVE_EGL, which, when defined, selects very different source code to be compiled, than when not defined:

...
#if defined(HAVE_EGL)
...
#if defined(HAVE_EGL)
...

Grep-ping the Open CASCADE source librarie, reveals four (4) *.cxx source files that make reference to this HAVE_EGL macro variable:
...
./src/OpenGl/OpenGl_Window.cxx
./src/OpenGl/OpenGl_GraphicDriver.cxx
./src/OpenGl/OpenGl_Context.cxx
./src/Xw/Xw_Window.cxx
...

**HOWEVER** in the occurences of macro variable HAVE_EGL found by grep, all are in conditional tests of various forms, and **NONE** are defining the variable itself.

For example:

...
root@debian1:/home/steve/apps/OpenCASCADE-7.3.0/_download/opencascade-7.3.0# grep -Fnr --include=inc/* --include=src/* --include=*.h --include=*.c?? --color "HAVE_EGL" .
./src/OpenGl/OpenGl_Window.cxx:32:#if defined(HAVE_EGL)
...
./src/OpenGl/OpenGl_Window.cxx:683:#if !defined(_WIN32) && !defined(HAVE_EGL)
...
./src/OpenGl/OpenGl_GraphicDriver.cxx:51:#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
...
./src/Xw/Xw_Window.cxx:25:#if defined(HAVE_EGL) || defined(HAVE_GLES2)
...
./src/Xw/Xw_Window.cxx:267:#if !defined(HAVE_EGL) && !defined(HAVE_GLES2)
...

So, one (1) task, is to resolve the mystery of: where does macro variable HAVE_EGL (and HAVE_GLES2) get defined ??

* * *
* * *

My plan for addressing both:

1. the bottle image rendering corruption malfunction, and

2. the error message "OpenGl_Window::CreateWindow: window Visual is incomplete: no depth buffer, no stencil buffer",

has two (2) parts:

==> 1. create a new CodeBlocks project:

For building replacement object files. from the following four (4) source code files, with macro variable HAVE_EGL (and HAVE_GLES2 ??) defined:
...
./src/OpenGl/OpenGl_Window.cxx
./src/OpenGl/OpenGl_GraphicDriver.cxx
./src/OpenGl/OpenGl_Context.cxx
./src/Xw/Xw_Window.cxx
...

==> 2. install whatever currently missing debian packages, are necessary to facilitate the building of the four (4) above-mentioned C++ source files:

For example:
...
libegl1
libegl1-mesa:amd64
libegl1-mesa-dev
libegl1-mesa-drivers
libqt5egldevic
libegl1-mesa-d
libegl1-x11
libgegl-dev
libgl1-mesa-glx
...

I attach ten (10) files to this forum posting:
...
-- images of the Tutorial GUI:
01_Screenshot from 2018-07-17 17-39-02.png -- initial main window display;
02_Screenshot from 2018-07-17 17-42-03.png -- with emoty new window "Document 1:1";
03_Screenshot from 2018-07-17 17-44-59.png -- with bottle newly created;
04_Screenshot from 2018-07-17 17-46-37.png -- different view of the bottle;
05_Screenshot from 2018-07-17 17-48-11.png -- window dragged (image shrinking, mouse button still down);
06_Screenshot from 2018-07-17 17-48-15.png -- window dragged (image shrinking, mouse button still down);
07_Screenshot from 2018-07-17 17-48-29.png -- window drag released (image shrinking);
08_Screenshot from 2018-07-17 17-48-36.png -- window drag released (image shrinking completed);
...
-- OpenGL & Xorg -related:
glxinfo.txt
Xorg.0.log </home/steve/.local/share/xorg/>
...

* * *
* * *

Suggestions / comments / questions welcome !!

Steve