C++ OpenGL, good game programming tutorial?

I was wondering if anyone knows a good (and working), simple OpenGL C++ game tutorial. I have tried these one's so far, i will state why they haven't worked.

URL | Reason why it didn't work:

http://NeHe.GameDev.net/ | glaux.h is required for this, and is now depricated (and impossible to find on Google)

http://rastertek.com/tutgl40.html | Incomplete tutorial

http://www.opengl-tutorial.org/ | Multiple LNK errors




So as you guys can see, i have Googled a few tutorials, but i have yet to find any that actually work all the way though. Any suggestions? If you have an OpenGL tutorial that goes all the way through and works, please PLEASE tell me! Thanks, Kind regards.
I recommend this tutorial to everyone who asks. Best OpenGL tutorial I've seen:

http://www.arcsynthesis.org/gltut/
Google "OpenGL Montana State". There is a PDF from a Masters student that shows a lot of basics commands.

Grab some coffee, lock yourself in a room, and start from scratch. Use the basics commands from that tutorial and build and test it progressively.

For easy compilation, write a simple CMake script (and install CMake if you don't have it)

Here's the CMake script (name it CMakeLists.txt and put it in the same directory as your main C++ file). I'm calling the main file opengl_example.cc


1
2
3
4
5
6
7
8
9
10
11
12
13
14

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

set(MAIN_FILE opengl_example)
project(OpenGL_Example)

set(CMAKE_CXX_FLAGS "-O3 -g")

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})

add_executable(${MAIN_FILE} ${MAIN_FILE}.cc)
target_link_libraries(${MAIN_FILE} ${OPENGL_LIBRARIES})


Make a build directory (I don't recommend running cmake in the source directory because if you want to remove the build and learn the source intact you can simply just delete the build folder) and run cmake (via the GUI in Windows/Linux/MacOSX or in Terminal if using Linux/MacOSX)

To get the visualization to render, you will also have to link to X11 if using Linux/MacOSX, and probably something else if using Windows. I can tell you how to do that on Mac/Linux if you need it but I don't use Windows so I can't help there.

@Disch Do you know of anything more easy? I'm completely new to the OpenGL thing in C++. All i know is general C++ so i don't really understand any of this. I need a tutorial that will tell me step by step pretty much everything i have to do. I don't even know where to start at that tutorial.
Last edited on
@jmadsen What do CMake files do?
CMake is a cross-platform system for generating the build rules to compile your project.

If you are using Windows and VisualStudio, it will generate a VisualStudio project
If you are using Linux/MacOSX and Make, it will generate UNIX Makefiles.
If you are using MacOSX and Xcode, it will generate an Xcode project

Also works with several other IDE's like CodeBlocks, Qt Creator, KDevelop, etc.

It's especially useful when linking against other libraries and packages. For example, the compile command for OpenGL on Linux will be something like:

g++ -O3 -g opengl_tutorial.cc -o opengl_tutorial -l/usr/local/lib/libgu.so -l /usr/local/lib/libglu.so -I /usr/local/ ...etc.

and thats just for OpenGL, it gets much more complicated with multiple programs, and without CMake you have to manually or use some other tool to locate where the header files and libraries are because it differs from system to system.

closed account (N36fSL3A)
The cplusplusguy on youtube. He has a accent, but they're very good tuts. Just don't follow all his programming practices.
@Disch Do you know of anything more easy?


The problem is not necessarily that the tutorial is complicated... it's more that 3D graphics are complicated.

But like I said... that tutorial is the best I've seen. Not only does it go in assuming you know little/nothing about OpenGL or 3D programming in general, but it also explains everything in excruciating detail.

Any tutorial that is "easier" is probably not telling you everything and/or is using outdated libs.

I need a tutorial that will tell me step by step pretty much everything i have to do.


The tutorial I linked does that.

I don't even know where to start at that tutorial.


Start with the first entry "About this book". Read it, then hit "next", read that page then keep hitting next and reading pages.

It'll be about 10 pages before you get into actual code... but that's the point. You just said you need step-by-step explanations and he explains everything. That's what makes it such a good tutorial.


If you halfass and try to dive into OpenGL without understanding basic 3d graphics concepts like NDC space, matrix transformations, vectors, etc... you'll be in for a world of hurt. The first few pages of that tutorial go over all of that.



Also... I want to caution you that any tutorial that tells you to use glMatrixMode, glVertex, or glBegin/glEnd is outdated and not worth reading. This includes NeHe, and most other tutorials online.

That stuff has been deprecated for years... since OpenGL 3.0. OpenGL is now passed version 4.0.

EDIT:

Lumpkin wrote:
they're very good tuts. Just don't follow all his programming practices.


So... learn from the tutorial but don't do what he does in the tutorial?

wat? =P



EDIT:

Also... any articles by Song Ho Ahn are very good. I stumbled upon a few and have been consistently impressed.

He doesn't really have an overall tutorial that I know of, but he goes into more intermediate/advanced techniques. I'd look at them after you finish the arcsythesis (or whatever other) tutorial.

Example of one of his articles:

http://www.songho.ca/opengl/gl_fbo.html
Last edited on
closed account (N36fSL3A)
You knew what I meant :P

He's a good programmer and teacher, but his style is not the best.
haha, I actually didn't, but I thought it was funny. I haven't seen any of his tutorials but I find that youtube tutorials are usually not the way to go for technical / coding details. It's better to have that stuff written down so you can read it and digest it rather than keep rewinding and watching the same bit over and over until it sinks in.

But maybe that's just me.
Topic archived. No new replies allowed.