16
\$\begingroup\$

I'm sure there are already a bunch of questions like this asked, but the constant updating of the OpenGL library throws them all away, and in a month or two, the answers here will be worthless again.

I am ready to start programming in OpenGL using C++. I've got a working compiler (DevCpp; do NOT ask me to switch to VC++, and don't ask me why). Now I'm just looking for a solid tutorial on how to program with OpenGL. My assistant found the tutorial provided by NeHe Productions, but as I've come to find out, it's WAY OUT OF DATE! (although I did pull together a basic window to support an OpenGL canvas)

Then I went online, and found the OpenGL SuperBible, which apparently uses freeglut? But what I'd like to know is whether or not SuperBible 5th edition is up to date any longer. The suggestion to freeglut I found said the latest version was 2.6.0 but now it's 2.8.0!

  • Is the OpenGL SuperBible still a good, and fairly up-to-date place to start?
  • Is there a better place to go to learn OpenGL?
  • Am I allowed to simply store freeglut in the DevCpp include directory (maybe in GL), or is there some important procedure?
  • Are there any comments or suggestions that I didn't think to ask since I'm only just beginning?

@dreta cleared some things up for me, so now I have a better idea of what to ask:

I think I'd like to start out with OpenGL using a wrapper library instead of directly accessing OpenGL.
I just think that, for a beginner, it would be easier for me to program and get good results, while I don't yet have to understand all the grimy details (as @stephelton mentioned).

The problem is, I can't find any library that doesn't have undefined references to no longer supported functions. Freeglut sounds operational, but it still uses GLU.
Does anyone know what I can do?
Also, I tried compiling the first SuperBible's source, but I got errors since GLAPI is not being defined as a type, the error originating in the GLU library.

I'd like to use the SuperBible, but I don't know how to fix this.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ You should switch to GCC. \$\endgroup\$
    – notlesh
    May 9, 2012 at 0:38
  • \$\begingroup\$ DevCpp is just an IDE; which runs GCC (mingw to be specific). But since it was mentioned, Eclipse CDT would be preferable, as it hasn't been abandonware for the past 10 years. \$\endgroup\$ May 9, 2012 at 1:03
  • 4
    \$\begingroup\$ @Casper The inheritor of the DevCpp legacy was Code::Blocks and is still updated regularly. \$\endgroup\$ May 9, 2012 at 1:20
  • 1
    \$\begingroup\$ If you want a wrapper library around OpenGL, I suggest you try SFML. SFML provides the usual stuff like window creation, timers, etc. while also allowing you to draw text and simple shapes. You can drop drown to using "raw" OpenGL whenever you want to, mixing SFML functions and raw API calls. \$\endgroup\$
    – Oskar N.
    May 9, 2012 at 19:01
  • 1
    \$\begingroup\$ You can't "close" a question by adding "{CLOSED}" to the title. Questions will be closed by moderators or if enough users voted to close the question. I'll rolled your edits back.. the "CLOSED" will automatically be appended to your title if moderators decide to close it.. \$\endgroup\$
    – bummzack
    May 12, 2012 at 12:57

5 Answers 5

19
\$\begingroup\$

Our resident Nicol Bolas maintains an on-line book about modern graphics programming. It uses modern OpenGL, everything is introduced at an easy to consume pace, it's a good place to start. I've been using it to learn modern OpenGL and it's been doing me wonders in the past 2 months.

Beside that there are bits of knowledge here and there. The OpenGL wiki is quite well maintained. The code isn't "best practices" and sometimes there's ambiguity when it comes to OpenGL version, but outside of those rare occasion, it's a great resource.

If you want to learn about GLSL, there's the GLSL Core Tutorial from lighthouse3D. Though this is the only core knowledge i'd "trust" on the site, rest tends to be outdated.

Once you start to understand how modern OpenGL is done, you'll have an easy time looking for specific information, filtering out outdated code and most importantly reading the specification. You just have to start somewhere.

Most, if not all actually, of the OpenGL books availible are outdated. The new SuperBible is a freak of some sort and i wouldn't recommend it to anybody. The OpenGL Programming Guide for OpenGL 4.1 comes out September 16th, unfortunetly the 7th edition uses deprecated code, so you just have to wait, i sure am.

And ofcourse, you can always ask questions here.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Why would you not suggest the SuperBible? \$\endgroup\$
    – Codesmith
    May 9, 2012 at 13:12
  • 3
    \$\begingroup\$ @AUTO The 5th edition of the SuperBible uses a custom wrapper around OpenGL to make it "accessible". Alot of the examples use the custom wrapper excessively. It doesn't teach you what it's suppoused to, which is the OpenGL core specification. The way i see it, if you don't explicitly have to learn deprecated OpenGL, then just forget it even exists. There's no point learning it. The core specification is much more clear and powerful. \$\endgroup\$
    – dreta
    May 9, 2012 at 15:15
  • \$\begingroup\$ @AUTO The core specification is much more demanding at the beginning, that's a good thing. It'll force you to take care of most of the rendering process, giving you full understanding and control over it. It opens many, many more possibilities than the deprecated code. After that if you can learn your OS's API and lanuch OpenGL under it without things like glut then you're in wonderland. \$\endgroup\$
    – dreta
    May 9, 2012 at 15:24
  • \$\begingroup\$ OK, so let me ask you an important question: the GLU library seems to be deprecated and completely unsupported; by using the specification, do I get direct access, bypassing the need for the GLU? Such that, I wouldn't get any more linker errors to non-existing functions referenced to by the GLU library? \$\endgroup\$
    – Codesmith
    May 9, 2012 at 16:04
  • \$\begingroup\$ @AUTO GLU is completely unnecessary, i only ever touched it with a 10 foot pole during graphics programming class (we had to use deprecated code, it was painful, the standards change faster than the lesson program, i guess). It's just a library that helps with the deprecated code. If you have your code set up with GLU then it probably stinks. \$\endgroup\$
    – dreta
    May 9, 2012 at 16:42
1
\$\begingroup\$

It's been a while since this question was asked but I hope this will help people who have the same question as you.

I got started with OpenGL by reading a minibook on arcsynthesis.org. Not sure who wrote it. It looks like the site's registration has lapsed or something but you should be able to find it here: http://web.archive.org/web/20140209181347/http://www.arcsynthesis.org/gltut/. It uses OpenGL 3.3, so you will be using the modern pipeline and all the practices that entails, but you won't be exposed to tessellation or compute shaders.

Another site worth looking at is https://open.gl/. It seems to be VERY beginner focused and doesn't cover things nearly as in-depth as the above material, but it could be a good starting point for people who are just starting.

Remember to read the OpenGL wiki and google your function names if you need help. Some of the pages on the wiki are completely useless but others are quite helpful, both as a reference and as learning material.

\$\endgroup\$
1
0
\$\begingroup\$

These old tutorials are still very relevant to beginners. In fact, I would suggest starting there rather than with recent versions of OpenGL. More recent versions have discarded some of the easier methods of drawing geometry (namely immediate-mode drawing).

With recent versions, you have to prepare and send arrays of vertices and tell the video card how your vertices are arranged in the array you provide. These things are cumbersome to debug.

Some versions (namely OpenGL ES 2.x) require you to provide your own lighting equations (in the form of Fragment Shaders) and transform your own vertex data so that it ends up on the screen where you want it (Vertex Shaders). This is even harder to debug, and is no place for a beginner (in my opinion).

So I would actually suggest that you go back to those NeHe tutorials (etc) and start there. They may be "out of date" but they still work. When you start to understand what really happens in the rendering pipeline in OpenGL and get a feel for some of the mathematical concepts that make these things work, then you'll be ready to look into some of the more up-to-date methods of rendering in OpenGL.

\$\endgroup\$
4
  • \$\begingroup\$ Actually they DON'T work. That's why I posted this question. They're using the function gluPerspective which is deprecated, and there is no absolute substitute. \$\endgroup\$
    – Codesmith
    May 9, 2012 at 12:26
  • 1
    \$\begingroup\$ That is not an OpenGL function. It's a separate utility function provided by another library. You can find the code for it easily -- it's not very difficult. \$\endgroup\$
    – notlesh
    May 9, 2012 at 14:19
  • \$\begingroup\$ Thanks, but I only found an imperfect substitute that I don't know how to use. It accepts an argument "float *matrix", whereas the old one uses some internal matrix. What do I put for it then? \$\endgroup\$
    – Codesmith
    May 9, 2012 at 14:39
  • \$\begingroup\$ First hit on google for "gluPerspective implementation" is exactly what you're looking for. it calls glFrustum, which is not available in some recent versions of OpenGL (ES 2.x does not include it). Even that is not too hard to find the impl for. \$\endgroup\$
    – notlesh
    May 9, 2012 at 14:56
0
\$\begingroup\$

As others have said, most books are either deprecated or too advanced. Nonetheless, I would recommend the 5th edition of the SuperBible but only to get a quick overview of what can be done in OpenGL and to get familiar with things like the view/projection etc.

Diving immediately in to modern OpenGL could possibly get you overwhelmed at first, so do consider learning to do some basic things in the now deprecated versions.

I'd also like to add a site with good tutorials I've found lately http://ogldev.atspace.co.uk/

\$\endgroup\$
5
  • \$\begingroup\$ Thanks, I'll check that tutorial; but to use the OpenGL SuperBible, my question still remains: How do I fix GLU, since freeglut is based off it? \$\endgroup\$
    – Codesmith
    May 10, 2012 at 18:01
  • \$\begingroup\$ @AUTO: FreeGLUT is not "based off" GLU. Some FreeGLUT functions call GLU, but if you don't call those functions, then you won't have a problem. \$\endgroup\$ May 10, 2012 at 19:17
  • \$\begingroup\$ But isn't it likely the SuperBible calls these functions? And if it does, I can't use it. \$\endgroup\$
    – Codesmith
    May 11, 2012 at 13:53
  • \$\begingroup\$ Really, my opinion is to not bother with the source code provided with the SuperBible. Read it but try to make everything from scratch. On your problems with GLU, my best guess is that you haven't configured/installed your libraries correctly. Download the latest version of MinGW. Also download the latest version of freeglut and compile it, or find a pre-compiled library. Anyways, you should start learning some stuff rather than spend so much time on planning how to start. \$\endgroup\$ May 12, 2012 at 2:46
  • \$\begingroup\$ @AUTO: Why is it likely the SuperBible calls them? If it did call them, the SuperBible's code would not work. Which is why it doesn't call them. \$\endgroup\$ May 13, 2012 at 0:23
0
\$\begingroup\$

arcsynthesis.org (the site mentioned in the accepted answer) seems to be down and out, unfortunately. (EDIT: it is available at this link!).

Anton Gerdelan's tutorials for OpenGL 4 are very readable and up to date as of mid-2014. The first few are free, the rest are available on amazon, where they have great reviews, for a small price. So far I've been pleased.

There are some more free tutorials for OpenGL 3.3+ at http://www.opengl-tutorial.org/. They date back to 2012, but may be good supplemental material for other sources.

\$\endgroup\$
3

Not the answer you're looking for? Browse other questions tagged .