5.1 Getting Started
Roughly speaking, using the EZ graphics library consists of 6 steps.
- Initialize EZwgl, Create a 3DCanvas and display it. If needed, an application
may create more than one 3DCanvases. However, only one of them is active
at any given time. Use
EZ_Set3DCanvas
to set the active 3DCanvas.
- Set the display attributes. The important ones are color mode and
back buffer type (if double buffer is used).
Color mode is sort of global across all 3DCanvases since
the graphics library uses a single physical colormap. While other attributes, like
back buffer, zbuffer, lighting, color material, back face culling,
foging etc are binded to individual 3DCanvases.
- Initialize GL data. This include matrices, lighting parameters, material
properties etc.
- Create and display geometric objects by using
EZ_Begin
, EZ_End
,
EZ_Vertex3fv
, EZ_Normal3fv
, EZ_Color3fv
,
EZ_Lightfv
etc. You may also use display list.
- Create a event handler routine for each 3DCanvas, this part is the
trickest.
- Processing events by using any one of the three event handling routines.