Before you start
This tutorial, Part 2 of a four-part series, goes beyond what was accomplished in Part 1 by creating the BB gun, the bugs, and the BBs using Open Graphics Library (OpenGL). Upon completing this tutorial, we'll watch the BBs you fire whiz across the screen!
In this series, you'll be introduced to the basic techniques, tools, and libraries used to create a full-featured Eclipse plug-in that uses the Standard Widget Toolkit (SWT) and OpenGL libraries for providing graphics. Part 1 looks at building the framework for a simple video game that can be launched and played inside Eclipse by creating a plug-in. Part 2 takes the basic framework created in Part 1 and starts adding the actual visual elements using OpenGL. Part 3 adds the actual game elements, enabling the user to interact with the graphics created in Part 2. Part 4 takes everything created in the previous three parts and makes sure it all works.
This tutorial continues where you left off in Part 1 by adding OpenGL and the SWT to the mix. You'll do the following:
- Create shapes based on the number of tasks in the task list that will be known as bugs
- Create a shape for the BB gun and add color and texture
- Add text to the works for when bugs get blown up
- Create BBs that zip across the screen
- Learn how to place all the objects on the same canvas using translations
This tutorial assumes you have the basic knowledge of Java syntax and coding, and about Eclipse plug-in programming, as shown in Part 1 of this series. Graphics programming knowledge is a plus, but not required. Knowledge of OpenGL is not required.
You need the following:
- Eclipse
- Eclipse is the framework for creating the plug-in in Part 1. Now you'll continue leveraging Eclipse in building the gaming plug-in. Download Eclipse V3.2 M3 or higher from Eclipse.org.
- Eclipse SWT
- The SWT is the Eclipse widgets package for window-making, donated to Eclipse by IBM. Download the SWT development version, 3.2 M3 or higher.
- Eclipse OpenGL
- The OpenGL libraries is needed for creating shapes and more. Download the experimental org.eclipse.opengl binding, version 0.5 for SWT 3.2.
- Eclipse Example Plug-in using OpenGL
- Download the Example plug-in with a view that uses OpenGL. You'll use the source code in this plug-in as a framework for building your own custom OpenGL scene.

