Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Draw and samples / A mimimal example Cascade & 3D viewer (V3d_Viewer)

A mimimal example Cascade & 3D viewer (V3d_Viewer)

A mimimal example Cascade & 3D viewer (V3d_Viewer)
aka 2013/03/29 15:01

Data in class or global data:


Handle_Graphic3d_WNTGraphicDevice myGraphicDevice;
Handle_V3d_Viewer myViewer;
Handle_AIS_InteractiveContext myAISContext;
Handle_V3d_View myView;
Handle_WNT_WClass myWClass;
Handle(WNT_Window) aWNTWindow;


Code of 3D view initialization:

myGraphicDevice = new Graphic3d_WNTGraphicDevice();

Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = myGraphicDevice;
theGraphicDevice = myGraphicDevice;
//Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,parent_window);
try {
myWClass= new WNT_WClass((char*)L"some_class_fdfdddd",NULL,CS_HREDRAW|CS_VREDRAW);
} catch (WNT_ClassDefinitionError &err) {
int errcode=GetLastError();
int x=0;
}
WNT_Window * t = new WNT_Window(theGraphicDevice,"some_win_mmmmddddd",myWClass,WS_VISIBLE ,1,1,400,400,Quantity_NOC_MATRAGRAY,NULL);
//WNT_Window * t = new WNT_Window(theGraphicDevice,"some_win_mmmmddddd",myWClass,WS_CHILD | WS_VISIBLE | WS_TABSTOP,1,1,400,400,Quantity_NOC_MATRAGRAY,parent_window);
aWNTWindow = t;
myViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D");
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myView = myViewer->CreateView();
myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped()){

aWNTWindow->Map();
}
myAISContext =new AIS_InteractiveContext(myViewer);


Handle(V3d_Viewer) aViewer = myViewer;
Handle(AIS_InteractiveContext) aContext;
aContext = new AIS_InteractiveContext(aViewer);

BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.);
Handle(AIS_Shape) aisthing=new AIS_Shape(S.Shape());
aContext->SetDisplayMode(aisthing,AIS_Shaded);
aContext->Display(aisthing);
aContext->DisplayAll();


thanks for Travers Biddle http://www.opencascade.org/org/forum/thread_23530/?forum=3

Be sure to call

aContext->SetDisplayMode(aisthing,AIS_Shaded);
aContext->Display(aisthing);

everytime when you modify the shape.

Be sure to call

aContext->Display(aisthing);

everytime when WM_PAINT processed
 
 
Latest news
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map