我正在用 Metaio 开发 AR 的东西。我有双摄像头,并试图基于 metaio SDK 的 MFC 模板项目制作双 opengl 渲染窗口。http://dev.metaio.com/sdk/documentation/first-app-running-template-on-each-platform/windows/index.html
我尝试制作双窗口并打开不同的相机,例如:
首先,包含MFC窗口和metaio SDK实例的窗口类
class CMyWindow : public CFrameWnd, metaio::IMetaioSDKCallback
{
CMyWindow();
~CMyWindow();
...
metaio::IMetaioSDKWin32* m_pMetaioSDK;
metaio::ISensorsComponent* m_sensors;
metaio::GestureHandlerWindows* m_gestureHandler;
}
然后是一个 winApp 类,如:
class CMyApplication : public CWinApp
{
public:
virtual BOOL InitInstance();
}
在 InitInstance() 方法中,我组成了两个窗口,例如:
BOOL CMyApplication::InitInstance()
{
// we have to call this right at the beginning
AfxEnableControlContainer();
// start the main windows, and init ARBrowser
try
{
m_win = new CMyWindow;
//get cameralist
metaio::stlcompat::Vector<metaio::Camera> cameraList;
cameraList = m_win->m_pMetaioSDK->getCameraList();
//check whether there is two camera.
assert( cameraList.size() == 2);
//sync these two camera parameters
for(int i = 0; i < cameraList.size(); i++)
{
metaio::Vector2di res = metaio::Vector2di(RES_WIDTH,RES_HEIGHT);
cameraList[i].resolution = res;
}
//assert(cameraList[0] == cameraList[1]);
m_win->m_pMetaioSDK->startCamera(cameraList[0]);
m_pMainWnd = m_win;
m_pMainWnd->ShowWindow( m_nCmdShow );
//the other window
m_win_right = new CMyWindow;
m_win_right->m_pMetaioSDK->startCamera(cameraList[1]);
m_pMainWnd = m_win_right;
m_pMainWnd->ShowWindow( m_nCmdShow );
}catch( std::exception& e )
}
但是,渲染无法正常工作,我看到两个空白窗口。注意到打开了两个摄像头,我发现跟踪状态如果达到模式就会弹出一些东西。我猜是渲染问题。我想检查 metaio 的自定义渲染部分。
有什么建议么?欢迎讨论。