0%

Book Description

The licensing of OpenGL to many leading computer companies, including Microsoft, has made it possible for graphics programmers to learn to write stunning 3D graphics programs using the industry graphics standard on the world's most popular operating system. And OpenGL Programming for Windows 95 and Windows NT is the key to the door of opportunity for those who see the tremendous potential for programmers who can produce high-quality 3D applications on these platforms.

Using numerous examples, Microsoft's Visual C++ programming platform, the C++ programming language, and the Microsoft Foundation Classes, Fosner starts with a generic C application that can be compiled from any 32-bit C compiler and, step by step, covers the basics of creating an OpenGL program:

  • Selecting the appropriate pixel format

  • Arranging the device context and rendering contexts

  • Enhancing OpenGL programs to achieve maximum speed

  • Using display lists and texture maps

  • Finding OpenGL enhancements hidden in your video driver

  • Programming OpenGL's Modelview matrix to get the effects you want

  • Providing rapid animation under Windows -- without bogging down the user interface.

  • Most important, you'll absorb this knowledge within the context of developing a Windows application that you can experiment with and actually use in your Windows programs. You will gain hands-on experience in designing, creating, programming, measuring, and optimizing a real OpenGL 3D animation program.

    Table of Contents

    1. Copyright
      1. Dedication
    2. Preface
    3. Acknowledgments
    4. List of Figures
    5. List of Listings
    6. 1. Why 3D? Why OpenGL?
      1. What’s So Important about 3D?
      2. Learning OpenGL on Windows
      3. Summary
    7. 2. OpenGL for Windows Programmers
      1. Overview of Device Contexts, Rendering Contexts, and Pixel Formats
      2. Pixel Formats
        1. Pixel Format Structure
        2. Selecting and Examining a Pixel Format
      3. Rendering Contexts
        1. The WGL Context-Rendering Functions
        2. Methods for Creating an RC
      4. Fonts and OpenGL
      5. Double Buffering
      6. Advanced Miscellaneous Functions
      7. Creating a Simple OpenGL Program with the Windows C API
      8. Creating a Simple MFC C++ OpenGL Program
      9. Summary
    8. 3. Understanding OpenGL
      1. What Does OpenGL Do?
        1. Why OpenGL?
        2. Who Controls OpenGL?
      2. How OpenGL Works
        1. How a Vertex Becomes a Pixel
        2. The z-Buffer
        3. Hardware Accelerators
      3. Terminology
      4. Constructing Primitives
        1. The glBegin( )/glEnd( ) Wrappers
        2. OpenGL Command Notation
        3. Vertex Commands
      5. OpenGL and DLLs
        1. OpenGL’s Main Library
        2. OpenGL’s Utility Library
        3. OpenGL’s Auxiliary Library
      6. Summary
    9. 4. Rendering with OpenGL
      1. Primitives
        1. OpenGL Points
        2. OpenGL Lines
        3. OpenGL Polygons
          1. Front Faces, Back Faces, and Rendering Modes
          2. Polygon Types
          3. Patterned Polygons
          4. Complex Polygons—Controlling Polygon Edge Boundaries
          5. Rectangles—A Special Case
      2. Rendering Primitives
        1. Specifying a Color
        2. Calculating Normal Vectors
          1. Calculating Normals for Flat Surfaces
          2. Calculating Normals for Analytic Surfaces
        3. Clearing the Rendering Window
      3. Summary
    10. 5. Matrix Transformations Are Your Friends!
      1. Elementary Transformations
        1. Rotation and Translation
          1. A Quick Overview of Matrix Multiplication
          2. Homogeneous Coordinates
        2. Scaling Transformations
      2. OpenGL’s Modelview Matrix
        1. Modeling Transformations
        2. Viewing Transformations
          1. The gluLookAt( ) Function
          2. How to Look at Anything from Anywhere
        3. The Components of the Modelview Matrix
        4. Manipulating the Matrix Directly
      3. Viewport and Projection Transformations
        1. Viewport Transformations
        2. Projection Transformations
          1. Orthographic Projection
          2. Perspective Projection
      4. Summary
      5. Try This
    11. 6. Creating a Windows OpenGL View Class
      1. Encapsulating OpenGL
        1. Architecture of the Model–View–Controller
        2. Building the OpenGL View Class Framework
        3. Customizing the View for OpenGL
          1. Editing PreCreateWindow()
          2. Editing OnEraseBkgnd()
          3. Editing OnCreate() and Setting up a Pixel Format and a Rendering Context
          4. Editing OnDestroy()
          5. Editing OnSize()
          6. Editing OnDraw()
        4. Using the COpenGLView Class
      2. Summary
      3. Try This
    12. 7. Display Lists and Fonts
      1. Caching OpenGL Commands
        1. Dynamic or Adaption Tessellation
        2. Creating a Display List
        3. Recording a Display List
        4. Executing a Display List
        5. Generating a Unique Display List ID
          1. The glIsList() Function
          2. The glGenLists() Function
        6. Deleting and Reusing Display List IDs
        7. Sequential Display Lists
          1. Generating a Display List for a Character Set
        8. Sharing Display Lists between RCs and Threads
      2. Hierarchical Display Lists
      3. Using Display Lists in the COpenGLView Class
      4. Rendering Windows Fonts in OpenGL
        1. The wglUseFontBitmaps() Function
        2. Adding Bitmapped Text to COpenGLView
        3. The wglUseFontOutlines() Function
      5. Summary
      6. Try This
    13. 8. OpenGL and Animation
      1. Animation Loops in Windows
      2. A Slightly Less Extreme Animation Loop
      3. Letting Windows Tell Us When to Redraw
      4. Getting the Smoothest Animation Possible
      5. Try This
    14. 9. Colors, Materials, and Lights
      1. Color
        1. Color and Lighting
        2. Color and Shading
      2. Materials
        1. Types of Material Properties
          1. Diffuse and Ambient Properties
          2. Specular and Shininess Properties
          3. Emissive Property
        2. Specifying a Material Property
          1. Selecting an Object’s Material Properties
          2. Creating Your Own Material Properties
      3. Lighting
        1. Enabling Lighting
        2. Global Lighting
        3. Individual Light Sources
          1. Setting the Illuminating Parameters
          2. Setting the Position
          3. Setting Attenuation
          4. Creating a Spotlight
        4. Creating a Scene with Multiple Light Sources
          1. Ray Tracing
          2. The Module for the Scene
        5. Optimizing the Rendering of Dynamically Changing Material Properties
      4. Try This
    15. 10. Textures
      1. Windows Bitmap Files
        1. A Quick Look at Windows DIB Format
        2. A Special Microsoft Extension
        3. Reading a Windows Bitmap into an OpenGL Image
        4. Changing an Image’s Size
      2. Specifying a Texture
        1. Multiple Images and Large Images
        2. Generating Images of Multiple Levels of Detail
      3. Introducing the COpenGLImage Class
        1. Deciding between Decal and Modulation Mode
        2. Using COpenGLImage to Select the Image
        3. Controlling Image Quality
      4. Applying a Texture to a Surface
        1. Repeating Textures and the glTexParameter*() Function
        2. Texture Quality and Filtering
        3. Texture Objects in OpenGL 1.1
      5. Other Texture-Mapping Features
      6. Try This
    16. 11. Picking Objects in 3-Space
      1. Manipulating OpenGL Objects
        1. Using Selection Mode
        2. Creating Names and a Name Stack
      2. Determining Which Objects Are Picked
      3. Summary
    17. 12. Advanced OpenGL Features
      1. Overview of OpenGL Extensions
        1. In Pursuit of Extensions
        2. Getting an Extension’s Address
      2. The Vertex Array Extensions Found in OpenGL 1.0
      3. Advanced Vertex Construction: Vertex Arrays in OpenGL 1.1
        1. Using Vertex Array Pointers
        2. Using Color Array Pointers
        3. Using Color-Index Array Pointers
        4. Using Normal Vector Array Pointers
        5. Using Edge-Flag Array Pointers
        6. Using Texture-Coordinate Array Pointers
        7. Enabling Vertex Array Functionality
        8. Rendering an Element of the Array
        9. Rendering All or Part of the Array
        10. Indirectly Rendering All or Part of the Array
        11. Manipulating Arrays of Vertex Arrays
        12. When to Modify Vertex Array Data
      4. OpenGL 1.1’s Texture Objects
      5. OpenGL 1.1 Extensions
      6. The Silicon Graphics OpenGL Drivers—Cosmo OpenGL
      7. OpenGL and Windows 95
      8. Measuring Code Speed
      9. Shadows
      10. Fog
      11. Hardware Accelerators
        1. Creative Labs’ 3D Blaster
        2. Omnicomp Corp.’s 3DEMON
        3. Dynamic Pictures’ V192
        4. Accelerator Summary
      12. Try This
    18. OpenGL Resources
      1. Newsgroups
      2. Bibliography
      3. Other Software Development Resources
    3.17.28.48