我正在和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的自定义渲染部分。
有什么建议吗?讨论欢迎。