Lesson Index
The lessons on this page may contain mistakes, poor commenting, and should not be considered the best resource to learn OpenGL from. What you do with the code is up to you. I am merely trying to make the learning process a little easier for those people new to OpenGL. If you are serious about learning OpenGL, you should spend the money and invest in the following books: Red Book Version 1.4 (4th ed.): 0321173481, Blue Book Version 1.4 (4th ed.): 032117383X, Orange Book Version 1.4 (Shading Language): 0321197895. Although they can be difficult for the new OpenGL programmer to understand, they are by far the best books written on the subject of OpenGL. Another book I would recommend is the OpenGL Superbible, although opinions vary. It is also important that you have a solid understanding of the language you plan to use. Although I do comment the non-GL lines, I am self-taught, and may not always write proper or even good code. It's up to you to take what you have learned from this site and apply it to projects of your own. Play around with the code, read books, ask me questions if need be. Once you have surpassed the code on this site or even before, check out some of the more professional sites such as OpenGL.org. Also be sure to visit the many OpenGL links on my page. Each site I link to is an incredible asset to the OpenGL community. Most of these sites are run by talented individuals that not only know their GL, they also program a lot better than I do. Please keep all of this in mind while browsing my site. I hope you enjoy what I have to offer!

One final note, if you see code that you feel is similar to someone else's code, please contact me. I assure you, any code I borrow from or learn from either comes from the MSDN or from sites created to help teach people in a similar way that my site teaches GL. I never intentionally take code, and never would without giving the proper person credit. There may be instances where I get code from a free site not knowing that site took it from someone else, so if that happens, please contact me. I will either rewrite the code, or remove it from my program. Most the code should be original however, I only borrow when I absolutely have no idea how to accomplish something, and even then I make sure I understand the code before I decide to include it in my program. If you spot mistakes in any of the lessons, no matter how tiny the mistake may be, please let me know.

One important thing to note about my base code is that it was written in 1997. It has undergone many changes, and it is definitely not borrowed from any other sites. It will more than likely be altered in the future. If I am not the one that modifies it, the person responsible for the changes will be credited.
MacOS
Setting Up OpenGL In Mac OS:
This is not a tutorial, but a step by step walkthrough done by Tony Parker on how to install OpenGL and Glut under Mac OS. Tony has kindly ported the OpenGL lessons I've done to Mac OS with GLUT. I hope everyone enjoys the ports.  

I know alot of people have asked for Mac ports so support Tony by telling him how much you enjoy the ports. Without his work converting the projects there wouldn't be a Mac port. 
Solaris
Setting Up OpenGL In Solaris:
This is not a tutorial, but a step by step walkthrough done by Lakmal Gunasekara on how to install OpenGL and Glut under Solaris. Lakmal has kindly ported most of the OpenGL lessons I've done to both Irix and Solaris. I hope everyone enjoys the ports.  

If you'd like to port the code to another OS or Language, please contact me, and let me know. Before you start porting, keep in mind that I'd prefer all the code to be ported, rather than just a few of the lessons. That way, people learning from a port can learn at the same rate as the VC guys. 
MacOS X
Setting Up OpenGL In Mac OS X Using GLUT:
This tutorial was written by Raal Goff and will teach you how to get OpenGL working on Mac OS X using GLUT. Nothing really different aside from the headers and environment, but definitely a useful resource for anyone using this cool looking new OS. If you enjoy the information email Raal and let him know.  

Now that OpenGL is the API of choice for Mac users, I hope to see alot more demos, projects and games from all of you Mac users! It's good to see Apple supporting such a strong API. This tutorial may also be useful to those of you interested in using GLUT instead of the framework from lesson 1. 
Lesson 1
Setting Up An OpenGL Window:
In this tutorial, I will teach you how to set up, and use OpenGL in a Windows environment. The program you create in this tutorial will display an empty OpenGL window, switch the computer into fullscreen or windowed mode, and wait for you to press ESC or close the Window to exit. It doesn't sound like much, but this program will be the framework for every other tutorial I release in the next while.  

It's very important to understand how OpenGL works, what goes into creating an OpenGL Window, and how to write simple easy to understand code. You can download the code at the end of the tutorial, but I definitely recommend you read over the tutorial at least once, before you start programming in OpenGL. 
Lesson 2
Your First Polygon:
Using the source code from the first tutorial, we will now add code to create a Triangle, and a Square on the screen. I know you're probably thinking to yourself "a triangle and square... oh joy", but it really is a BIG deal. Just about everything you create in OpenGL will be created out of triangles and squares. If you don't understand how to create a simple little triangle in Three Dimensional space, you'll be completely lost down the road. So read through this chapter and learn.  

Once you've read through this chapter, you should understand the X axis, Y axis and Z axis. You will learn about translation left, right, up, down, into and out of the screen. You should understand how to place an object on the screen exactly where you want it to be. You will also learn a bit about the depth buffer (placing objects into the screen). 
Lesson 3
Adding Color:
Expanding on the second tutorial I will teach you how to create spectacular colors in OpenGL with very little effort. You will learn about both flat coloring and smooth coloring. The triangle on the left uses smooth coloring. The square on the right is using flat coloring. Notice how the colors on the triangle blend together.  

Color adds alot to an OpenGL project. By understanding both flat and smooth coloring, you can greatly enhance the way your OpenGL demos look. 
Lesson 4
Rotation:
Moving right along. In this tutorial I'll teach you how to rotate both the triangle and the quad. The triangle will rotate on the Y axis, and the quad will rotate on the X axis. This tutorial will introduce 2 variables. rtri is used to store the angle of the triangle, and rquad will store the angle of the quad.  

It's easy to create a scene made up of polygons. Adding motion to those object makes the scene come alive. In later lessons I'll teach you how to rotate an object around a point on the screen causing the object to move around the screen rather than spin on its axis. 
Lesson 5
3D Shapes:
Now that we have setup, polygons, quads, colors and rotation figured out, it's time to build 3D objects. We'll build the objects using polygons and quads. This time we'll expand on the last tutorial, and turn the triangle into a colorful pyramid, and turn the square into a solid cube. The pyramid will use blended colors, the cube will have a different color for each face.  

Building an object in 3D can be very time consuming, but the results are usually worth it. Your imagination is the limit! 

I am not a guru programmer. I am an average programmer, learning new things about OpenGL every day.
I do not claim to know everything. I do not guarantee my code is bug free. I have made every
effort humanly possible to eliminate all bugs but this is not always an easy task.
Please keep this in mind while going through the lessons!

Back To NeHe Productions!