Wednesday, April 14, 2004

My solution to show and save the OpenGL image at the same time

Add another 'Picture Control' which ID is 'IDC_DISPWIN'
void CDlgOglDlg::OnImg2Display()
{ CWnd *DispWnd;
DispWnd=(CWnd *)GetDlgItem(IDC_DISPWIN);
CDC *dc;
dc=DispWnd->GetDC();
bmp2display((CClientDC*)dc, m_pclGlView->img, m_pclGlView->m_width, m_pclGlView->m_height,
0,0,0,0, m_pclGlView->m_width,m_pclGlView->m_height);
}

where we have already gotten the BMPPIXEL format image in memory m_pclGlView->img from m_pclGlView->SaveBitmap (i). To switch the two image windows that are genereated by OpenGL and 'bmp2display', use hide or show the window.
void CDlgOglDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
CWnd *DispWnd, *DispWnd2;
DispWnd =(CWnd *)GetDlgItem(IDC_DISPWIN);
DispWnd2=(CWnd *)GetDlgItem(IDC_OPENGLWIN);
ShowCursor(FALSE);
if (m_Status&FLG_DISPMODE)
{
m_pclGlView->OnDispCreate();
DispWnd2->ShowWindow(SW_SHOW);
DispWnd->ShowWindow(SW_HIDE);
}
if (m_Status&FLG_SAVEMODE)
{
m_pclGlView->OnSaveCreate();
DispWnd->ShowWindow(SW_SHOW);
DispWnd2->ShowWindow(SW_HIDE);
}
m_pclGlView->InitGL();
SetTimer(1,30,NULL);
CDialog::OnLButtonDown(nFlags, point);
}

where IDC_DISPWIN is the windown ID for 'bmp2display' and IDC_OPENGLWIN is the window ID for OpenGL display.

No comments:

Post a Comment