CUBE: Demonstrates an OpenGL Application

Click to open or copy the CUBE project files.

CUBE is a simple OpenGL application. It demonstrates how to integrate OpenGL with the MFC single document interface (SDI), and how OpenGL's resource contexts are used in conjunction with device contexts.

For a more detailed explanation of OpenGL, refer to the Microsoft Win32 SDK and the October 1994, Volume 8, Number 10 issue of Microsoft System Journal. OpenGL is currently supported only on Windows NT, not on Windows 95.

When you start the sample, a 3-D colorful cube is drawn. To animate the cube, either click Play on the Edit menu or click the Play toolbar button.

Note   Because the CUBE sample uses OpenGL graphics, which only run on Windows NT, this sample will not run on Windows 95.

This sample demonstrates the following keywords:

CCmdUI::SetCheck; CDC::GetSafeHdc; CDC::RealizePalette; CDC::SelectPalette; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPalette::CreatePalette; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::InvalidateRect; CWnd::KillTimer; CWnd::MessageBox; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnEraseBkgnd; CWnd::OnPaletteChanged; CWnd::OnQueryNewPalette; CWnd::OnSize; CWnd::OnTimer; CWnd::PreCreateWindow; CWnd::RedrawWindow; CWnd::SetTimer; ChoosePixelFormat; DescribePixelFormat; GetPixelFormat; LoadBitmap; PIXELFORMATDESCRIPTOR; PeekMessage; SetPixelFormat; SwapBuffers; glBegin; glClear; glClearColor; glClearDepth; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; glViewport; gluPerspective; wglCreateContext; wglDeleteContext; wglGetCurrentContext; wglGetCurrentDC; wglMakeCurrent