Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So, I'm new to OpenGL... I have general knowledge of game programming but little practical experience.

I've been looking into various articles and books and trying to dive into OpenGL, but I've found the various versions and old vs new way of doing things confusing.

I guess my first questions is does anyone know some figures about percentages of gamers that can run each version of OpenGL. What's the market share like? 2.x, 3.x, 4.x...

I looked into the requirements for Half Life 2 since I know Valve updated it with OpenGL to run on Mac and I know they usually try to hit a very wide user-base, and they say a minimum of GeForce 8 Series. I looked at the 8800 GT on Nvidia's website and it listed support for OpenGL 2.1. Which, maybe I'm wrong, sounds ancient to me since there's already 4.x. I looked up a driver for 8800GT and it says it supports 4.2! A bit of a discrepancy there, lol.

I've also read things like XP only supports up to a certain version, or OS X only supports 3.2, or all kinds of other things. Overall, I'm just confused as to how much support there is for various versions and what version to learn/use.

I'm also looking for learning resources. My search results thus far have pointed me to the OpenGL SuperBible. The 4th edition has great reviews on Amazon, but it teaches 2.1. The 5th edition teaches 3.3 and there are a couple things in the reviews that mention the 4th edition is better and that the 5th edition doesn't properly teach the new features or something? Basically, even within learning material I'm seeing discrepancies and I just don't even know where to start.

From what I understand, 3.x started a whole new way of doing things and I've read from various articles and reviews that you want to "stay away from deprecated features like glBegin(), glEnd()" yet a lot of books and tutorials I've seen use that method. I've seen people saying that, basically, the new way of doing stuff is more complicated yet the old way is bad >.>

Just a side note, personally, I know I still have a lot to learn beforehand, but I'm interested in tessellation; so I guess that factors into it as well, because, as far as I understand that's only in 4.x?

[just btw, my desktop supports 4.2]

share|improve this question
    
This question (on Stack Overflow) appears to be a duplicate: stackoverflow.com/questions/6823371/… –  Anderson Green Dec 14 '12 at 4:31

2 Answers 2

up vote 21 down vote accepted

If you're wondering about OpenGL coverage, a good place to start is the Steam Hardware Survey.

http://store.steampowered.com/hwsurvey?platform=pc

Unfortunately, it seems to be broken right now and it doesn't display any stats for videocards. :\

I've also read things like XP only supports up to a certain version

DirectX 9 is comparable to OpenGL 2.1, DirectX 10 to OpenGL 3.0 and DirectX 11 to OpenGL 4.0. This is where the confusion stems from.

XP supports all versions of OpenGL, but it does not support DirectX 10 or up. This is how Microsoft wanted to force people to upgrade to Vista, but it didn't work out very well. OpenGL is an open standard, so as long as videocard manufacturers are willing to produce drivers for XP, it will support newer versions of OpenGL.

From what I understand, 3.x started a whole new way of doing things and I've read from various articles and reviews that you want to "stay away from deprecated features like glBegin(), glEnd()" yet a lot of books and tutorials I've seen use that method. I've seen people saying that, basically, the new way of doing stuff is more complicated yet the old way is bad >.>

This is a very big problem for OpenGL. Basically, in the olden days, you'd send stuff to the videocard by using "immediate mode". Start with glBegin, do some stuff, end with glEnd. However, video card drivers do not like this at all. How can they know how much stuff you're going to send? Is it going to be 4 vertices for a textured quad or 100,000 for a skinned model? This is why they introduced vertex buffer objects (VBO's). While immediate mode is a linked list, a VBO is a static array. The developer knows how big it is, the driver knows how big it is. Everybody's happy. So the OpenGL standards board (Khronos Group) decided to deprecate immediate mode for OpenGL 3.0 and up. However, this is problematic, as I'll show with a simple example.

Let's say you want to display a textured quad, starting from scratch.

In OpenGL 2.1:

  • Set up the projection matrix and put it in GL_PROJECTION.
  • Set up the modelview matrix and put it in GL_MODELVIEW.
  • Load an image and put it in a GL_TEXTURE_2D handle.
  • Define the positions, texture coordinates and colors for your vertices.
  • Bind the texture.
  • glBegin ... glVertex2f ... glTexCoord2f ... glEnd.

In OpenGL 3.0:

  • Build a matrix for projection and modelview.
  • Load an image and put it in a GL_TEXTURE_2D handle.
  • Define the positions, texture coordinates and colors for your vertices and put them in VBO's.
  • Create a vertex array object (VAO's) and attach your VBO's.
  • Write a shader to output a textured quad and put it in a shader program.
  • Attach the matrices to the shader program using uniforms.
  • Bind the texture.
  • Attach the texture to the shader program.
  • glDrawArrays.

So what could go wrong in the first version?

  • Your positions are incorrect.
  • Your vertex winding is the wrong way around.
  • Your texture doesn't load properly.
  • Your texture doesn't bind properly.
  • Your projection matrix is wrong.
  • Your modelview matrix is wrong.
  • You're not sending the right vertices.

And in the second version, you can have problems with the above and:

  • Your VBO's are wrong.
  • Your VAO is wrong.
  • Your shader is wrong.
  • Your texture binding to the shader is wrong.

Without proper debug tools, this becomes a serious problem. This is why people say you should stick to immediate mode. Luckily, we now have the free and excellent gDEBugger now, but it's not a magic bullet.

To answer your question: it depends on your game. If you want to reach a wide audience (for instance a casual game or a 2D platformer), you should target 2.1. If you're making an epic space game that isn't going to run on six-year old hardware anyway, target 3.3. And if you need the latest and greatest for future-compatibility, target 4.0.

share|improve this answer
2  
I think you're showing some bias against VAO/VBO here. In reality if you wanted to draw a textured quad you would have a full VAO/VBO set, together with shaders and textures already created (during program startup - nobody creates those at runtime). Drawing a textured quad via the new way is in reality just a handful of calls - admittedly it front-loads the complexity at program init whereas the old way exposes the complexity at runtime. –  Jimmy Shelter Jul 2 '12 at 8:56
2  
But that's exactly what I meant: now your bug could be in your data (vertex data and texture object), your shader program, your shader code, your matrices, your uniform upload or your VAO binding. If you start from nothing, that's a lot of subsystems to check! And you have to keep track of a lot more state. –  knight666 Jul 2 '12 at 9:18
1  
Note that gDEBugger from the gremedy site is out of date. I assume abandoned since their forums have been down for a long time. The tool has been picked up by AMD: gDEBugger. –  Byte56 Jul 2 '12 at 13:48
1  
"glBegin ... glVertex2f ... glTexCoord2f ... glEnd." Just no. glBegin, glVertex etc. were never right. glDrawArrays was introduced in OpenGL 1.1 (1997) and should always be used over glBegin and End. –  API-Beast Jul 3 '12 at 9:41

For some statistics about hardware compatibility you could look at Steam survey: http://store.steampowered.com/hwsurvey/ Although it lists DX10 and DX11, the hardware compatibility is the same as OpenGL 3 and OpenGL 4 respectively. Though note that OpenGL driver installation state on people is usually worse than DX.

Windows XP doesn't support DX10 or DX11, but OpenGL 3 and 4 should be fine, provided the drivers are ok. OSX supports OpenGL 3 (at maximum), on Linux you get OpenGL 4 with ATI/NVIDIA vendor drivers (of course only if the hardware supports it).

Then there is also the mobile ES versions of OpenGL. In fact I'd suggest looking into OpenGL ES 2.0, because it's smaller, so easier to learn, but you also need to use modern practises, i.e. shaders and VBOs. It's also what's used on most mobile devices (so you coul d go into making mobile games) and also WebGL is basically the same, so you could actually do all of your learning in the web browser with it's rapid development advantages. OpenGL ES 3.0 is due this summer.

Tessellation is a OpenGL 4.0 feature. You should first learn the other kinds of shaders, let alone all the basics, but I agree it's interesting - in fact I've written a little test with it: http://blog.tapiov.net/post/15189341463/playing-with-opengl-4-tessellation

share|improve this answer
4  
Damn, knight666 beat me to it, with a more detailed answer. Still, the ES part is worth thinking about. –  Tapio Jul 2 '12 at 7:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.