Tue, 01/20/2009 - 08:39
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();
Tue, 01/20/2009 - 15:55
It is very similar than mine.
Have you checked samples? They are working properly...