Chapter 13: Java Bindings to OpenGL (JOGL)

image from book Download CD Content

Introduction

OpenGL is the industry standard 3D library that lets game developers capture the power of hardware acceleration. Many of the leading games require OpenGL for hardware acceleration. OpenGL enables today’s top games to manipulate massive amounts of data in real time using hardware-accelerated geometry, real-time lighting, clipping, transformations, and rasterization. OpenGL has all kinds of special features for a dazzling array of effects, such as real-time fog, anti-aliasing, volume shadows, bump mapping, motion blur, transparency, reflections, 3D textures, volume rendering, and more.

OpenGL is designed to support the future of graphics in software and hardware through its extension mechanism. It can expose brand new features that didn’t even exist when it was originally designed.

The OpenGL API is highly stable. Workstations and supercomputers have been running OpenGL-based applications for more than a decade. OpenGL is also the most popular 3D solution for professional and consumer use.

Finally, OpenGL is cross-platform. The software runtime library ships with all Windows, Macintosh, Linux, and Unix systems.

Using OpenGL with Java has been possible for several years now by using one of several publicly available Java bindings to OpenGL. Unfortunately, not all of these bindings were of top quality or complete enough for many applications; some violated the Java security model. Fortunately, developers at Sun sought to remedy the situation as a community-driven project under the management of Java Games Technology Group. They seeded it with their implementation of Java bindings for OpenGL, simply called JOGL, which is the result of picking the best elements of previous designs and utilizing the latest Java platform features to create the best possible real-time 3D graphics system for the Java developer.

In the first section of this chapter, we will explore OpenGL a bit more deeply. Then we will further examine JOGL, the Java bindings to OpenGL. Because OpenGL is a C library, Java does not by default have instant access to it. In addition, because Java is object-oriented and OpenGL is functional-based C, simple one-to-one JNI wrappers to OpenGL are not a robust and secure solution. Thus, Sun’s Game Technology Group developed JOGL to solve this problem for game developers.

You don’t have to have C OpenGL programming experience to develop with JOGL, and you can learn all about OpenGL by programming with JOGL. In fact, almost any OpenGL book, tutorial, sample C program, or other source can easily be ported to JOGL; in fact, many already have. Many excellent OpenGL resources exist, and this chapter is not meant to replace a solid OpenGL development book. However, because JOGL is meant to be as similar to OpenGL as possible yet still hold true to Java standards, there are some key differences between JOGL and OpenGL, and this chapter seeks to address those key differences.

Finally, we will look at an example and develop a basic 3D object renderer using JOGL.



Practical Java Game Programming
Practical Java Game Programming (Charles River Media Game Development)
ISBN: 1584503262
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net