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

3d Viewer implementation

siyamalan's picture
Forums: 

Hi,
I tried to implement a 3d viewer. I got this code from a website. It crashes. Can anyone help me to write a 3D viewer application??
Thanks in advance.

Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = new Graphic3d_WNTGraphicDevice();

TCollection_ExtendedString a3DName("Visu3D");
Handle(V3d_Viewer) myViewer = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString());

Handle(AIS_InteractiveContext) myAISContext;
myAISContext = new AIS_InteractiveContext(myViewer);

myViewer->SetDefaultLights();
myViewer->SetLightOn();

//Shade
myAISContext->SetDisplayMode(AIS_Shaded,Standard_False);

// Creating TRIHEDRON
Handle_AIS_Trihedron aTrihedron;
Handle_Geom_Axis2Placement aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
aTrihedron=new AIS_Trihedron(aTrihedronAxis);
myAISContext->Display(aTrihedron);

Handle_V3d_View myView = myViewer->CreateView();
HWND m_hWnd = GetForegroundWindow();
// Creating new Window and attaching it to View
Handle_WNT_Window aWNTWindow = new WNT_Window(theGraphicDevice,m_hWnd, Quantity_NOC_GRAY30);
myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();

arkoala's picture

It is very similar than mine.

Have you checked samples? They are working properly...