From 759e2a15ca74fe28f287be469b7ebb7a8068170c Mon Sep 17 00:00:00 2001 From: kgv Date: Sun, 8 Apr 2018 12:54:21 +0300 Subject: [PATCH] 0029659: Samples - Image is not displayed in Viewer2d MFC sample Fixed wrong Display Mode assigned to Sample2D_Image presentation. --- .../standard/03_Viewer2d/src/Viewer2dDoc.cpp | 24 +++++++------------ .../Common/Primitive/Sample2D_Image.cpp | 4 +++- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp index 1e162b540a..9524025952 100755 --- a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp +++ b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp @@ -330,8 +330,7 @@ void CViewer2dDoc::OnBUTTONTestImage() Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (40,50) ; anImage->SetScale (1.0); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage,3,Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); FitAll2DViews (Standard_True); } } @@ -365,48 +364,41 @@ void CViewer2dDoc::OnBUTTONMultipleImage() Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (40, 50); anImage->SetScale (0.5); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 2 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (100, 50); anImage->SetScale (0.9); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 3 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (40, 40); anImage->SetScale (0.3); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 4 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (50, 40); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 5 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (80, 45); anImage->SetScale (2); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 6 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (20, -20); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } { // 7 Handle(Sample2D_Image) anImage = new Sample2D_Image (aFileName); anImage->SetCoord (0, 0); anImage->SetScale (0.5); - myAISContext->Display (anImage, Standard_False); - myAISContext->SetDisplayMode (anImage, 3, Standard_False); + myAISContext->Display (anImage, AIS_Shaded, 0, Standard_False); } FitAll2DViews (Standard_True); // Update Viewer } diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Image.cpp b/samples/mfc/standard/Common/Primitive/Sample2D_Image.cpp index 56fb6f938c..549790f7a7 100755 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Image.cpp +++ b/samples/mfc/standard/Common/Primitive/Sample2D_Image.cpp @@ -38,6 +38,8 @@ void Sample2D_Image::SetContext(const Handle(AIS_InteractiveContext)& theContext MakeShape(); this->Set(TopoDS_Shape(myFace)); myDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - myDrawer->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual (myFilename)); + Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual (myFilename); + aTexture->DisableModulate(); + myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture); myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn(); }