6 Dicembre 2002
Costruzione di Interfacce - Paolo Cignoni
11
OnCreate
vOverridiamo anche la OnCreate, dove facciamo tutte le init di gl e del timer
vint CGLWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
v{
v   if (CWnd::OnCreate(lpCreateStruct) == -1) return -1;
v   m_hDC = ::GetDC(m_hWnd);
v   SetupPixelFormat(m_hDC);
v   m_hRC = wglCreateContext(m_hDC);
v   if(m_hRC==NULL){ AfxMessageBox("OpenGL contest fail");
v return -1;
v }
v if(!m_bHasTimer){ //set timer
v SetTimer(1, 10, NULL);
v        m_bHasTimer = TRUE;
v }
v  Invalidate();
v  return 0;
v}