This example was inspired by David Yu's cylsproc.c --
a sample program using OGL with pthreads on IRIX. (see
https://toolbox.sgi.com/toolbox/src/exampleCode/opengl/sproc/)
On NT, starting with an MFC Multi Document Interface (MDI) and using wgl*,
the MultiOGL example begins a thread via AfxBeginThread to do the
OGL rendering of a cylinder. Each thread uses its own OGL context.
Main Window allows (some standard MFC features have been disabled):
File -> Exit
Window -> New Window: creates a new MultiOGLView
instance and starts an OGL
Rendering Thread
Each view is cascaded over
the previous view(s).
Window -> Tile: Tile the views instead of cascading
Help -> About: simple about dialog
MultiOGLView.cpp demonstrates the setting of events and
communication with the OGL rendering thread:
ONSIZE: resizes the view accordingly and resets the viewport
SETFOCUS: adds blue hightlight to the cylinder
KILLFOCUS: removes the blue highlight from the cylinder
Files:
MultiOGL.h MultiOGL.cpp Application class
(from App Wizard)
MainFrm.h MainFrm.cpp MDI main frame
ChildFrm.h ChildFrm.cpp MDI child frame
MultiOGLDoc.h MultiOGLDoc.cpp Doc
MultiOGLView.h MultiOGLView.cpp View
All wgl* and OGL code is here.
Each view instance does an AfxBeginThread
to start an OGL render procedure,
OGLRenderThreadProc.
StdAfx.h StdAfx.cpp Precompiled Headers
Author:
|
Mary McQueen
Applications Engineering
SGI Computer Systems
mmcqueen@sgi.com
|