Draw XYZ-axis in the corner of view window

Is there an easy way to add XYZ-axis in the corner of view window?

Thanks,
James

Timo Roth's picture

To control displaying of "thick" colored trihedron you may use the following methods of V3d_View class:

V3d_View::TriedronDisplay
V3d_View::TriedronErase
V3d_View::ZBufferTriedronSetup

Here is an example of C++ code suitable for insertion into MFC method void CSampleView::OnInitialUpdate():

myView->ZBufferTriedronSetup(Quantity_NOC_RED,Quantity_NOC_GREEN,Quantity_NOC_BLUE1,0.8,0.05,12);
myView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER,Quantity_NOC_WHITE,0.2,V3d_ZBUFFER);

For a simpler trihedron you can choose V3d_WIREFRAME instead of V3d_ZBUFFER as last parameter to TriedronDisplay. Then ZBufferTriedronSetup() should not be necessary.

Kind regards,
Timo

James Blackmon's picture

Thanks a lot, Timo.

James Blackmon's picture

Hi, Timo:

I did see beautiful 3-color triedron, but the weird thing is, when I pan the object in the view, triedron will follow.

Any advices?

Timo Roth's picture

This behaviour was fixed in the maintenance release 6.3.1 of Open Cascade.
So, either you contact OCC company to get this release.
Or you wait for the public release of OCC 6.4 in December 2010.
Or you look at http://sourceforge.net/projects/opencascade/files/
There is also a Fix (fix235) for this problem.
It says in readme.txt:
- Summary: Incorrect placement of ZBuffer trihedron
- Detailed description: OpenGl_triedron.c used weird check isWithinView and correctly placed ZBuffer trihedron only when the model went out of the view. Fix ignores this check. Sergey Anikin claimed this must have been fixed in 6.3.1.

Timo

jelle's picture

"Wait for half a year to get a fix for a solved problem"
I do not know whether to laugh or weep when I read this.

James Blackmon's picture

Thank you so much, Timo. You are so kind. I will get fix from Sourceforge.