VC2010 创建 MFC Open Cascade 单文档 3d view

参照:

        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版吧。


上图:





  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值