PDA

View Full Version : Which OpenGL version to use



mikage
12-14-2009, 09:07 AM
I know this kind of question may come up often but for some reason I just can't seem to find the right answer. I am working on an independent project using OpenGL with the objective that the game does not require the most recent or expensive graphics cards to run on. Currently I am developing for OpenGL 2.1. The game is expected to be finished in less than a year. Due to the abstraction layer I have between the 3D engine and the underlying gl functionality, an upgrade to OpenGL 3.0 or above is possible. Would this greatly reduce the number of people who could potentially run the game ? I have no idea of how many people actually own OpenGL 3.0 or above capable hardware.

Thanks
mikage

Alfonse Reinheart
12-14-2009, 11:33 AM
Thanks to the extension mechanism, and particular core extensions, OpenGL is not bound by simple versioning. For example, framebuffer objects are core in GL 3.0, but ARB_framebuffer object is a widely supported extension (indeed, if you're using EXT_FBO, stop. No, seriously, stop; your implementation supports ARB_FBO).

Now obviously, hardware-based extensions will not be supported on non-3.x capable hardware. But non-hardware extensions like VAOs, FBOs, and so on are supported on non-3.x capable hardware. Feel free to use them. The OpenGL extension viewer (http://www.realtech-vr.com/glview/) application comes with a handy database (reasonably up-to-date) of what drivers supports what extensions.

As to the number of people owning 3.x hardware, 3.x hardware is anything capable of DX10 (Vista/Win7 not required). Valve's survey (http://store.steampowered.com/hwsurvey/) is a good start at estimating the install base for this.

At the current numbers, you'd be cutting off about 25% of the market by requiring 3.0. Of course, you don't have to require 3.0; you can use parts of it optionally.

mikage
12-14-2009, 12:47 PM
Thanks for your precise answer. I had to learn OpenGL on the fly for this project so I sometimes feel overwhelmed by the numerous sources of information on the subject that don't always clearly address these concerns. Up to now I haven't really looked at the extension mechanism.
As a side note, it's amazing the number of beginner tutorials I've found that still use the old way of doing things like glBegin/glEnd, vertex arrays or fixed functions. When you're new to all this it you can waste a lot of time learning obsolete stuff.

Thanks.
mikage

akashiraffee
12-14-2009, 12:57 PM
As a side note, it's amazing the number of beginner tutorials I've found that still use the old way of doing things like glBegin/glEnd, vertex arrays or fixed functions. When you're new to all this it you can waste a lot of time learning obsolete stuff.

I think you will be hard pressed to find a book that doesn't use immediate mode (glBegin/End), much less something online. Just out of curiousity, what is the new "non-obsolete" method -- all display lists?

[bit later] VBO's....grrr....and there really is NO halfway decent material around in C

ZbuffeR
12-14-2009, 03:55 PM
Beware of biases in the valve survey, as it only show stats for quite hardcore gamers, not everybody's laptop using a crappy Intel GMA "decelerator"...


with the objective that the game does not require the most recent or expensive graphics cards to run on
Best you can do is develop on an actual laptop having a Intel GMA 950 or something. You will have much less surprises afterwards when running the game on good nv/ati cards. Doing the opposite will make this objective much harder to fulfill.

mikage
12-15-2009, 06:44 AM
Best you can do is develop on an actual laptop having a Intel GMA 950 or something. You will have much less surprises afterwards when running the game on good nv/ati cards. Doing the opposite will make this objective much harder to fulfill.

Totally agree on that. My current hardware is far from hardcore gamer equipment.


VBO's....grrr....and there really is NO halfway decent material around in C

I'm coding in java for this project and there's even less material for that. The opengl bindings for java aren't very well documented.

Dark Photon
12-15-2009, 11:27 AM
Just out of curiousity, what is the new "non-obsolete" method -- all display lists?
Well, they're all still around, so which one you choose is largely up to you and your constraints. Here's the list:
Display Lists Vertex Buffer Objects (i.e. server vertex arrays; aka VBOs) Client Vertex Arrays Immediate Mode
I've ordered these in approximate order of performance (fastest-to-slowest), at least on NVidia drivers -- though you can find cases where this order changes. For instance, for smaller batches at least, VBOs lose to client arrays.

When you start learning, I'd suggest you feel free to use immediate mode, because it's simple. Just keep in mind while you're doing it that you're populating client vertex arrays behind-the-scenes. For each glVertex/glColor/glNormal, think vertex[ slot++ ] = mydata; (or color, or normal, etc.)

When you nail that and want more perf, pop up to client vertex arrays (which is very similar), then VBOs (server vertex arrays) -- they're both largely the same thing. Only difference is who owns the memory for your vertex attribute arrays, your CPU or the GPU/driver. If you need even more perf, try display lists (and/or get more exotic with your VBOs). Just be aware that it takes some time for the driver to compile display lists for you, so you might want to compile these at startup.

If "forward looking" is your main goal, go with VBOs. Display lists are deprecated in the latest GL, as is immediate mode. Though vendors such as NVidia has said they're not going away. However, shoot for what's going to be supported on the GPUs you're targeting.