CGEnabledView is a view class designed to wrap all OpenGL stuff (initialization, managing of Rendering Contexts and palettes, destruction, etc.) allowing the creation of multiple views in a MDI application.
CGEnabledView also offers these services:
- a function to get various information about OpenGL implementation.
- manages internally the creation of up to 20 stock display list and offers a basic interface for display list creation, execution and deletion (this function has been surpassed by CGLDispList child class,see below).
- let you choose a mouse cursor to use inside the views.
Three child classes offer an object oriented interface to OpenGL tessellation routines, quadrics objects and display lists:
- CGLDispList: let you manage display lists individually.
- CGLTesselator: let you create tesselator objects by which draw non simple polygons (that is convex or self intersecting ones).
- CGLQuadric: let you draw spheres, cylinders and disks specifying draw style, textures coordinates generation, normals generation and orientation.
- Use AppWizard to geneate an MDI project.
- Substitute CView with CGLEnabledView in [YourProject]View.cpp and [YourProject]View.h.
- Use ClassWizard to remove the OnDraw and PreCreateWindow functions (delete the bodies too).
- Override the VideoMode function if you would like to set the number of colors, the accuracy of the Z-buffer (note that some accelerated video cards don't support 32 bit accurate z-buffer) and activation of double-buffer.
- Override the OnDrawGL function and issue some GL commands.
- If you must issue GL commands outside overridable functions (e.g. in menu handlers) enclose them in a BeginGLCommands(), EndGLCommands() pair.
Since it's not adviseable to mix Windows GDI and OpenGL drawing commands some WM message handlers have been made private, use the supplied overridable virtual functions instead (OnDrawGL,OnSizeGL and OnCreateGL).
Date Posted: ??/??/98