MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022337Community[OCCT] OCCT:Visualizationpublic2011-03-21 19:022012-03-29 17:26
Reporterszy 
Assigned Tobugmaster 
PrioritynormalSeveritytrivial 
StatusclosedResolutionfixed 
PlatformOSAllOS Version
Product Version 
Target Version[OCCT] 6.5.2Fixed in Version[OCCT] 6.5.2 
Summary0022337: V3d_View::Print crashes in OCCT 6.5.0
DescriptionPost http://www.opencascade.org/org/forum/thread_20240/. [^]
Additional information
and documentation updates
Documentation remark, added by apl 2011-05-26 17:43:39:

Improvements:
The printing operation under Windows has been completely redesigned.
Now it uses the off-screen buffer (frame buffer object) for rendering that makes
the result independent from the current 3D view dimensions.

The new option has been added to the print method. It is possible now to
choose between two print algorithms that define how the 3D scene is mapped to
the print area when the maximum dimensions of the frame buffer are smaller than
the dimensions of the print area.

One option is to use the newly implemented TileSplit algorithm.
This algorithm allows you to cover the whole printing area by rendering
multiple parts of the viewer. Theoretically, this means that any printing
resolution could be achieved without stretching, to avoid image quality loss.
This algorithm prints parts of the 3D scene in maximum possible resolution into
an off-screen buffer, and when copies them to the printing area, covering it by
a sort of tiling.

Another option is to draw the 3D scene using maximum supported frame buffer size
and then stretch the image to the whole printing area.
The stretching functionality provided by FreeImage is applied with the bicubic
interpolation.

If print method was used in the code of your application, you might need to
revise it to take into account the ability to choose between print algorithms.
The stretching will be selected by default when porting your application.

The new printing approach has been tested with A4 paper size and resolution of
1200 dpi (180 lpi).

Changes:
There are following changes in packages:
OpenGl package:

1) The call_togl_print function has been modified, now it uses the off-screen
buffer for rendering the viewer’s content. Two print algorithms have been
implemented: stretch algorithm and the tile algorithm. Stretch algorithm prints
the viewer’s content into off-screen buffer and then stretches the result if its
size smaller than printing area. Tile algorithm covers the whole printing area
by rendering parts of the viewer in a maximum possible resolution. New parameter
has been added to call_togl_print: const int printmode.
This method now returns true/false to indicate if the print data has been successfully sent to the printer or not.

2) The new class OpenGl_PrinterContext has been implemented. This class provides
the specific printing information to the OpenGl redraw procedure. The instance
of this class can be created only in call_togl_print method and can be obtained
by the OpenGl_PrinterContext::GetPrinterContext() method. The printer context is
associated with the OpenGL rendering context for better robustness.

3) TelSetViewIndex, call_togl_redraw_layer2d, OpenGl_TextRender::RenderText
function (methods) have been modified to use printing information provided by
OpenGl_PrinterContext instance.

4) The new parameter has been added to OpenGl_GraphicDriver::Print method: const
Aspect_PrintAlgo printAlgorithm. This parameters allows to select print
algorithm. Additional parameter has been added: theScaleFactor - it is internally used to provide scaling information that is selected in print parameters dialog. This method now returns Standard_True/Standard_False to indicate is the print data has been successfully sent to the printer.

Aspect package:
1) The new enumeration has been added: Aspect_PrintAlgo. This enumeration
defines the print algorithms.

Graphic3d package:
1) The new parameter has been added to Graphic3d_GraphicDriver::Print method:
const Aspect_PrintAlgo printAlgorithm. This parameters allows to select print
algorithm. Additional parameter has been added: theScaleFactor - it is internally used to provide scaling information that is selected in print parameters dialog. This method now returns Standard_True/Standard_False to indicate is the print data has been successfully sent to the printer.

Visual3d package:
1) The new parameter has been added to Visual3d_View::Print method: const
Aspect_PrintAlgo printAlgorithm. This parameters allows to select print
algorithm. Additional parameter has been added: theScaleFactor - it is internally used to provide scaling information that is selected in print parameters dialog. This method now returns Standard_True/Standard_False to indicate is the print data has been successfully sent to the printer.

V3d package:
1) The new parameter has been added to V3d_View::Print method: const
Aspect_PrintAlgo printAlgorithm. This parameters allows to select print
algorithm. This method now returns Standard_True/Standard_False to indicate is the print data has been successfully sent to the printer.

ViewerTest package:
1) The new draw command has been added to test print algorithms:
vprintview width height filename [mode=0]
   - Width and height parameters specify the dimensions of the image buffer that
is treated like a usual printing area.
   - Filename is the output file for saving the results. Mode parameters specify
the print algorithm: 0 - stretch, 1 - tile.

Modified entities:
Aspect_PrintAlgo.hxx / Aspect.cdl – the new enumeration has been added.
Graphic3d_GraphicDriver.cdl – new parameters has been added to the Print method, method returns Standard_Boolean.
OpenGl_GraphicDriver.cdl – new parameters has been added to the Print method, method returns Standard_Boolean.
V3d_View.cdl – new parameters has been added to the Print method, method returns Standard_Boolean.
Visual3d_View.cdl – new parameters has been added to both Print methods.
TagsNo tags attached.
Test case numberchl 934 A9
Attached Fileszip file icon test_print.zip (1,381 bytes) 2011-03-21 19:02
gz file icon apl-OCC22337-v1.tar.gz (173,130 bytes) 2011-05-26 13:35
gz file icon apl-OCC22337-v2.tar.gz (172,785 bytes) 2011-05-27 16:45
gz file icon apl-OCC22337-v3.tar.gz (172,660 bytes) 2011-06-10 09:51
gz file icon print22337-script.tar.gz (591 bytes) 2011-08-05 11:30
gz file icon chl_934_A9.tar.gz (638 bytes) 2011-08-31 15:28

- Relationships
related to 0022520closedatp Community Update Visualization Users Guide 
related to 0022582closedbugmaster Open CASCADE Visualization - provide an API for dumping a sub-region of the viewport 
related to 0022696assignedsan Community Image dump of 3D Viewer is limited to Video hardware limits 
related to 0022782closedbugmaster Open CASCADE Uninitialized global variable used in conditionals in OpenGl package 
related to 0023001closedbugmaster Open CASCADE Mistake in OpenGl_FrameBuffer::IsValidDepthBuffer 

-  Notes
(0017913)
miv (tester)
2011-08-05 10:12
edited on: 2011-12-01 11:38

Dear Anton,
 
Provide the test script for this bug.

--
Regards,
Mike

(0017915)
apl (developer)
2011-08-05 11:32

Dear Mikhail,

You can use test script in attachement "print22337-script.tar.gz"
(0017942)
apl (developer)
2011-08-09 14:28

Dear BugMaster,

Please stop tests and integration of this solution.
The DRAW command "vprintview" should be verified and corrected to always return right status (or notification message) when the command fails. (case of lack of RAM memory)
(0017983)
apl (developer)
2011-08-12 12:00

Dear BugMaster,

SVN branch http://svn/svn/occt/branches/OCC22337 [^] has been corrected

The DRAW command "vprintview" now always returns correct result, even if the data hasn't been sent to the printer (but prepared for this operation) due to insufficient memory for print operation.
(0017984)
apl (developer)
2011-08-12 12:34

Dear Sergey,

Could you please review the modifications to the branch:
SVN branch http://svn/svn/occt/branches/OCC22337 [^] and write all your remarks
(0018035)
mkv (tester)
2011-08-30 12:08

Dear Anton,
Please change the status to resolved.
(0018045)
san (developer)
2011-08-31 17:07

Hello Anton,

I have some minor remarks all of "Code style" or "Comment" type.
If you have some time to take them into account quickly (01.09.2011 morning), I would appreciate this.
Otherwise, please simply turn the issue status to "reviewed".

1. OpenGl_GraphicDriver.cdl, v3d_View.cdl
I recommend using standard OpenGL terminology when describing something based on OpenGL features. In particular, "frame buffer" mentioned several times in CDL files might be misleading. "Frame buffer object" or simply "FBO" looks clearer to me.

2. V3d_View.cdl
A similar issue: "Aspect_PA_STRETCH, Aspect_PA_TILE" would be more informative than "stretch, tile" in V3d_View.cdl - do not forget that we document API here, so we should tend to express everything in terms of API namespaces to facilitate work for application developers.

3. V3d_View.cdl - just a question: why not use more accurate Aspect_PA_TILE printing algo by default?
Well, probably I can answer myself...PA_STRETCH is more reliable and will work on any hardware...Is this worth mentioning in CDL documentation?
I would explain this in Aspect.cdl in PA_STRETCH documentation.

4. V3d_View_Print.cxx line 112:

 Standard_Real aScaleFactor = (Standard_Real) aMode->dmScale / 100.0;

Usage of "100.0" magic number is not explained here.

5. V3d_View_Print.cxx lines 110 - 115: indentation settings differ from the rest of the file (spaces used instead of tabs), it would be nice to "untabify" the whole file using appropriate tab size to obtain nice-looking indentation as the result.

6. Aspect.cdl: documentation for PA_STRETCH enumeration item could have a reference to FreeImage library, otherwise it might not be clear why PA_STRETCH produces images of different quality when OCCT is built without FreeImage support. I suggest the following wording:

        -- 1) PA_STRETCH - stretch offscreen printing frame
        -- if its dimensions are smaller than
        -- the printer's printing area dimensions.
        -- Stretching is performed using bicubic
        -- interpolation algorithm from
        -- FreeImage library if OCCT is built
        -- with FreeImage support, otherwise
        -- Windows API StretchBlt() function in
        -- STRETCH_HALFTONE mode is used.

7. OpenGL_TextRender.cxx lines 395 - 396:

        aPrinterContext->GetScale( aTextScalex, aTextScaley );
        glScalef( aTextScaley, aTextScaley, aTextScaley );

Why aTextScalex is not used here? Is it needed at all?
At least a comment could help...

8. OpenGl_togl_begin_layer_mode.cxx lines 303 - 322:
Adding a comment that explains how additional transformations are applied during printing would be helpful.

9. OpenGl_togl_print.cxx
initBufferStretch() - theViewRatio local variable should have "a" prefix instead of "the"

(0018052)
apl (developer)
2011-09-01 13:09
edited on: 2011-11-25 15:00

Dear Bugmaster,

All remarks from SAN has been corrected and branch has been updated

SVN branch http://svn/svn/occt/branches/OCC22337 [^] is ready for testing

(0018069)
ycy (tester)
2011-09-02 14:39
edited on: 2011-11-25 15:01

Dear BugMaster,
SVN branch ( http://svn/svn/occt/branches/OCC22337 [^] ) was
testing, test results were compared with KAS:dev:products-20110810-opt

There are not regressions in SVN branch ( http://svn/svn/occt/branches/OCC22337 [^] ) regarding to
KAS:dev:products-20110810-opt

See results in /QADisk/occttests/results/KAS/dev/ycy-products-2_01092011/lin
See reference results in /QADisk/occttests/results/KAS/dev/products-20110810-opt_11082011/lin
See test cases in /QADisk/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://doc/doku.php?id=occt:certification [^] [^]

(0018080)
bugmaster (administrator)
2011-09-07 11:24

Integration into trunk of occt repository

Date: 2011-09-07 11:16:18 +0400 (Wed, 07 Sep 2011)
New Revision: 8970

Added:
   trunk/src/OpenGl/OpenGl_PrinterContext.cxx
   trunk/src/OpenGl/OpenGl_PrinterContext.hxx
Modified:
   trunk/src/Aspect/Aspect.cdl
   trunk/src/Graphic3d/Graphic3d_GraphicDriver.cdl
   trunk/src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx
   trunk/src/OpenGl/FILES
   trunk/src/OpenGl/OpenGl_GraphicDriver.cdl
   trunk/src/OpenGl/OpenGl_GraphicDriver_print.cxx
   trunk/src/OpenGl/OpenGl_TextRender.cxx
   trunk/src/OpenGl/OpenGl_tgl_funcs.hxx
   trunk/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx
   trunk/src/OpenGl/OpenGl_togl_print.cxx
   trunk/src/OpenGl/OpenGl_view.cxx
   trunk/src/V3d/V3d_View.cdl
   trunk/src/V3d/V3d_View_Print.cxx
   trunk/src/ViewerTest/ViewerTest_ViewerCommands.cxx
   trunk/src/Visual3d/Visual3d_View.cdl
   trunk/src/Visual3d/Visual3d_View_Print.cxx
(0018821)
mkv (tester)
2011-12-12 16:32

*RESTORED*
2011-12-12 08:09 san Relationship added related to 0022696

- Related Changesets
occt: master 7edf74fd
Timestamp: 2011-09-07 07:16:18
Author: apl
Committer: bugmaster
Details ] Diff ]
0022337: V3d_View::Print crashes in OCCT 6.5.0
mod - src/Aspect/Aspect.cdl Diff ] File ]
mod - src/Graphic3d/Graphic3d_GraphicDriver.cdl Diff ] File ]
mod - src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx Diff ] File ]
mod - src/OpenGl/FILES Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver.cdl Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_print.cxx Diff ] File ]
add - src/OpenGl/OpenGl_PrinterContext.cxx Diff ] File ]
add - src/OpenGl/OpenGl_PrinterContext.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_TextRender.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_tgl_funcs.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_togl_begin_layer_mode.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_togl_print.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_view.cxx Diff ] File ]
mod - src/V3d/V3d_View.cdl Diff ] File ]
mod - src/V3d/V3d_View_Print.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff ] File ]
mod - src/Visual3d/Visual3d_View.cdl Diff ] File ]
mod - src/Visual3d/Visual3d_View_Print.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2011-04-05 17:08 bugmaster Status closed => assigned
2011-04-05 17:08 bugmaster Resolution suspended => @0@
2011-04-05 17:08 bugmaster Assigned To bugmaster => apl
2011-05-26 18:04 apl Status assigned => resolved
2011-06-02 14:01 kgv CC => kgv
2011-07-28 15:31 apl CC => miv
2011-07-29 13:11 bugmaster Status resolved => reviewed
2011-07-29 13:11 bugmaster Fixed in Version EMPTY =>
2011-08-01 12:50 bugmaster Target Version => 6.5.2
2011-08-01 12:50 bugmaster Additional Information Updated View Revisions
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-08-05 10:12 miv Note Added: 0017913
2011-08-05 11:30 apl File Added: print22337-script.tar.gz
2011-08-05 11:32 apl Note Added: 0017915
2011-08-09 13:54 san Relationship added related to 0022582
2011-08-09 14:28 apl Note Added: 0017942
2011-08-12 11:42 apl Additional Information Updated View Revisions
2011-08-12 12:00 apl Note Added: 0017983
2011-08-12 12:34 apl Note Added: 0017984
2011-08-12 12:35 apl Assigned To apl => san
2011-08-25 10:10 apl Relationship added related to 0021981
2011-08-30 12:08 mkv Note Added: 0018035
2011-08-30 12:08 mkv Status reviewed => assigned
2011-08-31 15:28 mkv File Added: chl_934_A9.tar.gz
2011-08-31 15:28 mkv Test case number => chl 934 A9
2011-08-31 15:31 apl Status assigned => resolved
2011-08-31 17:07 san Note Added: 0018045
2011-08-31 17:07 san Assigned To san => apl
2011-08-31 17:07 san Status resolved => assigned
2011-09-01 13:09 apl Note Added: 0018052
2011-09-01 13:09 apl Status assigned => reviewed
2011-09-02 14:39 ycy Note Added: 0018069
2011-09-02 16:50 mkv Status reviewed => tested
2011-09-07 11:24 bugmaster Note Added: 0018080
2011-09-07 11:24 bugmaster Status tested => verified
2011-09-13 17:36 san Relationship added related to 0022520
2011-11-23 17:17 szy Additional Information Updated View Revisions
2011-11-25 15:00 szy Note Edited: 0018052 View Revisions
2011-11-25 15:01 szy Note Edited: 0018069 View Revisions
2011-12-01 11:38 szy Note Edited: 0017913 View Revisions
2011-12-12 16:29 mkv Relationship added related to 0022696
2011-12-12 16:32 mkv Note Added: 0018821
2012-02-21 10:41 kgv Relationship added related to 0022782
2012-02-21 17:15 san Relationship added related to 0023001
2012-03-29 17:26 bugmaster Changeset attached => occt master 7edf74fd


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker