
Pro Java 6 3D Game Development
Java 3D, JOGL, JInput and JOAL APIs
By: Andrew Davison
Hardcover | 1 April 2007
At a Glance
532 Pages
26.4 x 19.0 x 3.4
Hardcover
$89.99
or 4 interest-free payments of $22.50 with
orShips in 5 to 7 business days
Create strange lands filled with mysterious objects (cows frozen in blocks of ice, chirping penguins, golden globes with wavering eyes) and throw away your keyboard and mouse, to go exploring armed only with a gamepad, power glove, or just your bare hands!
Java gaming expert Andrew Davison will show you how to develop and program 3D games in Java technology on a PC, with an emphasis on the construction of 3D landscapes. It's assumed you have a reasonable knowledge of Java--the sort of thing picked up in a first Java course at school.
Topics are split into three sections: Java 3D API, non-standard input devices for game playing, and JOGL. Java 3D is a high-level 3D graphics API, and JOGL is a lower-level Java wrapper around the popular OpenGL graphics API.
You'll look at three non-standard input devices the webcam, the game pad, and the P5 data glove.
Along the way, you'll utilize several other games-related libraries including JInput, JOAL, JMF, and Odejava.
Learn all the latest Java SE 6 features relevant to gaming, including splash screens, JavaScript scripting as well as the desktop and system tray interfaces.
Unique coverage of Java game development using both the Java 3D API and Java for OpenGL, as well as invaluable experience from a recognized Java gaming guru, will provide you with a distinct advantage after reading this book.
| About the Author | p. xix |
| About the Technical Reviewers | p. xxi |
| Acknowledgments | p. xxiii |
| Introduction | p. xxv |
| Java 3D | |
| Introducing Java 3D | p. 3 |
| Overview of Java 3D | p. 3 |
| Overview of the Scene Graph | p. 4 |
| Some Java 3D Scene Graph Nodes | p. 5 |
| The HelloUniverse Scene Graph | p. 5 |
| Java 3D Strengths | p. 7 |
| The Scene Graph | p. 7 |
| Performance | p. 7 |
| Unique Features | p. 8 |
| Java Integration | p. 8 |
| Documentation and Examples | p. 8 |
| Criticisms of Java 3D for Games Programming | p. 9 |
| Java 3D's Level of Abstraction | p. 9 |
| Java 3D Games | p. 10 |
| Java 3D Support | p. 12 |
| Alternatives to Java 3D | p. 13 |
| Summary | p. 14 |
| Get a Life (in 3D) | p. 15 |
| The Game of Life | p. 15 |
| Running Life3D | p. 16 |
| Configuring Life3D | p. 16 |
| A Life3D Screensaver | p. 17 |
| An Overview of the Life3D Classes | p. 18 |
| Deciding How to Start | p. 19 |
| Displaying the 3D Game | p. 20 |
| Integrating Java 3D and Swing | p. 20 |
| Window Sizing | p. 21 |
| Processing Key Presses | p. 21 |
| Scene Graph Creation | p. 22 |
| Lighting the Scene | p. 24 |
| The Scene's Background | p. 24 |
| Building the Cells Grid and Making It Behave | p. 25 |
| Viewer Positioning | p. 25 |
| Viewer Movement | p. 27 |
| Behaviors in Java 3D | p. 27 |
| A Time-Based Behavior | p. 29 |
| Managing the Grid | p. 29 |
| Accessing Properties | p. 30 |
| Creating the Grid Scene Graph | p. 31 |
| Updating the Cells States | p. 33 |
| Will the Cell Live or Die? | p. 34 |
| Rotating the Grid | p. 36 |
| The Cell | p. 37 |
| Building the Cell's Scene Graph | p. 39 |
| Coloring the Cells | p. 41 |
| Setting the Cell's Visibility | p. 42 |
| Changing a Cell's Life State | p. 43 |
| Visual Changes to a Cell | p. 44 |
| Time for Screensavers | p. 45 |
| Changing Life3D into a Screensaver | p. 46 |
| Problems with Screensavers | p. 47 |
| The SaverBeans SDK | p. 47 |
| More Life Required? | p. 47 |
| Summary | p. 48 |
| Get a Life (the Java 6 Way) | p. 49 |
| Life3D Basics | p. 49 |
| An Overview of the Life3D Classes | p. 50 |
| Making a Splash | p. 52 |
| Animating a Clock | p. 53 |
| Drawing onto a Splash | p. 54 |
| Drawing the Clocks | p. 54 |
| JAR Packaging | p. 55 |
| Adding ClockAnimation to Life3D | p. 55 |
| The Desktop API | p. 56 |
| Using the Desktop Browser | p. 56 |
| What Other Browser Capabilities Are There? | p. 57 |
| The System Tray | p. 57 |
| Creating Life3D's Popup Menu | p. 58 |
| The Menu Contents | p. 58 |
| Creating the Traylcon | p. 59 |
| Building the Popup Menu | p. 60 |
| Listening for Actions | p. 62 |
| Using a Text Editor | p. 64 |
| Launching an E-mail Client | p. 65 |
| Listening for the Check Boxes | p. 66 |
| Scripting in Java SE 6 | p. 67 |
| Executing a Script | p. 68 |
| Communicating with a Script | p. 69 |
| Speeding Things Up | p. 72 |
| Calling Script Functions | p. 73 |
| Letting a Script Use Java | p. 74 |
| More Scripting Information | p. 74 |
| Scripting in Life3D | p. 74 |
| Initializing the Grid | p. 75 |
| Changing the Grid's State | p. 76 |
| Executing the Script Rules | p. 78 |
| The Rules Script | p. 80 |
| Summary | p. 81 |
| The Colliding Grabbers | p. 83 |
| Building Articulated Arms | p. 83 |
| Class Diagrams for Arms3D | p. 84 |
| Creating the Application Window | p. 85 |
| Drawing the 3D Scene | p. 86 |
| Processing the Keys | p. 88 |
| Monitoring Grabber Joints | p. 89 |
| Managing the Grabbers | p. 90 |
| Adding the Grabbers to the Scene Graph | p. 90 |
| Processing Keyboard Commands | p. 93 |
| Translating the Grabbers | p. 94 |
| Rotating a Grabber Joint | p. 95 |
| Collecting the Collision Joints | p. 96 |
| Collision Detection and Recovery | p. 97 |
| Why Bother with JointsBehavior? | p. 97 |
| Touching the Floor | p. 98 |
| The Grabber | p. 98 |
| Making the Grabber's Appearance | p. 98 |
| The Grabber Shape | p. 100 |
| Local and Global Coordinate Systems | p. 105 |
| Making the Fingers | p. 106 |
| Handling Rotation Commands | p. 108 |
| Collision Detection | p. 110 |
| Implementing Collision Detection | p. 111 |
| Initializing the Bounding Spheres | p. 114 |
| Positioning the Bounding Spheres | p. 114 |
| Touching the Ground | p. 115 |
| The Floor | p. 116 |
| The Colored Tiles | p. 118 |
| The Floor's Axes Labels | p. 119 |
| Summary | p. 120 |
| When Worlds Collide | p. 121 |
| Odejava and ODE | p. 121 |
| Installing Odejava | p. 123 |
| Documentation, Examples, and Online Help | p. 123 |
| Bouncing a Ball | p. 124 |
| Three-Stage Simulation | p. 125 |
| Initializing the Engines | p. 126 |
| Initializing Static Objects | p. 126 |
| Initializing Dynamic Objects | p. 127 |
| Executing the Simulation | p. 127 |
| Performing a Simulation Step | p. 128 |
| Examining the Contact Points | p. 129 |
| Cleaning Up | p. 129 |
| Visualizing Balls in a Box | p. 129 |
| Creating the Scene | p. 131 |
| The Box | p. 133 |
| Managing the Spheres | p. 137 |
| A Sphere | p. 139 |
| I'm Steppin' Out | p. 142 |
| A Note of Application Development | p. 143 |
| Summary | p. 144 |
| A Multitextured Landscape | p. 145 |
| Surveying the Landscape | p. 145 |
| Building the Scene | p. 147 |
| Creating the Floor | p. 149 |
| Start the Balls Moving | p. 150 |
| Moving Around the Scene | p. 150 |
| The Multitextured Floor | p. 150 |
| Heights Map Generation | p. 153 |
| The Floor's Geometry | p. 155 |
| The Floor's Appearance | p. 158 |
| The Splash Shape | p. 162 |
| The Splash Shape's Geometry | p. 163 |
| The Splash Shape's Appearance | p. 166 |
| Moving Balls | p. 170 |
| Positioning the Ball | p. 173 |
| Moving About | p. 174 |
| Driving the Balls | p. 176 |
| More Multitexturing | p. 176 |
| Bump Mapping | p. 176 |
| Shaders | p. 177 |
| Summary | p. 177 |
| Walking Around the Models | p. 179 |
| Populating a Scene | p. 179 |
| Class Diagrams for ObjView3D | p. 180 |
| A Spherical Background | p. 181 |
| A Skybox Background | p. 182 |
| A Skybox Built with Quads | p. 183 |
| Terragen and NConvert | p. 184 |
| From Images to Textures | p. 185 |
| Making the Skybox | p. 186 |
| Texturing a Plane | p. 187 |
| The Size of the Skybox | p. 188 |
| Loading Models | p. 189 |
| Loading OBJ Models | p. 189 |
| The OBJ Model Loader | p. 190 |
| Positioning a Model | p. 193 |
| Ground Cover | p. 195 |
| Manipulating the User's Viewpoint | p. 197 |
| Positioning the User's Viewpoint | p. 198 |
| Moving the Viewpoint at Runtime | p. 198 |
| Setting Up the Key Behavior | p. 199 |
| Processing a Key | p. 199 |
| Summary | p. 201 |
| More Backgrounds and Overlays | p. 203 |
| Retained, Immediate, and Mixed Modes | p. 203 |
| The Earth, Moon, and Mars | p. 204 |
| Building the Scene | p. 206 |
| The Background | p. 209 |
| Some Variations on a Theme | p. 209 |
| Spinning the Background | p. 212 |
| Building the Scene and Terminating | p. 213 |
| Rotating the Image | p. 214 |
| Manipulating the Image | p. 215 |
| Rotation and Clipping | p. 215 |
| Avoiding Gaps in the Rotated Image | p. 216 |
| Terminating the Thread | p. 218 |
| Drawing the Background Image | p. 218 |
| The Model Viewer with a Shifting Background and Overlays | p. 219 |
| Setting Up the Canvas | p. 221 |
| Modifying the Key Behavior | p. 222 |
| A Canvas with a Background and Overlays | p. 223 |
| Drawing the Background | p. 225 |
| The Deep Blue Sea | p. 227 |
| Adding Overlays | p. 228 |
| Summary | p. 229 |
| Nonstandard Input Devices | |
| Webcam Snaps | p. 233 |
| Webcam Snaps with TWAIN | p. 233 |
| Displaying Pictures Using TWAIN | p. 234 |
| Snapping a Picture Again and Again and... | p. 235 |
| The TWAIN Capture Device | p. 237 |
| TWAIN Timing Tests | p. 240 |
| Webcam Snaps with JMF | p. 241 |
| Again Taking Pictures Again and Again | p. 242 |
| The Capture Device with JMF | p. 243 |
| Comparing TWAIN and JMF Capture | p. 247 |
| QTJ | p. 247 |
| Other Uses for Webcam Snaps | p. 248 |
| Summary | p. 249 |
| Navigating a 3D Scene by Waving Your Arm | p. 251 |
| Using the Wrist Strap | p. 251 |
| Image Processing | p. 253 |
| Image Processing Issues | p. 254 |
| Dealing with the Issues | p. 254 |
| Finding the Bands | p. 255 |
| FindBands Class Diagrams | p. 256 |
| Image Processing Overview | p. 257 |
| The Bands Analyzer | p. 257 |
| The Band Manager | p. 263 |
| Representing a Blob | p. 265 |
| Arm Navigation | p. 266 |
| Creating the 3D Scene | p. 267 |
| Moving the User's Viewpoint | p. 268 |
| From Analysis to Action | p. 269 |
| Other Approaches | p. 270 |
| JAI | p. 270 |
| ImageJ | p. 271 |
| Image Processing Books | p. 271 |
| Summary | p. 271 |
| Building a Gamepad Controller with JInput | p. 273 |
| JInput | p. 273 |
| The Gamepad and Windows | p. 274 |
| Installing and Testing JInput | p. 276 |
| Examining the Input Devices | p. 277 |
| The Other JInput Test Applications | p. 279 |
| Three JInput Applications | p. 280 |
| Listing the Controllers | p. 281 |
| Viewing Controller Details | p. 281 |
| Testing a Controller | p. 286 |
| A Gamepad Controller | p. 287 |
| Initializing the Controller | p. 289 |
| Checking the Components | p. 290 |
| Finding the Rumblers | p. 292 |
| Polling the Device | p. 292 |
| Reading the Stick Axes | p. 293 |
| Reading the POV Hat | p. 294 |
| Reading the Buttons | p. 295 |
| Using the Rumbler | p. 296 |
| Other Approaches | p. 296 |
| Swing and JInput | p. 297 |
| Constructing the Application | p. 298 |
| Polling the Gamepad | p. 299 |
| Alternatives to JInput | p. 300 |
| Summary | p. 301 |
| Gamepad Grabbers | p. 303 |
| Example Overview | p. 303 |
| Playing Sounds | p. 305 |
| Background Music with SoundsPlayer | p. 307 |
| Obstacle Noises with SoundsPlayer | p. 307 |
| Managing Obstacles | p. 308 |
| Making an Obstacle | p. 309 |
| Making the Boxes | p. 310 |
| Collision Detection | p. 311 |
| Sending Input to the Grabbers | p. 312 |
| Processing Keyboard Input | p. 313 |
| Building a Grabber Operation for a Key Press | p. 314 |
| Processing Gamepad Input | p. 316 |
| Building a Grabber Operation for the Gamepad | p. 318 |
| The Grabbers | p. 319 |
| Connecting the Grabbers to the Camera | p. 319 |
| Constructing the Grabbers | p. 320 |
| Processing an Operation | p. 321 |
| The Grabber Arms | p. 326 |
| Summary | p. 326 |
| 3D Sound with JOAL | p. 327 |
| Why JOAL and Java 3D? | p. 327 |
| Background on OpenAL and JOAL | p. 328 |
| What About JOAL? | p. 328 |
| Installing JOAL | p. 329 |
| Managing JOAL Sounds | p. 330 |
| Initializing JOAL | p. 330 |
| Initializing the Listener | p. 331 |
| JOAL Clean Up | p. 333 |
| Loading a Sound | p. 333 |
| Positioning a Source | p. 336 |
| Playing, Stopping, and Pausing a Source | p. 337 |
| Moving the Listener | p. 337 |
| Turning the Listener | p. 338 |
| Using JOALSoundMan | p. 340 |
| Moving a Source | p. 340 |
| Moving the Listener | p. 341 |
| Moving the Listener Between Sources | p. 342 |
| Turning the Listener | p. 343 |
| JOAL and Swing | p. 344 |
| Other Source Types | p. 346 |
| Ambient Sounds | p. 346 |
| Cone Sounds | p. 346 |
| Summary | p. 347 |
| The P5 Glove | p. 349 |
| Introducing the P5 Glove | p. 349 |
| Using Kenner's Java API | p. 351 |
| Examining the Glove's Data | p. 352 |
| What ShowGlove Displays | p. 353 |
| ShowGlove Overview | p. 355 |
| Initializing and Terminating the Glove | p. 356 |
| Polling the Glove | p. 356 |
| The Glove | p. 357 |
| Updating and Accessing the Glove | p. 358 |
| Closing Down | p. 359 |
| A Specialized Glove Class | p. 359 |
| Initializing the Glove | p. 360 |
| Updating and Closing | p. 360 |
| Getting the Position | p. 360 |
| On a Roll | p. 361 |
| Clenching My Fist | p. 362 |
| Pressing the A Button | p. 362 |
| A Test Rig for FPSGlove | p. 363 |
| Visiting the Musical Cow | p. 365 |
| The Glove Behavior | p. 366 |
| Adding a Musical Cow | p. 370 |
| Initializing the Viewpoint | p. 371 |
| Cleaning Up | p. 371 |
| The P5 Glove and JInput | p. 372 |
| Summary | p. 373 |
| JOGL | |
| Two JOGL Programming Frameworks | p. 377 |
| What Is JOGL? | p. 377 |
| Installing JOGL | p. 378 |
| The Callback Framework | p. 379 |
| Using GLCanvas | p. 379 |
| Using GLJPanel | p. 380 |
| Rotating a GLCanvas Cube with Callbacks | p. 381 |
| Building the Top-Level Window | p. 382 |
| Connecting the Canvas | p. 383 |
| Building the Listener | p. 383 |
| Measuring FPS Accuracy | p. 388 |
| Rotating a GLJPanel Cube with Callbacks | p. 389 |
| Building the Panels | p. 391 |
| The Background Panel | p. 391 |
| Making the 3D Background Transparent | p. 392 |
| Timing the GLJPanel | p. 393 |
| More Visual Effects with GLJPanel | p. 393 |
| Callback Summary | p. 393 |
| The Active Rendering Framework | p. 393 |
| Rotating a Cube with Active Rendering | p. 395 |
| Building the Application | p. 396 |
| Dealing with Window Events | p. 397 |
| Preparing the Canvas | p. 397 |
| Thread Rendering | p. 398 |
| The Game Life Cycle Methods | p. 404 |
| Statistics Reporting | p. 405 |
| Java 3D and JOGL | p. 405 |
| More Information on JOGL and OpenGL | p. 406 |
| Summary | p. 407 |
| Touring the World | p. 409 |
| Application Details | p. 409 |
| Constructing the Canvas | p. 411 |
| The Camera Position | p. 412 |
| Responding to Key Presses | p. 413 |
| Let the Rendering Commence | p. 416 |
| Rendering Initialization | p. 417 |
| Loading Textures | p. 418 |
| Lighting the Scene | p. 419 |
| Creating the Ground Shapes | p. 420 |
| The Rendering Loop | p. 421 |
| Updating the Game | p. 421 |
| Rendering the Scene | p. 423 |
| Drawing the Tree Billboard | p. 423 |
| Drawing the Ground Shapes | p. 426 |
| The Planet Earth | p. 428 |
| The Skybox | p. 430 |
| Adding a 2D Overlay | p. 433 |
| Drawing the Floor | p. 435 |
| Drawing the Tiles | p. 435 |
| Drawing the Axes | p. 437 |
| Summary | p. 438 |
| Loading Models | p. 439 |
| Overviews of the Examples | p. 439 |
| The OBJ File Format | p. 442 |
| Shape Statements | p. 442 |
| Grouping Statements | p. 443 |
| Material Use Statements | p. 443 |
| The MTL File Format | p. 443 |
| The OBJ File Loader | p. 444 |
| Reading in the OBJ File | p. 446 |
| Reading a Face | p. 447 |
| Reading in an MTL File | p. 449 |
| Recording Material Use | p. 450 |
| Centering and Resizing a Model | p. 451 |
| Creating a Display List for the Model | p. 452 |
| Finding a Material | p. 452 |
| Rendering with a Material | p. 453 |
| Rendering a Face | p. 455 |
| Drawing a Model | p. 457 |
| When to Create the Display List | p. 457 |
| Viewing a Model | p. 457 |
| Loading the Model | p. 458 |
| Drawing the Model | p. 459 |
| Other JOGL Model Loaders | p. 459 |
| The TourModelsGL Appiication | p. 460 |
| Adding Models | p. 461 |
| Let's Be Picky | p. 463 |
| Gleem: A Different Way of Picking | p. 469 |
| A Singing Penguin | p. 470 |
| The Fog Descends | p. 471 |
| Summary | p. 473 |
| Index | p. 475 |
| Table of Contents provided by Ingram. All Rights Reserved. |
ISBN: 9781590598177
ISBN-10: 1590598172
Series: Expert's Voice in Java
Published: 1st April 2007
Format: Hardcover
Language: English
Number of Pages: 532
Audience: General Adult
Publisher: Springer Nature B.V.
Country of Publication: GB
Dimensions (cm): 26.4 x 19.0 x 3.4
Weight (kg): 1.15
Shipping
| Standard Shipping | Express Shipping | |
|---|---|---|
| Metro postcodes: | $9.99 | $14.95 |
| Regional postcodes: | $9.99 | $14.95 |
| Rural postcodes: | $9.99 | $14.95 |
Orders over $79.00 qualify for free shipping.
How to return your order
At Booktopia, we offer hassle-free returns in accordance with our returns policy. If you wish to return an item, please get in touch with Booktopia Customer Care.
Additional postage charges may be applicable.
Defective items
If there is a problem with any of the items received for your order then the Booktopia Customer Care team is ready to assist you.
For more info please visit our Help Centre.
You Can Find This Book In

The Unofficial Sims Cookbook
From Baked Alaska to Silly Gummy Bear Pancakes, 85+ Recipes to Satisfy the Hunger Need
Hardcover
RRP $39.99
$29.99
OFF
This product is categorised by
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentObject-Oriented Programming or OOP
- Non-FictionComputing & I.T.Graphical & Digital Media ApplicationsComputer Games Design
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentGames Development & Programming
- Non-FictionComputing & I.T.Digital Lifestyle & Online World: Consumer & User GuidesComputer Games & Online Games Strategy Guides
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentWeb Programming
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentSoftware Engineering























