Table of Contents

preface

acknowledgments

system & user requirements

PART I    Up to speed

1  Design

1.1  The functional paradigm  4
Writing programs in the functional paradigm  4
Advantages of the functional paradigm  4
Disadvantages of the functional paradigm  5
Graphics models using the functional paradigm  6
1.2  From C to C++  7
Practical aspects  8
Consistency is the key  8
Data structures, pointers, and retrieval 9
1.3  Object-oriented paradigm  11
Object-oriented design  12
Document/View object model  13
Becoming an object-oriented designer  14
Advantages of the object-oriented paradigm  18
Disadvantages of the object-oriented paradigm  18
The inception of object-oriented design  19
Graphics models using the object-oriented paradigm  19
1.4  Cross-library drawing interfaces  22

1.5  Object-oriented development problems  24

Object spaghetti  25
Access path control problems  25
The devil is in the details  26

2  Templates

2.1  Introduction to templates  28
Using templates  29
Sorting with templates and pointers  29
2.2  LVector object, a generic class  32
Allocating space  36
Adding template access operators  37
Utility functions  38
Using the LVector object  40
2.3  LMatrix object, a generic class  40

2.4  Template efficiency issues  41

3  3D math magic

3.1  Introduction  44

3.2  3D linear algebra  44

2D Data Representations  45
3D Representations and other quantities  46
Operations on vectors  48
3.3  The LPoint3 object  50
LPoint3 object overview  51
Rotation using LPoint3  52
Scaling using LPoint3  58
Translation using LPoint3  59
Skewing using LPoint  61
Projection using LPoint  64
The complete object  68
3.4  Computer friendly algorithms  72
Operation count  72
Series expansions  73
3.5  High-speed intersections  77
Ray-to-plane intersections  77
Ray-to-sphere intersections  79
Ray-to-polygon intersections  81
Ray-to-cube intersections  82
Intersection of rays and hybrid objects  82
3.6  Other issues  84
Matrix stacks  84
Distance aberration effects  85


PART II    Geometry and the rendering pipeline

4  Digital shapes

4.1  Polygons and polygon models  90
Vertex locations  90
Edges  91
Triangles  92
Polygons  95
Polygon sets  96
4.2  Scan/conversion  98
Digital polygons  98
Polygon depth-slope constants  100
Optimization notes  102

5  Lighting shading & texturing

5.1  Lighting  105
Base or selected color  107
Emitted  108
Ambient  109
Diffuse  109
Specular  110
pecial forms  111
Alpha blending  112
5.2  Shading  113
Wireframe modeling  114
Flat shading  115
Gouraud shading  116
Phong shading  116
Complex polygonal surfaces  117
Pixel level modeling  119
5.3  Texturing  119
Mapping of textures  120
Texture map resolver  121

6  Space & the pipeline

6.1  Viewing volumes and clipping  127
Viewing volume model  127
Clipping into the viewing volume  128
Clipping a point  129
Clipping a line  129
Clipping a triangle  130
Deciding what to draw  131
Elimination and hiding of objects  131
Pipelining  134
6.2  Hidden surface removal (HSR) methods  135
Backface culling  136
Painter's algorithm  137
Z-buffer  139
Interpixel frame blasting  140
Scan-line Z-buffer  141
Binary space partitioning (BSP) trees  141
HSR algorithm method notes  144
6.3  Tessellating  145
Tessellation criteria and modeling  145
Vertex reduction  145
Polygon set count reduction  146
Implicit surface tessellation and constructive solid geometry  147

7  Smooth object models

7.1  Building smooth object models  153
Interpolation  153
Natural (cubic) splines  154
7.2  LSpline object  156
LSpline member functions  158
7.3  Smooth 2D objects  163
Smooth swept 3D objects  163
N-dimensional splines  167
Making splines less curvy  170
Using splines for animation  171
NURBS (nonuniform rational B-spline)  174


PART III    Windows 3D development

8  LACE 3D nice & easy

8.1  Graphics applications  178
Single view applications  178
Multiple view applications  179
Distributed visualization models  180
8.2  LACE-3D  181
Overview  182
Device contexts  183
Accessing a device context  184
Drawing with the Windows API  184
Double-buffering  188
LACE-3D's view and modeling interface  189
LPolySet and using a context  191
Windows API function calls  198
Polygon set models  198
Modeling function surfaces  200
Spline solid revolver  204

9  Building a better Silly Putty

9.1  The Silly Space application  211
Overview  212
Implementation overview  213
Tessellation triangle container  214
9.2  Fundamental functions  222

9.3  Real-time 3D blob modeling  226

User interface manipulation of blobs  243
9.4  The SillyDocument object  246
The Silly Space document  253
The Silly Space view object  254
9.5  Tools and tessellation  262
Dialog box support  273
Mouse events and 3D interfaces  277
Painting and creating our model  280


PARTIV    Visualization with OpenGL and MFC

10  Scientific visualization and Partica

10.1  Scientific applications  288

10.2  Using Partica for 3D work  290

Importing molecular and protein structures  292
Building moving models  293
LIVE mesh-based shapes and surfaces  294

11  OpenGL and Windows

11.1  OpenGL  297
Overview  297
Windows OpenGL context functions  297
Pixel format functions  298
Linking and including OpenGL headers  299
11.2  COpenGLView window  300
COpenGLView object  300

11.3  Initialization  303

11.4  Painting and sizing  310

OpenGL transparency  315
OpenGL wireframe and solid modeling  316
OpenGL culling and lighting  317
OpenGL anti-aliasing  317
OpenGL palettes  318

11.5  Virtual trackball  319

11.6  Mouse interface  325

11.7  Using MFC and cursors  328

11.8  Forcing user interface updates  329

11.9  Copying the CView to the clipboard  330

12  ActiveX and OpenGL

12.1  Summary  332

12.2  ActiveOpenGL implementation  333

ActiveOpenGLCtl object definition  334
ActiveOpenGLCtl member functions  336

epilogue

appendix A  3D Internet Web sites

A.1  Web sites related to graphics  347

A.2  Free sources and other things  349

A.3  Corporate graphic web sites  350

appendix B  LMATRIX source

B.1  Header file  352

B.2  Member functions  355

appendix C  Series testing program

appendix D  LACE-3D selected source

D.1  Object building blocksnbsp; 362
Projection structure  363
LPolyParamsurfacing parameters object  364
LModeler color gradient maker  365
LPolySurf fundamental object projector, surfacer, drawer  366
LPlotTriangle  367
LPolySurfComplexcomplex poly shape  368
LText  369
Line segment  369
LRectangle  369
LTriangle  370
LCube  370
LSphere  371
LSurface  372
LSolidRevolve  373
LModeler fundamental poly database  373
D.2  Member functions  374
LText implementation"Text"  375
LLine implementation  375
LRectangle implementation  375
LTriangle implementation  376
LCube implementation  376
LSphere implementation  377
LSurface implementation  377
LSolidRevolve implementation  379
D.3  Application object  382
LPolySurf implementation  394
LPlotTriangle implementation  396
LPolySet implementation  402
Object list dialog box  406
About dialog box  407
View control  410
Solid revolver dialog box  413
Model window  418
Atom dialog box  420
Settings dialog box  426

appendix E  Silly Space

E.1  Stream functions  431

E.2  Mouse event functions  434

appendix F  API functionality comparison

F.1  Summary statistics  440

F.2  MFC specific functions  441

F.3  OWL specific functions  443

F.4  Shared API functions  444

appendix G  OpenGL for Windows

G.1  OpenGL Auxiliary  449

G.2  OpenGL functions and extended functions  450

OpenGL utility functions  454
Windows implementation OpenGL functions  456
Related Win32 functions  456
G.3  COpenGLView header  469
COpenGLView Member Functions  471
glossary

works cited & further reading

about the author

index

CD-ROM contents