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

OpenCASCADE 7.1.0 AIS_TexturedShape has no texture

Serban Stoenescu's picture
Forums: 

Hello,

I want to display a textured shape. The program doesn't crash, but the shapes are plain. I can change color, material, transparency, etc., but no textures.

I found in other forum posts that I have to call SetSurfaceDetail(V3d_TEX_ALL) from my V3d_Viewer.

However, this was deleted in OpenCASCADE 7.1.0.

I know that my BMP file exists, and I also tried using "1" in SetTextureFileName, but still nothing happens

Any ideas what might be wrong or what should I try?

Here's my code:


void UMAT_MainDoc::displayShape(Handle(AIS_Shape) shape, const Quantity_Color col, const Standard_Real transparency /*= 0.0*/)

{

Handle(AIS_TexturedShape) occ_aisTextured = new AIS_TexturedShape(shape->Shape());



TCollection_AsciiString fileName("C:\\Users\\serban.stoenescu\\Pictures\\bitmap.bmp");

//TCollection_AsciiString fileName("1");



occ_aisTextured->SetTextureFileName(fileName);

occ_aisTextured->SetTextureMapOn();

int nRepeat = 2;

double toScale = 0.5;

occ_aisTextured->SetTextureRepeat(Standard_True, nRepeat, nRepeat);

occ_aisTextured->SetTextureScale(Standard_True, toScale, toScale);

occ_aisTextured->SetTextureOrigin(Standard_True, 0, 0);

//occ_aisTextured->DisableTextureModulate();

occ_aisTextured->SetDisplayMode(3); // mode 3 is "textured" mode



occ_aisTextured->SetMaterial(Graphic3d_NOM_SILVER);



m_hAISContext->SetDisplayMode(occ_aisTextured, 3);

//m_hAISContext->Display(occ_aisTextured, 3,-1);

m_hAISContext->Display(occ_aisTextured);

m_hAISContext->UpdateCurrentViewer();

occ_aisTextured->UpdateAttributes();



}

anshi wang's picture

I have the same problem, have you resoved?