vVa
fatto subito dopo la creazione della finestra.
Override (esplicito) della Create()
vBOOL MyOpenGLView::Create(LPCTSTR
lpszClassName,
LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, CCreateContext*
pContext)
v{
v if( ! CView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
return false;
v
v m_pDC = new CClientDC(this);
v ASSERT(m_pDC != NULL);
v
v // Setta il pixel format
v if (!SetupPixelFormat(m_pDC)) return FALSE;
v // Crea e setta il contesto OPENGL
v m_hrc = wglCreateContext(m_pDC->GetSafeHdc());
v if(m_hrc==NULL){
v AfxMessageBox("OpenGL contest fail");
v return FALSE;
v }
v