View Direction specific Wireframe graphics

I would like to draw some of my wireframe graphics based on the view direction. For example, when drawing a cylinder I would like to draw the silhouette edges. I am deriving my own class from AIS_Shape, and I'm planning on overriding the Compute() method. However, based on the parameters being passed to Compute(), I don't see any way to find the view direction.

I would also like to draw some graphics based on the current scale of the view window, so I'd like to find that too.

Any help would be appreciated.

Pawel's picture

Hi Eric,

have a look at: Visual3d_ViewMapping and Visual3d_ViewOrientation.

I guess if you take this approach you would have to recompute the AIS every time the view is reoriented.

Pawel

EricThompson's picture

Pawel-

Thanks for the suggestion, but I'm not sure that solves my problem. What I need is to make sure that my Compute() method is called separately for each view, and within my call to Compute() I need to determine the view direction for the view to be drawn.

I've worked with custom extensions to AutoCAD before, and they have two different methods. worldDraw() is overridden to draw an object's graphics if they do not depend on the view direction, while viewportDraw() is overridden to draw graphic that do depend on view direction. Does OpenCascade have any similar ability?

Pawel's picture

Hi Eric,

I don't think OCC has something similar.

What I do is to recompute/query and store the view parameters after each operation that can potentially modify them (zooming, rotating, window resizing etc.). If they change I recompute (Redisplay) the AIS presentations using the stored parameter values.

Maybe it helps
Pawel

EricThompson's picture

Thanks again.

I've considered this, but I have a case where I want to have multiple views of the same scene. Unless I can get seperate calls to Compute() for each view ( and determine which view is being drawn for each call ) I don't think I can get the results I'm looking for.

Paul Jimenez's picture

The best way to go around it would be to write your own visualization framework in pure OpenGL, or see if NIS is good enough to do that.

I guess what you need is explained here: http://www.codeproject.com/KB/openGL/Outline_Mode.aspx

Constantly re-computing a shape easily reduces your program's response time, so, if you are trying to achieve fancy effects, you better start using something other than AIS.

EricThompson's picture

Thanks for the advice.

I'm working with a fairly small scene, of mostly simple objects, so I don't think I'll have a performance issue. And the view directions specific graphics I'm looking to generate are not that important to the overall produce, so I don't think I'll go to the trouble of writing my own visualization framework. I have many more important features to implement before that makes it to the top of my queue.