MantisBT - Community
View Issue Details
0022879Community[OCCT] OCCT:Visualizationpublic2011-12-27 17:182012-03-29 17:26
szy 
bugmaster 
normalminor 
closedfixed 
[OCCT] 6.5.2 
[OCCT] 6.5.3[OCCT] 6.5.3 
chl 934 V3
0022879: Possible bug in Opengl_togl_begin_layer_mode.cxx
Post from the Forum (Massimo Del Fedele) - http://www.opencascade.org/org/forum/thread_22425/. [^]
"The code here :

/*
* On gere le type de font (ASCII !)
*/
if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 &&
FTGLLayerFontAspect == aspect &&
FTGLLayerFontHeight == height
)
{

makes no sense to me.... it's re-setting font data ONLY if font NAME is different AND font aspect and height are equal... I think it should be like this :

if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 ||
FTGLLayerFontAspect != aspect ||
FTGLLayerFontHeight != height
)

Anyways, even after pathcing code as whown, font size bug in layer remains... so there must be some other problem.
BTW, the coding style is quite weird... why, for example :

FTGLLayerFontName[0] = '\0';
strcat( (char*)FTGLLayerFontName, (char*)font );

instead of a more simple
strcpy(.....) ??
"

The issue is confirmed as a bug by SAN.
SetTextAttributes method has been fixed in OpenGl_GraphicDriver.
This method now sets font name, type of display text and color of background for subtitle or decal text display for overlayer or underlayer text.
Without this fix, only font name argument has an effect.
There are four different type of display text available:
- Aspect_TODT_NORMAL, display text as usual,
- Aspect_TODT_SUBTITLE, display text on colored background,
- Aspect_TODT_DEKALE, display text with colored outlines,
- Aspect_TODT_BLEND, display text with blended colors.

The color of the font itself can be set with method SetColor in OpenGl_GraphicDriver.

Changes in packages:

OpenGl package:
1) OpenGl_GraphicDriver - method SetTextAttributes now correctly processes the Font, Type, R, G, B parameters.

V3d package:
1) V3d_ColorScale - text attributes changed from Aspect_TODT_SUBTITLE to Aspect_TODT_NORMAL.
2) V3d_LayerMgr - text attributes on beginnig of redraw of the layers in method V3d_LayerMgr::Begin() changed from Aspect_TODT_SUBTITLE to Aspect_TODT_NORMAL.

ViewerTest package:
1) Text attributes testing command "voverlaytext" implemented.
No tags attached.
related to 0022819closed bugmaster Open CASCADE Redesign of OpenGl driver 
related to 0022880closed bugmaster Community Another probable bug in Opengl_togl_begin_layer_mode.cxx 
? V3 (2,953) 2012-03-14 12:07
https://tracker.dev.opencascade.org/
Issue History
2011-12-27 17:18szyNew Issue
2011-12-27 17:18szyAssigned To => san
2012-02-06 08:16abvRelationship addedrelated to 0022819
2012-02-06 08:17abvNote Added: 0019399
2012-02-21 12:10sanAssigned Tosan => apl
2012-02-21 12:10sanStatusnew => assigned
2012-02-22 20:00aplNote Added: 0019751
2012-02-22 20:00aplAssigned Toapl => san
2012-02-22 20:00aplStatusassigned => resolved
2012-02-22 20:14aplNote Added: 0019752
2012-02-22 20:28aplRelationship addedrelated to 0022880
2012-02-22 20:44aplAdditional Information Updatedbug_revision_view_page.php?rev_id=3538#r3538
2012-02-22 21:20sanNote Added: 0019754
2012-02-22 21:20sanAssigned Tosan => apl
2012-02-22 21:20sanStatusresolved => assigned
2012-02-28 09:50aplNote Added: 0019786
2012-02-28 09:50aplAssigned Toapl => san
2012-02-28 09:50aplStatusassigned => resolved
2012-03-07 14:35sanNote Added: 0019893
2012-03-07 14:35sanAssigned Tosan => bugmaster
2012-03-07 14:35sanStatusresolved => reviewed
2012-03-09 12:17apnAssigned Tobugmaster => apn
2012-03-13 15:32apnAssigned Toapn => mkv
2012-03-14 10:44apnNote Added: 0019964
2012-03-14 12:06apnNote Edited: 0019964bug_revision_view_page.php?bugnote_id=19964#r3634
2012-03-14 12:07apnFile Added: V3
2012-03-14 12:07apnTest case number => chl 934 V3
2012-03-14 12:07apnAssigned Tomkv => bugmaster
2012-03-14 12:07apnStatusreviewed => tested
2012-03-15 19:08bugmasterNote Added: 0019999
2012-03-15 19:08bugmasterStatustested => verified
2012-03-15 19:08bugmasterResolutionopen => fixed
2012-03-15 19:08bugmasterAssigned Tobugmaster => apl
2012-03-29 17:26bugmasterChangeset attached => occt master 25289ec1

Notes
(0019399)
abv   
2012-02-06 08:17   
To be processed after integration of 0022819
(0019751)
apl   
2012-02-22 20:00   
The following issues has been fixed:
- SetTextAttributes method now affects the type of display text: it is defined on Visual3d_Layer level in accordance with Aspect_TypeOfDisplayText enumeration; this allows to display text in 4 modes: normal, subtitle (with colored background), decal (with colored outlines), blend (mixing colors). The R, G, B values defines the color of the background for subtitle and blend display types.

- The problems with text height and text font are no longer exist in updated OpenGl_GraphicDriver.

- Draw command for overlay text testing purposes "voverlaytext" added

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

Dear San,

Could you please review the modification in branch:
http://svn/svn/occt/branches/OCC22879 [^]

(0019752)
apl   
2012-02-22 20:14   
"voverlaytext" testing command added with the following syntax:

voverlaytext TextString X Y [TextHeight] [FontName] [R G B(TextColor)] [DisplayType] [R G B (BackgroundColor)]

TextString - the string with text;
X, Y - where to display the text;
TextHeight - height of the displayed text (default 10.0)
FontName - name of the font to be used (default Courier);
TextColor - Three real values that define the color of the text (default 1.0 1.0 1.0)
DisplayType - display type of the text, might be {normal/subtitle/decal/blend}
BackgroundColor - Three real values that define the color of the subtitle or decal background (default 1.0 1.0 1.0)

The example scenario to test the overlay text parameters:
pload AISV
vinit
# check text height
voverlaytext "Text Height=14" 10.0 10.0 14.0
voverlaytext "Text Height=25" 10.0 40.0 25.0
# check text text font and color
voverlaytext "Arial" 10.0 60.0 18.0 "Arial" 1.0 0.0 0.0
voverlaytext "Times New Roman" 10.0 80.0 20.0 "Times New Roman" 0.0 0.0 1.0
# check display type
voverlaytext "Type1" 10.0 110.0 20.0 "Arial" 1.0 0.0 0.0 subtitle 0.3 0.3 0.3
voverlaytext "Type2" 10.0 130.0 20.0 "Arial" 0.5 0.5 0.3 decal 0.8 0.8 0.8
voverlaytext "Type3" 10.0 150.0 20.0 "Arial" 0.5 0.5 0.3 blend

# check blend:
pload MODELING
box b 10 10 10
vdisplay b
vsetdispmode b 1 ... and move the box under the text to see blended colors.
(0019754)
san   
2012-02-22 21:20   
The SVN branch reviewed with the following remarks.

OpenGl_GraphicDriver_Layer.cxx
===========================================

Is it really correct to enable blending by the code below without specifying the blend function??? Is blending really needed here at all?

         switch (aDispType)
301 {
302 // blend type
303 case Aspect_TODT_BLEND:
304 {
305 isBlend = glIsEnabled(GL_BLEND);
306 if (!isBlend)
307 glEnable(GL_BLEND);
308
309 glEnable(GL_COLOR_LOGIC_OP);
310 glLogicOp(GL_XOR);
311 }
312 break;

and here:

       if (aDispType == Aspect_TODT_BLEND)
415 {
416 if (!isBlend)
417 glDisable(GL_BLEND);
418
419 glDisable(GL_COLOR_LOGIC_OP);
420 }
(0019786)
apl   
2012-02-28 09:50   
Dear San,

The redundant code blocks were removed, also the draw command was slightly corrected: color values R G B can be ranged from 0 to 255.

Please review the changes in branch:
http://svn/svn/occt/branches/OCC22879 [^]
(0019893)
san   
2012-03-07 14:35   
The SVN branch reviewed without remarks, ready for testing.
(0019964)
apn   
2012-03-14 10:44   
(edited on: 2012-03-14 12:06)
Dear BugMaster,
    SVN branch http://svn/svn/occt/branches/OCC22879 [^] hes been moved to GIT CR22879 one.
    Workbench KAS:dev:mkv-22879-occt was created from git branch CR22879
  (and mkv-22879-products from svn trunk) and compiled on Linux platform.
  
    There are not regressions in mkv-22879-products regarding to KAS:dev:products-20120306-opt

    Test case for this fix is chl 934 V3. It's OK.
    
    See results in /QADisk/occttests/results/KAS/dev/mkv-22879-products_13032012/lin
    See reference results in /QADisk/occttests/results/KAS/dev/products-20120306-opt_07032012/lin
    See test cases in /QADisk/occttests/tests/ED

(0019999)
bugmaster   
2012-03-15 19:08   
Integrated into master