View Issue Details

IDProjectCategoryView StatusLast Update
0031683CommunityOCCT:Visualizationpublic2021-01-12 02:15
ReporterVico Liang Assigned Toabv 
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
Descriptionvoid V3d_View::SetBackgroundImage (const Standard_CString theFileName,
                                   const Aspect_FillMethod theFillStyle,
                                   const Standard_Boolean theToUpdate)

It's impossible to make above function SetBackgroundImage working without freeimage library. This function accepts an image file path and internal calls freeimage to load the file.

In my cases, i don't want to build and link freeimage at all, but i still want to use the feature such as texture, image background, image output. i just don't want to work with filename directly. in stead, i want to use Image_PixMap as input, and then i can fill and extract data from Image_PixMap.Actaully in most cases, read and save image features are provided on application level, such as QT framework, MFC, etc.

My suggegstion is to reduce the usage of Image_AlienPixMap and provide method to support Image_PixMap as alternate of file path.
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberNot required

Relationships

related to 0031129 newvpozdyayev Open CASCADE Visualization - revise background / environment API 
related to 0030549 resolvedabv Open CASCADE Coding - split Image_AlienPixMap into several classes 
related to 0031686 closedbugmaster Community Visualization - V3d_View::SetBackgroundImage() not working for .bmp .jpg and .tga formats 

Activities

kgv

2020-08-04 16:27

developer   ~0093429

It is proposed extending V3d_View::SetBackgroundImage() to accept Graphic3d_TextureRoot or its sub-class as generic image-provider used by other texture uploading interfaces.

git

2020-09-02 19:45

administrator   ~0093924

Branch CR31683 has been created by mkrylova.

SHA-1: 3bcbd0b497e005799c0e1a0910934fe89131d5e5


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added the extension of function SetBackgroundImage() for classes V3d_View, OpenGl_View and Graphic3d_CView
    to accept Graphic3d_Texture2Dmanual (sub-class of Graphic3d_TextureRoot) as image-provider

kgv

2020-09-02 20:24

developer   ~0093933

+  virtual void SetBackgroundImage (const Handle(Graphic3d_Texture2Dmanual) theTexture) = 0;
...
+  Standard_EXPORT void SetBackgroundImage (const Handle(Graphic3d_Texture2Dmanual) theTexture,

Handles should passed by const reference.
Graphic3d_Texture2Dmanual should be replaced by Graphic3d_Texture2D.

   virtual void SetBackgroundImage (const TCollection_AsciiString& theFilePath) = 0;

The old method in Graphic3d_CView/OpenGl_View should be removed.
The old method in V3d_View should be updated to redirect to new one.

+  theTextureMap->EnableRepeat();
+  theTextureMap->DisableModulate();
+  theTextureMap->GetParams()->SetGenMode (Graphic3d_TOTM_MANUAL,
+                                          Graphic3d_Vec4(0.0f, 0.0f, 0.0f, 0.0f),
+                                          Graphic3d_Vec4(0.0f, 0.0f, 0.0f, 0.0f));

It is unexpected modifying theTextureMap here.

+  if (theTextureMap->IsDone())
+  {
+    anAspect->SetTextureMapOn();

Please also check for theTextureMap.IsNull() -> when NULL, background image should be disabled.

kgv

2020-09-02 20:29

developer   ~0093935

Please also define Graphic3d_CView::SetBackgroundImage() taking Graphic3d_TextureMap and merge OpenGl_View::SetBackgroundImage()/OpenGl_View::SetBackgroundCubeMap() methods basing on Graphic3d_TextureMap sub-class type (Graphic3d_Texture2D vs. Graphic3d_CubeMap vs. raise exception).

git

2020-09-07 12:43

administrator   ~0094194

Branch CR31683_1 has been created by mkrylova.

SHA-1: 9da9a9be93a3f1bf190d0eb9f98de0106a345e7f


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added the extension of function SetBackgroundImage() for class V3d_View to accept
    Graphic3d_Texture2D and for classes OpenGl_View and Graphic3d_CView
    to accept Graphic3d_TextureMap as image-provider.
    Merged functions SetBackgroundCubeMap() and SetBackroundImage() to SetBackroundImage in classes
    OpenGl_View and Graphic3d_CView

kgv

2020-09-07 14:16

developer   ~0094196

-void OpenGl_View::SetBackgroundImage (const TCollection_AsciiString& theFilePath)
+void OpenGl_View::SetBackgroundImage (const Handle(Graphic3d_TextureMap)& theTextureMap,
+                                      Standard_Boolean theToUpdatePBREnv)
...
+    aTextureMap->DisableModulate();

Please do not modify input object.
Texture map should be pre-configured (e.g. like within V3d_View taking TCollection_AsciiString).

+  if (!aTextureMap.IsNull())
+  {
+    aTextureMap->DisableModulate();
+    anAspect->SetTextureMap (aTextureMap);
+    // Enable texture mapping
+    if (aTextureMap.IsNull())
+    {
+      myBackgroundType = Graphic3d_TOB_NONE;
+      return;
+    }

This will not work like that.
Please instead check theTextureMap.IsNull() at the beginning of the function.

+  Handle(Graphic3d_Texture2D) aTextureMap = Handle(Graphic3d_Texture2D)::DownCast (theTextureMap);
+  if (!aTextureMap.IsNull())
+  {

theToUpdatePBREnv is ignored within this branch.
Expected behavior is like setting a NULL cubemap:
> if (theToUpdatePBREnv) { myPBREnvRequest = OpenGl_PBREnvRequest_CLEAR; }

+    Message::SendFail() << "Error: it is imposible to make this object as backround\n";

Please throw Standard_ProgramError instead of printing the message.

 void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
 {
+  Handle(Graphic3d_Texture2D) aTextureMap = new Graphic3d_Texture2Dmanual(theOther->BackgroundImage());
   ChangeRenderingParams() = theOther->RenderingParams();
   SetBackground            (theOther->Background());
   SetGradientBackground    (theOther->GradientBackground());
-  SetBackgroundImage       (theOther->BackgroundImage());
+  SetBackgroundImage       (aTextureMap);

Graphic3d_CView::BackgroundImage() should return now Graphic3d_TextureMap.

git

2020-09-08 19:33

administrator   ~0094267

Branch CR31683_1 has been updated by mkrylova.

SHA-1: 2a05b2a6f2dbdd349487b6ddda5dc330adade878


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 19:34:10 2020 +0300

    kgv remarks

git

2020-09-08 19:35

administrator   ~0094268

Branch CR31683_2 has been created by mkrylova.

SHA-1: effed7da9394a279abbae35c5091d4b189946cfc


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added the extension of function SetBackgroundImage() for class V3d_View to accept
    Graphic3d_Texture2D and for classes OpenGl_View and Graphic3d_CView
    to accept Graphic3d_TextureMap as image-provider.
    Merged functions SetBackgroundCubeMap() and SetBackroundImage() to SetBackroundImage in classes
    OpenGl_View and Graphic3d_CView

kgv

2020-09-08 19:53

developer   ~0094270

+  //! Sets background image texture file path.
+  Standard_EXPORT virtual void SetBackgroundImage (const TCollection_AsciiString& theFilePath) Standard_OVERRIDE;

This method should be kept removed (the similar method taking image file path in V3d_View is supposed to be left).

git

2020-09-09 15:28

administrator   ~0094302

Branch CR31683_2 has been updated by mkrylova.

SHA-1: a15a9cd601149094e4b4314c6aaa782c406e8251


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 9 15:31:55 2020 +0300

    kgv remarks: remove method OpenGl_View::SetBackgroundImage (const TCollection_AsciiString& theFilePath)

git

2020-09-09 15:30

administrator   ~0094303

Branch CR31683_3 has been created by mkrylova.

SHA-1: ce008c204e2c7910d90af38bb441d8984488855a


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added the extension of function SetBackgroundImage() for class V3d_View to accept
    Graphic3d_Texture2D and for classes OpenGl_View and Graphic3d_CView
    to accept Graphic3d_TextureMap as image-provider.
    Merged functions SetBackgroundCubeMap() and SetBackroundImage() to SetBackroundImage in classes
    OpenGl_View and Graphic3d_CView

git

2020-09-09 16:26

administrator   ~0094310

Branch CR31683_3 has been updated by mkrylova.

SHA-1: bddb5f88a718a8938286a467145ca4fc21a8dc9e


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 9 16:16:02 2020 +0300

    kgv remarks

git

2020-09-09 16:28

administrator   ~0094311

Branch CR31683_4 has been created by mkrylova.

SHA-1: d8f18a3f3d8157bcdc4330e25bd6c36337fc5850


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added the extension of function SetBackgroundImage() for class V3d_View to accept
    Graphic3d_Texture2D and for classes OpenGl_View and Graphic3d_CView
    to accept Graphic3d_TextureMap as image-provider.
    Merged functions SetBackgroundCubeMap() and SetBackroundImage() to SetBackroundImage in classes
    OpenGl_View and Graphic3d_CView

git

2020-09-10 11:25

administrator   ~0094361

Branch CR31683_5 has been created by kgv.

SHA-1: daecd7ab3feb43fe820b2175fe00e1302ca27166


Detailed log of new commits:

Author: mkrylova
Date: Wed Sep 2 16:08:35 2020 +0300

    0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
    
    Added V3d_View::SetBackgroundImage() accepting Graphic3d_Texture2D on input.
    
    Graphic3d_CView/OpenGl_View have been modified to merge Graphic3d_CView::SetBackgroundImage()
    and ::SetBackgroundCubeMap() implementations into a single method.

git

2020-09-10 11:40

administrator   ~0094362

Branch CR31683_4 has been updated by mkrylova.

SHA-1: ef207e619490d7c0997945714dee931061d30596


Detailed log of new commits:

Author: mkrylova
Date: Thu Sep 10 11:43:07 2020 +0300

    kgv remarks: fixed warnings

kgv

2020-09-10 13:59

developer   ~0094374

Please raise the patch
- OCCT branch: CR31683_5.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31683_5-master-KGV/

bugmaster

2020-09-13 11:04

administrator   ~0094540

Combination -
OCCT branch : IR-2020-09-11
master SHA - d1b25684e9402d995dafec22fb98f83957d5fb76
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-09-11 SHA - a7e55a291cf6642cb4af945a999deeeb5f91272a
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17333.360000000142 / 17325.800000000123 [+0.04%]
Products
Total CPU difference: 12056.720000000096 / 12079.64000000011 [-0.19%]
Windows-64-VC14:
OCCT
Total CPU difference: 18817.921875 / 18792.46875 [+0.14%]
Products
Total CPU difference: 13294.09375 / 13274.75 [+0.15%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-09-13 11:45

administrator   ~0094576

Branch CR31683_4 has been deleted by inv.

SHA-1: ef207e619490d7c0997945714dee931061d30596

git

2020-09-13 11:45

administrator   ~0094577

Branch CR31683_5 has been deleted by inv.

SHA-1: daecd7ab3feb43fe820b2175fe00e1302ca27166

git

2020-09-13 11:46

administrator   ~0094581

Branch CR31683_3 has been deleted by inv.

SHA-1: bddb5f88a718a8938286a467145ca4fc21a8dc9e

git

2020-09-13 11:46

administrator   ~0094584

Branch CR31683_2 has been deleted by inv.

SHA-1: a15a9cd601149094e4b4314c6aaa782c406e8251

git

2020-09-13 11:46

administrator   ~0094586

Branch CR31683_1 has been deleted by inv.

SHA-1: 2a05b2a6f2dbdd349487b6ddda5dc330adade878

git

2020-09-13 11:47

administrator   ~0094603

Branch CR31683 has been deleted by inv.

SHA-1: 3bcbd0b497e005799c0e1a0910934fe89131d5e5

Related Changesets

occt: master 99289bed

2020-09-02 13:08:35

abv


Committer: abv Details Diff
0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap

Added V3d_View::SetBackgroundImage() accepting Graphic3d_Texture2D on input.

Graphic3d_CView/OpenGl_View have been modified to merge Graphic3d_CView::SetBackgroundImage()
and ::SetBackgroundCubeMap() implementations into a single method.
Affected Issues
0031683
mod - src/Graphic3d/Graphic3d_CView.hxx Diff File
mod - src/OpenGl/OpenGl_View.cxx Diff File
mod - src/OpenGl/OpenGl_View.hxx Diff File
mod - src/V3d/V3d_View.cxx Diff File
mod - src/V3d/V3d_View.hxx Diff File

Issue History

Date Modified Username Field Change
2020-07-23 08:24 Vico Liang New Issue
2020-07-23 08:24 Vico Liang Assigned To => kgv
2020-07-23 09:12 kgv Relationship added related to 0031129
2020-07-23 09:13 kgv Relationship added related to 0030549
2020-07-23 09:14 kgv Summary Reduce freeimage dependance => Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
2020-07-24 11:52 kgv Relationship added related to 0031686
2020-08-04 16:27 kgv Note Added: 0093429
2020-08-04 16:27 kgv Assigned To kgv => mkrylova
2020-08-04 16:27 kgv Status new => assigned
2020-09-02 19:45 git Note Added: 0093924
2020-09-02 19:46 mkrylova Assigned To mkrylova => osa
2020-09-02 19:46 mkrylova Status assigned => resolved
2020-09-02 19:46 mkrylova Steps to Reproduce Updated
2020-09-02 20:24 kgv Note Added: 0093933
2020-09-02 20:24 kgv Assigned To osa => mkrylova
2020-09-02 20:24 kgv Status resolved => assigned
2020-09-02 20:29 kgv Note Added: 0093935
2020-09-07 12:43 git Note Added: 0094194
2020-09-07 12:44 mkrylova Assigned To mkrylova => osa
2020-09-07 12:44 mkrylova Status assigned => resolved
2020-09-07 14:16 kgv Note Added: 0094196
2020-09-07 14:16 kgv Assigned To osa => mkrylova
2020-09-07 14:16 kgv Status resolved => assigned
2020-09-08 19:33 git Note Added: 0094267
2020-09-08 19:35 git Note Added: 0094268
2020-09-08 19:53 kgv Note Added: 0094270
2020-09-09 15:28 git Note Added: 0094302
2020-09-09 15:30 git Note Added: 0094303
2020-09-09 15:31 mkrylova Assigned To mkrylova => osa
2020-09-09 15:31 mkrylova Status assigned => resolved
2020-09-09 15:46 kgv Assigned To osa => mkrylova
2020-09-09 15:46 kgv Status resolved => assigned
2020-09-09 16:26 git Note Added: 0094310
2020-09-09 16:28 git Note Added: 0094311
2020-09-10 11:25 git Note Added: 0094361
2020-09-10 11:40 git Note Added: 0094362
2020-09-10 13:59 kgv Note Added: 0094374
2020-09-10 13:59 kgv Assigned To mkrylova => bugmaster
2020-09-10 13:59 kgv Status assigned => resolved
2020-09-10 14:00 kgv Status resolved => reviewed
2020-09-13 11:04 bugmaster Note Added: 0094540
2020-09-13 11:04 bugmaster Status reviewed => tested
2020-09-13 11:14 bugmaster Test case number => Not required
2020-09-13 11:24 abv Changeset attached => occt master 99289bed
2020-09-13 11:24 abv Assigned To bugmaster => abv
2020-09-13 11:24 abv Status tested => verified
2020-09-13 11:24 abv Resolution open => fixed
2020-09-13 11:45 git Note Added: 0094576
2020-09-13 11:45 git Note Added: 0094577
2020-09-13 11:46 git Note Added: 0094581
2020-09-13 11:46 git Note Added: 0094584
2020-09-13 11:46 git Note Added: 0094586
2020-09-13 11:47 git Note Added: 0094603
2020-12-02 16:43 emo Fixed in Version => 7.5.0
2020-12-02 17:13 emo Status verified => closed