参照:
2d view 单文档
http://blog.csdn.ofcdn.net/augusdi/article/details/5642368
occ 之hello world
http://blog.csdn.net/dreamcs/article/details/6612735
参照1
编译成功但是并不会出现box
原因1少创建view
在这里创建view
void CoccDemo5View::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
CoccDemo5Doc* pDoc = GetDocument();
_View = pDoc->GetViewer()->CreateView();
Handle_AIS_InteractiveContext myAISContext = pDoc->GetAIS();
Handle_WNT_Window hWindow;
hWindow = new WNT_Window(((CoccDemo5App*)AfxGetApp())->GetGraphicDevice(), GetSafeHwnd());
_View->SetWindow(hWindow);
if (!hWindow->IsMapped())
hWindow->Map();
Standard_Integer nWidth = 100, nHeight = 100;
hWindow->Size(nWidth,nHeight);
::PostMessageA(GetSafeHwnd(),WM_SIZE,SIZE_RESTORED,nWidth+nHeight*65536);
}
这一步很重要!
运行起我出现了如下错误
会出现graphic engine initial error,定位出错代码:
try
{
_GraphicDevice = new Graphic3d_WNTGraphicDevice();
}
catch(Standard_Failure)
{
AfxMessageBox(L"Fatal error during graphic initialization",MB_ICONSTOP);
ExitProcess(1);
}
我debug出的原因的是
TKOpenGl.dll 有问题,可能是我编译debug版本的OCClib出现问题
解决的方案,替换次dll
其中v3d中对view的操作大多是照搬OCC demo 的操作,可以运转,但是缺少select模块后期应该添加。
拥有zoom,pan,rotation,功能。
这个小demo算是我的V0.001版吧。
上图: