You are previewing Ogre 3D 1.7.
O'Reilly logo
Ogre 3D 1.7

Book Description

With your knowledge of C++ and this guide, the gaming world awaits you. Starting with the basics of the OGRE 3D graphics rendering engine, it takes you from the essentials right through to advanced features and plugins.

  • Easy-to-follow introduction to OGRE 3D

  • Create exciting 3D applications using OGRE 3D

  • Create your own scenes and monsters, play with the lights and shadows, and learn to use plugins

  • Get challenged to be creative and make fun and addictive games on your own

  • A hands-on do-it-yourself approach with over 100 examples

  • In Detail

    Want to make your own 3D applications, simulations, and games?

    OGRE 3D, an open source Object-Oriented 3D Graphics Rendering Engine written in C++, which can be utilized to create a variety of 3D applications and is commonly used in game creation, can help you to do so!

    OGRE 3D 1.7 Beginner's Guide, based on the latest version 1.7, makes it super easy for you to make your own monsters, spaceship shooters, weapons, enemies, and more!

    OGRE 3D 1.7 Beginner's Guide will teach you to develop 3D applications that are exciting and interesting and if used correctly can result in stunning games and simulations. You will start from the very beginning and then work your way up to complex scenes and stunning effects.

    In this book you will start with how to download and configure OGRE 3D, then create your first example scene. With the help of this sample scene, you will be introduced to several related topics each of which will be explained through several other examples and by do-it-yourself tasks.

    After each example there is a section that explains the theory behind the technique used for deeper understanding. You will also use what you learned in one example in another example and repeat each technique several times while learning new ones at the same time to strengthen the topics learned. Within no time you will master the art of game creation. Imagine how great you will feel when all your friends are playing the great-looking games you've created with OGRE 3D and this book.

    A step-by-step guide for beginners, filled with examples and simple do-it-yourself exercises

    Table of Contents

    1. Ogre 3D 1.7
      1. Ogre 3D 1.7
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      6. 1. Installing Ogre 3D
        1. Downloading and installing Ogre 3D
        2. Time for action — downloading and installing Ogre 3D
          1. What just happened?
          2. Different versions of the Ogre 3D SDK
          3. Exploring the SDK
        3. The Ogre 3D samples
        4. Time for action — building the Ogre 3D samples
          1. What just happened?
          2. Pop quiz — which post effects are shown in the samples
        5. The first application with Ogre 3D
        6. Time for action — starting the project and configuring the IDE
          1. What just happened?
          2. ExampleApplication
          3. Pop quiz — which libraries to link
        7. Loading the first model
        8. Time for action — loading a model
          1. What just happened?
          2. Pop quiz — ExampleApplication and how to display a model
        9. Summary
      7. 2. The Ogre Scene Graph
        1. Creating a scene node
        2. Time for action — creating a scene node with Ogre 3D
          1. What just happened?
          2. How to work with the RootSceneNode
          3. 3D space
          4. Scene graph
          5. Pop quiz — finding the position of scene nodes
        3. Setting the position of a scene node
        4. Time for action — setting the position of a scene node
          1. What just happened?
          2. Pop quiz — playing with scene nodes
          3. Have a go hero — adding a Sinbad
        5. Rotating a scene node
        6. Time for action — rotating a scene node
          1. What just happened?
          2. Pop quiz — rotating a scene node
          3. Have a go hero — using Ogre::Degree
        7. Scaling a scene node
        8. Time for action — scaling a scene node
          1. What just happened?
          2. Pop quiz — creating child scene nodes
          3. Have a go hero — using createChildSceneNode()
        9. Using a scene graph the clever way
        10. Time for action — building a tree using scene nodes
          1. What just happened?
          2. Pop quiz — even more about the scene graph
        11. Have a go hero — adding a following ninja
        12. Different spaces in a scene
        13. Time for action — translating in World space
          1. What just happened?
          2. Different spaces in a 3D scene
        14. Translating in local space
        15. Time for action — translating in local and parent space
          1. What just happened?
          2. Pop quiz — Ogre 3D and spaces
          3. Have a go hero — adding symmetry
        16. Rotating in different spaces
        17. Time for action — rotating in different spaces
          1. What just happened?
        18. Scaling in different spaces
        19. Summary
      8. 3. Camera, Light, and Shadow
        1. Creating a plane
        2. Time for action — creating a plane
          1. What just happened?
          2. Representing models in 3D
        3. Adding a point light
        4. Time for action — adding a point light
          1. What just happened?
          2. Have a go hero — adding a second point light
        5. Adding a spotlight
        6. Time for action — creating a spotlight
          1. What just happened?
          2. Spotlights
          3. Pop quiz — different light sources
          4. Have a go hero — mixing light colors
        7. Directional lights
        8. Time for action — creating a directional light
          1. What just happened?
          2. Pop quiz — different light types
        9. The missing thing
        10. Time for action — finding out what's missing
          1. What just happened?
        11. Adding shadows
        12. Time for action — adding shadows
          1. What just happened?
        13. Creating a camera
        14. Time for action — creating a camera
          1. What just happened?
          2. Have a go hero — doing more with the thing
        15. Creating a viewport
        16. Time for action — doing something that illustrates the thing "in action"
          1. What just happened?
          2. Have a go hero — playing with different aspect ratio
        17. Summary
      9. 4. Getting User Input and Using the Frame Listener
        1. Preparing a scene
        2. Time for action — preparing a scene
          1. What just happened?
        3. Adding movement to the scene
        4. Time for action — adding movement to the scene
          1. What just happened?
          2. FrameListener
          3. Pop quiz — design pattern of FrameListener
        5. Modifying the code to be time based rather than frame based
        6. Time for action — adding time-based movement
          1. What just happened?
          2. Pop quiz — the difference between time- and frame-based movement
          3. Have a go hero — adding a second model
        7. Adding input support
        8. Time for action — adding input support
          1. What just happened?
          2. Window handle
          3. Pop quiz — window questions
        9. Adding movement to the model
        10. Time for action — controlling Sinbad
          1. What just happened?
          2. Have a go hero — using a speed factor for movement
        11. Adding a camera
        12. Time for action — making the camera work again
          1. What just happened?
          2. Mouse state
          3. Pop quiz — capturing the input
          4. Have a go hero — playing with the example
        13. Adding wireframe and point render mode
        14. Time for action — adding wireframe and point render mode
          1. What just happened?
        15. Adding a timer
        16. Time for action — adding a timer
          1. What just happened?
          2. Have a go hero — changing the input mode
        17. Summary
      10. 5. Animating models with Ogre 3D
        1. Adding animations
        2. Time for action — adding animations
          1. What just happened?
          2. Pop quiz — the importance of time
          3. Have a go hero — adding a second model
        3. Playing two animations at the same time
        4. Time for action — adding a second animation
          1. What just happened?
          2. Have a go hero — adding a factor to the animation speed
        5. Let's walk a bit
        6. Time for action — combining user control and animation
          1. What just happened?
        7. Adding swords
        8. Time for action — adding swords
          1. What just happened?
          2. Animations
        9. Printing all the animations a model has
        10. Time for action — printing all animations
          1. What just happened?
        11. Summary
      11. 6. Scene Managers
        1. Starting with a blank sheet
        2. Time for action — creating a blank sheet
          1. What just happened?
        3. Getting the scene manager's type
        4. Time for action — printing the scene manager's type
          1. What just happened?
          2. What does a scene manger do?
          3. Octree
        5. Another scene manager type
        6. Time for action — using another scene manager
          1. What just happened?
          2. ResourceManager
          3. setWorldGeometry
        7. Creating our own model
        8. Time for action — creating a model for displaying blades of grass
          1. What just happened?
          2. Manual object
          3. Texture mapping
          4. Have a go hero — playing with the manual object
        9. Adding volume to the blades of grass
        10. Time for action — using more triangles for volume
          1. What just happened?
        11. Creating a field of grass
        12. Time for action — building a field of grass
          1. What just happened?
        13. Exploring the name scheme
        14. Time for action — printing the names
          1. What just happened?
        15. Static geometry
        16. Time for action — using static geometry
          1. What just happened?
          2. Rendering pipeline
          3. Indices
        17. Summary
      12. 7. Materials with Ogre 3D
        1. Creating a white quad
        2. Time for action — creating the quad
          1. What just happened?
        3. Creating our own material
        4. Time for action — creating a material
          1. What just happened?
          2. Materials
          3. Have a go hero — creating another material
        5. Texture coordinates take two
        6. Time for action — preparing our quad
          1. What just happened?
        7. Using the wrapping mode with another texture
        8. Time for action — adding a rock texture
          1. What just happened?
        9. Using another texture mode
        10. Time for action — adding a rock texture
          1. What just happened?
        11. Using the mirror mode
        12. Time for action — using the mirror mode
          1. What just happened?
        13. Using the border mode
        14. Time for action — using the border mode
          1. What just happened?
        15. Changing the border color
        16. Time for action — changing the border color
          1. What just happened?
          2. Pop quiz — texture modes
          3. Have a go hero — Using texture modes
        17. Scrolling a texture
        18. Time for action — preparing to scroll a texture
          1. What just happened?
        19. Time for action — scrolling a texture
          1. What just happened?
        20. Animated scrolling
        21. Time for action — adding animated scrolling
          1. What just happened?
        22. Inheriting materials
        23. Time for action — inheriting from a material
          1. What just happened?
        24. Fixed Function Pipeline and shaders
          1. Render Pipeline
        25. Time for action — our first shader application
          1. What just happened?
          2. Writing a shader
        26. Texturing with shaders
        27. Time for action — using textures in shaders
          1. What just happened?
          2. What happens in the render pipeline?
          3. Have a go hero — combining color and texture coordinates
        28. Interpolating color values
        29. Time for action — using colors to see interpolation
          1. What just happened?
        30. Replacing the quad with a model
        31. Time for action — replacing the quad with a model
          1. What just happened?
        32. Making the model pulse on the x-axis
        33. Time for action — adding a pulse
          1. What just happened?
        34. Summary
      13. 8. The Compositor Framework
        1. Preparing a scene
        2. Time for action — preparing the scene
          1. What just happened?
        3. Adding the first compositor
        4. Time for action — adding a compositor
          1. What just happened?
          2. How the compositor works
        5. Modifying the texture
        6. Time for action — modifying the texture
          1. What just happened?
        7. Inverting the image
        8. Time for action — inverting the image
          1. What just happened?
        9. Combining compositors
        10. Time for action — combining two compositor effects
          1. What just happened?
        11. Decreasing the texture count
        12. Time for action — decreasing the texture count
          1. What just happened?
        13. Combining compositors in code
        14. Time for action — combing two compositors in code
          1. What just happened?
          2. Have a go hero — swapping the green and blue color channels
        15. Something more complex
        16. Time for action — complex compositor
          1. What just happened?
        17. Changing the number of pixels
        18. Time for action — putting the number of pixels in the material
          1. What just happened?
          2. Have a go hero — trying different numbers of pixels
        19. Setting the variable in code
        20. Time for action — setting the variable from the application
          1. What just happened?
        21. Changing the number of pixels while running the application
        22. Time for action — modifying the number of pixels with user input
          1. What just happened?
          2. Have a go hero — reducing parameter changes
        23. Adding a split screen
        24. Time for action — adding a split screen
          1. What just happened?
          2. Have a go hero — doing more with viewports
        25. Putting it all together
        26. Time for action — selecting a color channel
          1. What just happened?
        27. Summary
      14. 9. The Ogre 3D Startup Sequence
        1. Starting Ogre 3D
        2. Time for action — starting Ogre 3D
          1. What just happened?
        3. Adding resources
        4. Time for action — loading the Sinbad mesh
          1. What just happened?
        5. Using resources.cfg
        6. Time for action — using resources.cfg to load our models
          1. What just happened?
          2. Structure of a configuration file
        7. Creating an application class
        8. Time for action — creating a class
          1. What just happened?
        9. Adding a FrameListener
        10. Time for action — adding a FrameListener
          1. What just happened?
        11. Investigating the FrameListener functionality
        12. Time for action — experimenting with the FrameListener implementation
          1. What just happened?
        13. Time for action — returning true in the frameStarted function
          1. What just happened?
          2. Double buffering
        14. Time for action — returning true in the frameRenderingQueued function
          1. What just happened?
        15. Time for action — returning true in the frameEnded function
          1. What just happened?
        16. Adding input
        17. Time for action — adding input
          1. What just happened?
          2. Pop quiz — the three event handlers
        18. Our own main loop
        19. Time for action — using our own rendering loop
          1. What just happened?
        20. Adding a camera (again)
        21. Time for action — adding a frame listener
          1. What just happened?
        22. Adding compositors
        23. Time for action — adding compositors
          1. What just happened?
        24. Adding a plane
        25. Time for action — adding a plane and a light
          1. What just happened?
        26. Adding user control
        27. Time for action — controlling the model with the arrow keys
          1. What just happened?
        28. Adding animation
        29. Time for action — adding animation
          1. What just happened?
          2. Have a go hero — looking up what we used
        30. Summary
      15. 10. Particle Systems and Extending Ogre 3D
        1. Adding a particle system
        2. Time for action — adding a particle system
          1. What just happened?
          2. What is a particle system?
        3. Creating a simple particle system
        4. Time for action — creating a particle system
          1. What just happened?
        5. Some more parameters
        6. Time for action — some new parameters
          1. What just happened?
          2. Pop quiz — what makes a particle system
        7. Other parameters
        8. Time for action — time to live and color range
          1. What just happened?
          2. Pop quiz — time to live
        9. Turning it on and off again
        10. Time for action — adding intervals to a particle system
          1. What just happened?
          2. Pop quiz — emitter parameters
        11. Adding affectors
        12. Time for action — adding a scaler affector
          1. What just happened?
        13. Changing colors
        14. Time for action — changing the color
          1. What just happened?
          2. Have a go hero — change the color to red
        15. Two-way changing
        16. Time for action — change depending on the lifetime of a particle
          1. What just happened?
        17. Even more complex color manipulations
        18. Time for action — using complex color manipulation
          1. What just happened?
        19. Adding randomness
        20. Time for action — adding randomness
          1. What just happened?
        21. Deflector
        22. Time for action — using the deflector plane
          1. What just happened?
          2. Have a go hero — doing more with the thing
        23. Other emitter types
        24. Time for action — using a box emitter
          1. What just happened?
        25. Emitting with a ring
        26. Time for action — using a ring to emit particles
          1. What just happened?
        27. At the end, we would like some fireworks
        28. Time for action — adding fireworks
          1. What just happened?
          2. Pop quiz — different types of emitter
        29. Extending Ogre 3D
          1. Speedtree
          2. Hydrax
          3. Caelum
          4. Particle Universe
          5. GUIs
          6. CEGUI
          7. BetaGUI
          8. QuickGUI
          9. Berkelium
        30. Summary
        31. The end
      16. 11. Pop quiz — Answers
        1. Chapter 1
          1. Installing Ogre 3D
        2. Chapter 2
          1. Setting up the Environment
        3. Chapter 3
          1. Felix Gogo
        4. Chapter 4
          1. Felix Gogo
        5. Chapter 5
          1. The Book Inventory Bundle
        6. Chapter 7
          1. The Bookshelf: First Stab
        7. Chapter 9
          1. The Ogre 3D Startup Sequence
        8. Chapter 10
          1. How About a Graphical Interface?