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

AIS_InteractiveContext and changing display modes

Anonymous's picture
Forums: 

I am unable to change the display mode of objects in my AIS_InteractiveContext.

I am using linux, mesa, and qt.

For example I have a function to change the current objects display mode to shading:

void MyViewer::Shading() { for(myContext->InitCurrent();myContext->MoreCurrent();myContext->NextCurrent()) {

// this is just to test that the selected object is being processed, and it works - the color changes to blue myContext->SetColor(myContext->Current(),Quantity_NOC_BLUE1);

// here's where I try to shade: myContext->SetDisplayMode(myContext->Current(),AIS_Shaded);

}

}

This is pretty much right out of the samples program.

What critical step am I missing ? I cannot change to WireFrame either. Only HLR - the default - seems to work.

If I do myContext->DisplayMode(), AIS_WireFrame is returned.

If anyone cares, my full source (~80K with all the autoconf stuff) is at ftp://ftp.freeengineer.org/pub/misc/myapp-0.10.tar.gz

Sergey RUIN's picture

Hello

Try to set degenerated mode of V3d_View off by method V3d_View::SetComputeMode(Standard_True) - this method should be applied to active view in which objects are displayed

Best regards Sergey

C R Johnson's picture

There is no method V3d_View::SetComputeMode() :(

cliff

Sergey RUIN's picture

Hi Cliff!

I'm sorry for misleading You, the method V3d_View::SetComputeMode(boolean) have to be in the next release of OpenCascade.

Methods SV3d_View::etDegeneratedModeOn and V3d_View::SetDegeneratedModeOff will become obsolete.

Regards

Sergey

Francois Lauzon's picture

Hi,

I've look at your code, and I could tell you what I do that is different from and (I know it work for me).

First, when I create the viewer, I set up the light sources:

myViewer->SetDefaultLights();

myViewer->SetLightOn();

> // here's where I try to shade:
> myContext->SetDisplayMode(myContext->Current(),AIS_Shaded);

When I change the display mode, I do it like this: myContext->SetDisplayMode(myContext->Current(),AIS_Shaded, Standard_False);

and at the exit of the loop I do an update viewer:

myContext->UpdateCurrentViewer();

And this work just fine on NT and SGI IRIX.

Good luck. Francois.

C R Johnson's picture

Thanks for the ideas Francois, but it does not change anything.

I tried using

myViewer->SetDefaultVisualization(V3d_WIREFRAME);

as well, but everything continues to be HLR.

Did you try my code on IRIX? you must still be using cas.cade V2.1 ? I tried to compile open cascade 3.0PR1 on SGI a few weeks ago (on IRIX 6.5.5 using g++ from freeware.sgi.com) but I could not get it to build sucessfully.

cliff

Arnaud Magnier's picture

Cliff,

To switch from HLR Mode to Standard Display Mode (Wireframe or Shading), you must call the following method on your 3d view:

V3d_View::SetDegenerateModeOn()

To get back to the HLR mode, use:

V3d_View::SetDegenerateModeOff()

Moreover, to know which mode you are currently using, you can ask for:

V3d_View::DegenerateModeIsOn() which returns Boolean

Hope this will help you, regards,

Arnaud.

C R Johnson's picture

OK! that works almost as I expect now.

Thank you.

The only anamoly I observe is that with degerate mode = on, setting the display mode=AIS_QuickHLR shows a chain style bounding box around the object ( which is OK) , and setting AIS_ExactHLR does not draw the object at all(which is not as I would expect), except while under dynamic highlight, or selection.

In other words, AIS_ExactHLR is meaningless. Everything is HLR when degenerate mode is off no matter what display mode is used, and it is not possible to have both HLR objects and shaded or wireframe objects in the same view at the same time.

cliff