MantisBT - Community
View Issue Details
0021985Community[OCCT] OCCT:Visualizationpublic2010-08-26 18:142013-04-29 15:21
Windows NT
[OCCT] 6.6.0[OCCT] 6.6.0 
0021985: Vista/WIndows 7 compatibility issues reported by the community
There are several compatibility issues reported by the community for OCCT
visualization component.

1. OCC 6.3.1 Windows7 bug

In order to be able to load one of our OCC based DLL’s in Windows 7, we needed
to modify src\Graphic3d\Graphic3d_WNTGraphicDevice.cxx.

Around line 51 we changed:

  Standard_CString TheShr = getenv("CSF_GraphicShr");
  if ( ! TheShr )
    TheShr = "TKOpenGl.dll";


  Standard_CString TheShr = getenv("CSF_GraphicShr");
  if ( ! TheShr || (strcmp(TheShr,"")==0) )
    TheShr = "TKOpenGl.dll";


SAN: I believe strlen(TheShr) == 0 is a more natural way to check for an empty

2. About compatibility with Windows 7


I have now compiled under Windows 7, using OpenCascade 6.3.0
I have noticed the following problem:

The function WNT_Window:: Dump does not work correctly.
This function is used in the MFC standard example 01_Geometry, where it
is called from menu option File>>Export>>Image...
The problem is that instead of the correct image of the drawing window
it produces an empty grey image.

The same problem exists in Windows Vista.
There is no problem for Windows XP.


SAN: In order to approach the problem, it is necessary to revise all OCCT API
methods related to 2D/3D scene dump creation and eliminate duplicated
functionality (if any) in WNT/Xw/OpenGl packages, keeping e.g. only the
following imlementations (to be discussed):
- Reading window pixels directly.
- Redrawing window contents to an off-screen bitmap (suitable for non-OpenGL
scene only!).
- Redrawing OpenGL scene contents to a framebuffer object (FBO) and reading its
No tags attached.
tar psn_OCC21985_v1_1.tar (10,240) 2010-08-27 10:53
Issue History
2010-08-26 19:06sanCC => psn
2010-08-27 10:58bugmasterAssigned Tobugmaster => psn
2010-08-27 10:58bugmasterStatusnew => assigned
2011-08-02 11:24bugmasterCategoryOCCT:VIZ => OCCT:Visualization
2012-01-13 15:53ysnProjectOpen CASCADE => Community
2012-02-06 08:24abvNote Added: 0019400
2012-10-23 11:25abvAssigned Topsn =>
2012-10-23 11:25abvFixed in VersionEMPTY =>
2012-10-23 11:25abvTarget Version => Unscheduled
2012-10-23 11:25abvDescription Updatedbug_revision_view_page.php?rev_id=4381#r4381
2012-11-13 20:19sanAssigned To => abdelrazzak
2012-11-13 20:19sanAssigned Toabdelrazzak => aba
2012-11-14 15:29sanNote Added: 0022240
2012-11-15 11:38abaNote Added: 0022256
2012-11-15 11:38abaAssigned Toaba => san
2012-11-15 11:38abaStatusassigned => resolved
2012-11-15 19:08sanNote Added: 0022273
2012-11-15 19:08sanAssigned Tosan => aba
2012-11-15 19:08sanStatusresolved => assigned
2012-11-20 10:53abaNote Added: 0022303
2012-11-20 10:54abaAssigned Toaba => san
2012-11-20 10:54abaStatusassigned => resolved
2012-11-20 15:40kgvNote Added: 0022311
2012-11-20 15:40kgvAssigned Tosan => aba
2012-11-20 15:40kgvStatusresolved => assigned
2012-11-21 10:48sanNote Added: 0022321
2012-11-21 11:33kgvNote Added: 0022325
2012-11-21 18:53abaNote Added: 0022336
2012-11-21 18:53abaAssigned Toaba => san
2012-11-21 18:53abaStatusassigned => resolved
2012-11-21 21:40sanNote Added: 0022337
2012-11-21 21:40sanAssigned Tosan => bugmaster
2012-11-21 21:40sanStatusresolved => reviewed
2012-12-05 11:09sanNote Added: 0022561
2012-12-05 11:09sanStatusreviewed => feedback
2012-12-05 11:15kgvTarget VersionUnscheduled => 6.6.0
2012-12-05 16:36sanNote Added: 0022571
2012-12-05 16:36sanStatusfeedback => assigned
2012-12-05 16:36sanAssigned Tobugmaster => aba
2012-12-05 17:32abaNote Added: 0022575
2012-12-05 17:33abaAssigned Toaba => san
2012-12-05 17:33abaStatusassigned => resolved
2012-12-06 15:28sanNote Added: 0022593
2012-12-06 15:28sanAssigned Tosan => bugmaster
2012-12-06 15:28sanStatusresolved => reviewed
2012-12-07 14:21bugmasterStatusreviewed => tested
2012-12-10 17:16abaChangeset attached => occt master 3994ec41
2012-12-10 17:16abaAssigned Tobugmaster => aba
2012-12-10 17:16abaStatustested => verified
2012-12-10 17:16abaResolutionopen => fixed
2013-04-23 13:37aivStatusverified => closed
2013-04-29 15:21aivFixed in Version => 6.6.0

2012-02-06 08:24   
As of OCCT 6.5.2: point 1 is fixed, point 2 is still there
2012-11-14 15:29   
Dear aba,

Could you, please, review OCCT samples and replace all occurrences of WNT_Window::Dump() with V3d_View::ToPixMap() calls?
2012-11-15 11:38   
In OCCT samples with 3d visualization all WNT_Window::Dump method calls were replaced with V3dView::Dump method calls.

In 2d visualization OCCT sample Viewer2d in OCC_2dView.cpp WNT_Window::Dump method call wasn't replaced.

The methods WNT_Window::Dump and V3dView::Dump were checked:
OnFileExportImage() message handlers provide possibility to export models in files with .bmp, .gif and .xwd extensions, but during image saving (in Image_AlienPixMap::Save method) FreeImage_GetFIFFromFilename method recognizes .xwd extension as FIF_UNKNOWN and therefore it isn't possible to export in .xwd file.

The Git branch CR21985 is ready to be reviewed.
Dear san. please review.
2012-11-15 19:08   
Branch CR21985 reviewed with the following remark.

Modified files:


now contain the same line:


C-style casting to Standard_CString from LPCTSTR that can point to a Unicode string if UNICODE is defined is unsafe.
KGV suggests removing both casts:


In such a case compiler will inform a developer if an attempt to pass a Unicode string to non-Unicode function is being made.
Otherwise, corrupted Unicode data will be passed as a regular C-style string to V3d_View::Dump() method.
2012-11-20 10:53   
The Git branch CR21985 was updated.
Casts to LPCTSTR and Standard_CString were removed.

Dear san, please review.
2012-11-20 15:40   
Dear aba,

In file OCC_3dView.cpp, 155-182:
> filter = _T("BMP Files (*.BMP)|*.bmp|GIF Files (*.GIF)|*.gif|XWD Files
>(*.XWD)|*.xwd|PS Files (*.PS)|*.ps|EPS Files (*.EPS)|*.eps|TEX Files
>(*.TEX)|*.tex|PDF Files (*.PDF)|*.pdf|SVG Files (*.SVG)|*.svg|PGF Files
> ...
> char* theFile = new char[filename.GetLength()+1];
> //_tcscpy(theFile,filename);
> strcpy_s(theFile,filename.GetLength()+1,filename);
> CString ext = dlg.GetFileExt();
> if (ext == "ps" || ext == "emf")
> {
It seems that this extension detection is incomplete:
- SetCursor() is not called within Export() scenario.
- Export function should be used for extensions PS, EPS, TEX, PDF, SVG, PGF, EMF.
- String comparison should be case-insensitive.
- theFile variable looks redundant here.
- Please rename "filename" variable to "aFileName".

File AnimationView3D.cpp, 241-244 and GeometryView.cpp, 80-83, OCC_3dView.cpp:
>void CAnimationView3D::OnFileExportImage()
> OFN_OVERWRITEPROMPT, _T("BMP Files (*.BMP)|*.bmp |GIF Files (*.GIF)|*.gif
>| XWD Files (*.XWD)|*.xwd||"), NULL );
Please extend list of supported extensions (based on FreeImage).
2012-11-21 10:48   
Just a question to everybody: is the list of supported export image file formats documented anywhere?
Or should one check vdump DRAW command of FreeImage headers each time?
Is not it worth adding this information to Image_AlienPixMap.hxx?
2012-11-21 11:33   
Dear aba,

please add information about following supported formats to Image_AlienPixMap documentation and use it in the samples (notice that there are no XWD format):
*.bmp - bitmap image, lossless format without compression.
*.ppm - PPM (Portable Pixmap Format), lossless format without compression.
*.png - PNG (Portable Network Graphics) lossless format with compression.
*.jpg, *.jpe, *.jpeg - JPEG/JIFF (Joint Photographic Experts Group) lossy format (compressed with quality losses). YUV color space used (automatically converted from/to RGB).
*.tif, *.tiff - TIFF (Tagged Image File Format).
*.tga - TGA (Truevision Targa Graphic), lossless format.
*.gif - GIF (Graphical Interchange Format), lossy format. Color stored using pallete (up to 256 distinct colors).
*.exr - OpenEXR high dynamic-range format (supports float pixel formats).
2012-11-21 18:53   
The Git granch CR21985 was modified.

In files OCC_3dView.cpp, AnimationView3D.cpp and GeometryView.cpp:
  1)in OnFileExportImage() methods lists of supported extensions were extended according to FreeImage supported image formats.
  2)'filename' variable was renamed to 'aFileName'

In OCC_3dView.cpp:
1)In Export() function is used for PS, EPS, TEX, PDF, SVG, PGF and EMF extensions.
2)In condition checking supported for Export() function formats case-insensitive string comparison was added.
3) 'theFile' variable was removed, and the only 'aFileName' variable is used for both Export() and Dump() methods

Please review.
2012-11-21 21:40   
Branch CR21985 reviewed without remarks, ready for testing.
2012-12-05 11:09   
Dear bugmaster,

Why this issue is suspended?
Note that it has been waiting for testing for two weeks.
2012-12-05 16:36   
Dear aba,

Could you please update the supported image file types and file filters for 2D viewer samples, too?
2012-12-05 17:32   
The supported image file filter for 2d samples in OCC_2dView::OnFileExportImage() method was extended with formats supported by FreeImage (bmp, gif, png, jpeg, ppm, tiff, tga, exr).

The Git branch CR21985 was updated.
Dear san, please review.
2012-12-06 15:28   
Branch CR21985 reviewed without remarks, ready for testing.