Pro Java 6 3D Game Development - Java 3D, JOGL, JInput and JOAL APIs

von: Andrew Davison

Apress, 2008

ISBN: 9781430202127 , 528 Seiten

Format: PDF, OL

Kopierschutz: Wasserzeichen

Windows PC,Mac OSX geeignet für alle DRM-fähigen eReader Apple iPad, Android Tablet PC's Online-Lesen für: Windows PC,Mac OSX,Linux

Preis: 56,99 EUR

Mehr zum Inhalt

Pro Java 6 3D Game Development - Java 3D, JOGL, JInput and JOAL APIs


 

Contents at a Glance

5

Contents

6

About the Author

18

About the Technical Reviewers

19

Acknowledgments

20

Introduction

21

Is This Book for Me?

21

What’s This Book About?

21

What’s This Book Not About?

22

Where’s the CD/ Code?

22

How Is This Book Different from KGPJ?

22

Java for Games Programming: Are You Joking?

23

What About Java on Games Consoles?

24

Java 3D

25

Introducing Java 3D

26

Overview of Java 3D

26

Overview of the Scene Graph

27

Java 3D Strengths

30

Criticisms of Java 3D for Games Programming

32

Alternatives to Java 3D

36

Summary

37

Get a Life (in 3D)

38

The Game of Life

38

Running Life3D

39

An Overview of the Life3D Classes

41

Deciding How to Start

42

Displaying the 3D Game

43

Scene Graph Creation

45

Behaviors in Java 3D

50

A Time- Based Behavior

52

Managing the Grid

52

The Cell

60

Time for Screensavers

68

More Life Required?

70

Summary

71

Get a Life (the Java 6 Way)

72

Life3D Basics

72

An Overview of the Life3D Classes

73

Making a Splash

75

The Desktop API

79

The System Tray

80

Scripting in Java SE 6

90

Scripting in Life3D

97

Summary

104

The Colliding Grabbers

105

Building Articulated Arms

105

Class Diagrams for Arms3D

106

Creating the Application Window

107

Drawing the 3D Scene

108

Processing the Keys

110

Monitoring Grabber Joints

111

Managing the Grabbers

112

The Grabber

120

Implementing Collision Detection

133

The Floor

138

The Colored Tiles

140

The Floor’s Axes Labels

141

Summary

142

When Worlds Collide

143

Odejava and ODE

143

Bouncing a Ball

146

Visualizing Balls in a Box

151

A Note of Application Development

165

Summary

166

A Multitextured Landscape

167

Surveying the Landscape

167

Building the Scene

169

The Multitextured Floor

172

The Splash Shape

184

Moving Balls

192

Driving the Balls

198

More Multitexturing

198

Summary

199

Walking Around the Models

200

Populating a Scene

200

Class Diagrams for ObjView3D

201

A Spherical Background

202

A Skybox Background

203

A Skybox Built with Quads

204

Loading Models

210

Ground Cover

216

Manipulating the User’s Viewpoint

218

Summary

222

More Backgrounds and Overlays

223

Retained, Immediate, and Mixed Modes

223

The Earth, Moon, and Mars

224

Spinning the Background

232

The Model Viewer with a Shifting Background and Overlays

239

Summary

249

Nonstandard Input Devices

250

Webcam Snaps

251

Webcam Snaps with TWAIN

251

Displaying Pictures Using TWAIN

252

TWAIN Timing Tests

258

Webcam Snaps with JMF

259

Comparing TWAIN and JMF Capture

265

QTJ

265

Other Uses for Webcam Snaps

266

Summary

267

Navigating a 3D Scene by Waving Your Arm

268

Using the Wrist Strap

268

Image Processing

270

Finding the Bands

272

Arm Navigation

283

Other Approaches

287

Summary

288

Building a Gamepad Controller with JInput

289

JInput

289

The Gamepad and Windows

290

Installing and Testing JInput

292

Three JInput Applications

296

A Gamepad Controller

303

Swing and JInput

313

Alternatives to JInput

316

Summary

317

Gamepad Grabbers

318

Example Overview

318

Playing Sounds

320

Managing Obstacles

323

Collision Detection

326

Sending Input to the Grabbers

327

The Grabbers

334

The Grabber Arms

341

Summary

341

3D Sound with JOAL

342

Why JOAL and Java 3D?

342

Background on OpenAL and JOAL

343

Managing JOAL Sounds

345

Using JOALSoundMan

355

Other Source Types

361

Summary

362

The P5 Glove

363

Introducing the P5 Glove

363

Using Kenner’s Java API

365

Examining the Glove’s Data

366

The Glove

371

A Specialized Glove Class

373

A Test Rig for FPSGlove

377

Visiting the Musical Cow

379

The P5 Glove and JInput

386

Summary

387

JOGL

388

Two JOGL Programming Frameworks

389

What Is JOGL?

389

Installing JOGL

390

The Callback Framework

391

Rotating a GLCanvas Cube with Callbacks

393

Rotating a GLJPanel Cube with Callbacks

401

Callback Summary

405

The Active Rendering Framework

405

Rotating a Cube with Active Rendering

407

Java 3D and JOGL

417

More Information on JOGL and OpenGL

418

Summary

419

Touring the World

420

Application Details

420

Constructing the Canvas

422

The Camera Position

423

Responding to Key Presses

424

Let the Rendering Commence

427

Rendering Initialization

428

The Rendering Loop

432

Updating the Game

432

Rendering the Scene

434

Drawing the Tree Billboard

434

Drawing the Ground Shapes

437

The Planet Earth

439

The Skybox

441

Adding a 2D Overlay

444

Drawing the Floor

446

Summary

449

Loading Models

450

Overviews of the Examples

450

The OBJ File Format

453

The OBJ File Loader

455

Viewing a Model

468

Other JOGL Model Loaders

470

The TourModelsGL Application

471

Summary

484

Index

485