For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Texture mapping

Anonymous's picture
Forums: 

Hello,

I am trying to do some texture mapping using CASCADE. I wrote some code which compiles without problems and also runs without crash. The problem is that this code does not change the displayed object. Could somebody give me a hint what mistake I made?

BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.); Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape()); anInteractiveContext->SetColor(aBox,Quantity_NOC_WHITE); anInteractiveContext->SetMaterial(aBox,Graphic3d_NOM_SHINY_PLASTIC); anInteractiveContext->SetDisplayMode(aBox,1); anInteractiveContext->Display(aBox);

Handle (AIS_InteractiveObject) CurObject; Handle (AIS_Drawer) CurDrawer;

Handle(V3d_Viewer) myViewer = anInteractiveContext->CurrentViewer(); myViewer->InitActiveViews(); Handle(V3d_View) myView = myViewer->ActiveView(); myView->FitAll(0.01,Standard_True);

myView->SetSurfaceDetail(V3d_TEX_ALL);

for(anInteractiveContext->InitCurrent();anInteractiveContext->MoreCurrent();anInteractiveContext->NextCurrent()) {

CurObject = anInteractiveContext->Current();

CurDrawer = CurObject->Attributes();

Handle(Prs3d_ShadingAspect) aPrs3d_ShadingAspect = CurDrawer->ShadingAspect();

Handle(Graphic3d_AspectFillArea3d) Asp = aPrs3d_ShadingAspect->Aspect();

Asp->SetTextureMapOn();

myViewer->SetUpdateMode(V3d_ASAP);

Handle(Graphic3d_StructureManager) SM = myViewer->Viewer();

Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(SM,Graphic3d_NOT_2D_BUBBLES);

Asp->SetTextureMap(aTexture) ;

aPrs3d_ShadingAspect->SetAspect(Asp);

aPrs3d_ShadingAspect->SetColor(Quantity_NOC_GREEN);

aPrs3d_ShadingAspect->SetMaterial(Graphic3d_NOM_PEWTER);

CurDrawer->SetShadingAspect(aPrs3d_ShadingAspect);

anInteractiveContext->SetTemporaryAttributes(CurObject,CurDrawer);

anInteractiveContext->UpdateCurrent();

}

anInteractiveContext->UpdateCurrentViewer();

Thanks in advance!

Thomas