*This book and the excerpts on this blogĀ are from 2004. Obviously, the API has changed a bit since then. I provide the older information and book in the hope that it will be useful to some hobbyists.*

**Purchase Printed Book** Learning Java Bindings for OpenGL (JOGL)

**Table of Contents:** Learning Java Bindings for OpenGL (JOGL)

*This book describes JOGL which was approved as JSR 231 and will become the javax.media.opengl package.*

-T. Gene Davis

copyright 2004 by Gene Davis of genedavissoftware.com

### Chapter 2: Using What We’ve Seen

**Coordinate Systems**

There is no sense in waiting until you know the best way to do things before using OpenGL. Sure you’re going to find out a few months later that there was a better way to do this or that, but you’ll never get to that point if you don’t use what you’ve learned. We’re going to take that principle to heart and start off showing you that you’ve already learned a lot.

Coordinate systems may be something that you’ve banished to the darker regions of your memory along with memories of Junior High School. It’s time to dust off those memories.

Do you remember the Cartesian coordinate system? It consists of two perpendicular axes [lines]. One is the y axis and the other is the x axis.

Here is a typical coordinate system with a point mapped out on it.

You’ll notice that there are numbers all over the place. Usually, they’re not all written out, but they’re always there. All points on the coordinate system correspond to distances along the y axis or along the x axis away from the origin. The origin is where the two axes meet. We’ve marked the origin with an O.

So we’ve indicated the position of one point on the graph. It is (6, 10). The 6 corresponds to 6 on the x axis away from the origin. The 10 indicates the point is 10 from the origin on the y axis.

Notice some positions are negative and some are positive. It would get confusing if 2 left of the origin looked like 2 right of the origin when we mapped out points. If there wasn’t any negatives how would we be able to tell where the point (1, 2) was? It could be in four different places, however if negatives are used (-1, 2) is very easy to spot. Can you find it?

If you’re lost at this point, your in trouble. Find a good introduction to geometry or introduction to graphs and functions book and plan on reading some of it. I’d recommend checking out a college book store, or maybe a big general book store. If money’s an issue, check out the internet for tutorials. There are plenty out there.

You can continue reading either way, but plan on spending time on learning about graphs.

During this chapter we will be using the coordinate system extensively. We will also cover drawing lines and the old Trig. standbys — Sine, Cosine and Tangent. Eventually in your pursuit of graphics and JOGL, you will want to become thoroughly familiar with these, but that is then and now is now. I’ll explain briefly anything that matters, and you can always use this book for reference.

Continue reading Chapter 2: Using What We’ve Seen – Learning Java Bindings for OpenGL (JOGL)