Because no-one likes to program with OpenGL. Because of it's history, it is one of the hairiest APIs out there. Try to propose using OpenGL to a game developer and you'll be laughed at.
Many GPU vendors have been doing a bad job with OpenGL windows drivers and they have been really buggy, but the situation is improving.
I write OpenGL because I don't use Windows. I still hate it.
I usually use the latest GL only. Today that would be GL 4.2 core profile. Or GLES2.
Sure the old fixed function pipeline and immediate mode are gone. But the API still sucks. Bind-to-modify semantics, using integers for handles, global state everywhere, etc. They are the big problems, for both, users and implementors.
And I don't really know what 'global state everywhere' means. Do you mean that you keep OpenGL-related info in your program's global state? In that case, you should be using some AppState object to keep the state (and pass a pointer around). Otherwise, what global state is there "everywhere"?
glBindTexture(GL_TEXTURE_2D, my_texture_handle);
glTexImage2D(GL_TEXTURE_2D, ....);
Why not: glTexImage(my_texture_handle, ....);
In addition to being used for accessing and modifying, the bindings are global values that affect rendering. In the example above, it affects which texture is used on the texture unit that has been selected by glActiveTexture. What a mess.> With my limited knowledge of OpenGL, I know you get a number, describing a resource in video card memory. I bet for an OpenGL implementation, binding a resource id means finding a pointer to the resource. Sounds reasonable to me.
Wrong. There's a lot of software in between, before we start talking about GPU resources, so it refers to a structure on the CPU side. The integer-to-pointer lookup in between is another cache miss that we don't need (it has measurable L1 cache effects). This has, to some degree, been worked around by adding state objects like "Vertex Array Objects" (similar to D3D input layout).
> Would you rather get an invalid pointer that you should refrain from dereferencing (because you'll be reading from RAM, not GPU RAM)? That would've been a disaster.
Opaque pointers are used quite a lot in that way (e.g. D3D, via object pointers), it's a common idiom in C that adds a little type safety and documentation. In this case the pointers would be internal structures in the GL driver's user space. But you should not dereference them anyway. Unix uses integers as handles because the stuff it refers to is inside kernel memory, and you could poison the kernel by giving invalid pointers.
> Do you mean that you keep OpenGL-related info in your program's global state? In that case, you should be using some AppState object to keep the state (and pass a pointer around).
I don't. OpenGL does. In OpenGL, you have a global variable (actually: thread local) called the "context" which contains all the state of the rendering pipeline. In essence, it's a global variable that has side-effects when you access it.
Macro?
It has 1) inescapable measurable performance overhead and 2) affects state that changes the rendering output.
So if you macro it, you're forcing yourself to calling glBindTexture even in the cases where that wasn't necessary. (say, if you had just called glBindTexture and knew that the right texture was bound anyway). And, in addition, you have to remember to store the previous state of the bound texture in case someone down the execution path wants to use that value. Macroing things which change global state is, in general, a terrible idea.
If you don't macro it, your code has to remember whether the right texture has been bound, and design around that. It can be done for sufficiently simple cases, but the general solution also has performance overhead (checking a local variable before calling glBindTexture will get you into branch misprediction problems)
You can imagine complicated solutions like state batching: writing a better, retained-mode domain-specific language atop OpenGL which will analyze the sequences of your calls before making it, and then remove all the unnecessary glBindTexture, etc. calls. But it's a major pain in the ass that simply shouldn't exist.
glBindTexture(GL_TEXTURE_2D, texId);
glTexImage2D(GL_TEXTURE_2D, ...);
vs glTextureImage2DEXT(texId, GL_TEXTURE_2D, ...);No. SDL only deals with the platform specific parts like windowing and OpenGL initialization. It does not do any OpenGL for you.
GLFW is another popular tool for the same purpose.
SFML is better, but the developers are pretty uninterested (SFML 1.x was declared "legacy" while there was a bug that prevented it from running on modern AMD graphics cards) and I wouldn't trust it as far as I could throw it.
[1]http://news.ycombinator.com/item?id=2313661
[2] http://www.maximumpc.com/article/features/e3_2008_the_john_c...
http://www.tomshardware.com/news/john-Carmack-DirectX-OpenGL...
I do all my graphics work in OpenGL, but I'm aware of its shortcomings.
OpenGL dominates the massive mobile industry (those billion or so Android and iOS handsets run and live on OGL ES 2.0), and OpenGL was the premiere desktop gaming API until relatively recently.
Then it fell behind not because it was a defective API, but rather because the OpenGL working group was far too slow to adapt to hardware improvements -- mired in infighting and bureaucratic BS -- while DirectX raced ahead with things like geometry shaders.
Of course mobile has completely changed the equation, and suddenly people are writing OpenGL engines that only make sense to use against all other targets (Windows, Linux, etc)
Because for many cards, the opengl drivers are awful. If you are only implementing one of DirectX and OpenGL on windows, there really is no contest. Of course, you could do both, but then you have another option to give users, and two very different codepaths to test.
John Carmack was seriously angry about ATI's drivers when the game "Rage" was released. http://kotaku.com/5847761/why-was-the-pc-launch-of-rage-such...
"The driver issues at launch have been a real cluster !@#$, [...] When launch day came around and the wrong driver got released, half of our PC customers got a product that basically didn't work. The fact that the working driver has incompatibilities with other titles doesn't help either. Issues with older / lower end /exotic setups are to be expected on a PC release, but we were not happy with the experience on what should be prime platforms."
I unfortunately made the mistake to buy an AMD 5770 when I assembled my last desktop computer. This hateful GPU. If you even care one bit about either OpenGL or Linux, you are *ed with AMD. The open source drivers for linux are too slow for anything that matters and the closed source drivers made by ATi are too buggy to be used at all, they couldn't even run Gnome 3 without so many glitches, for so many months without improvements to the drivers, that I felt true despair.
You want OpenGL or/and Linux, and you need performance ? Get a Nvidia. There's nothing but Nvidia that works well with either. If you don't need performance, then simply get something that has an integrated intel chip.
I will never, ever think about buying anything from AMD again. Pure garbage. Their newer CPU line, the Bulldozer, is also garbage that runs slower than the older generation on many tasks.
[OT: Why is your nick green?]
I couldn't run any game under wine either without crashing, even older games that usually run ok like Baldur's Gate 2. The open source driver are much more stable but on the other hand they are MUCH slower. Like, turning a good, midrange card like the Radeon 5770, into what low end crap would do in Windows. But you're better off with that mid range or a high end card since a low end card is not going to be usable at all for anything that makes use of the GPU, with the open source drivers running even free games like Xonotic on a low end card is plain crazy.
http://www.phoronix.com/scan.php?page=article&item=amd_r...
On a game like Warsow, the difference between the open source driver and the catalyst can be as high as 34 fps vs 374 fps (34 fps is not enough for a fluid gaming experience, you need at least 50 to 60. Gaming is not like the 24 fps of motion pictures with each frame blurred giving the illusion of movement even with a low framerate since each frame rendered in a 3d game are sharp as hell.) on a high end card, and 17 fps vs 45 fps on a low end card, which means that the game is not playable at all on the open source driver, while it's tolerable on the catalyst.
AMD's stuff is not worth the pain. Don't buy AMD unless you have a masochist streak. I wish I had known before I built my desktop, I was being influenced by all the free software maniacs who were praising AMD to heaven because of their policy on giving out the GPU specs. Free software be damned, I will take nvidia's closed source driver over shit that is not working the next time. My previous GPU was a Nvidia Geforce 7600 GT and it worked like a clock.
... if in the next 6 months the situation doesn't get any better I feel I am going to physically destroy the GPU with a hammer, send the pic to AMD and buy a nvidia before the need for a hardware upgrade even shows up. The fact that it has drivers problems even under windows doesn't help making AMD's case.
TBH I also gave up about a month and a half ago it could have changed recently but I doubt it.
Waay to slow for gaming (I tried HoN and NVN) also WebGL was really slow (software rendering kind slow), since this is a thread about games I think this use case is required - I didn't try the OSS drivers in ~6 months so it could have changed. But Gnome/desktop was really stable so if you only need desktop apps it does work.
Multi monitor support should be fixed, latest Nvidia beta drivers have Xrandr. It's still a new feature so it can have a few rough edges, though.
In fairness to AMD, AIUI that is by design, with the intention to increase clock speeds and core counts to compensate. However, that line of thinking was the downfall of the Pentium 4.
Unfortunately they've dropped laptop support so not really an option these days. The open source Intel/Radeon drivers in Mesa look to be the only game in town in the future.
edit: to expand, they've said many times that they're not going to support Optimus and that covers all except the luggable laptops these days.
a) radeon 3850
b) fusion e-350
c) a mobile x700
The only nvidia chip I have is some version of a mobile quadro and it has very bad thermals and will frequently segfault.
I'm glad for your sake that you haven't hit any driver bugs though.
I'll never buy ATi again after my experience with them.
How could AMD stay in business with such subpar products is beyond me. I know they'll never regain my trust. That's just not possible. Too many problems on too many platforms.
Intel cards, famous for lying about which set of OpenGL extensions are really available in hardware.
All the GPUs made in Taiwan and similar countries delivered with cheap desktop PCs (< 500 euro).
Why wouldn't they switch back to OpenGL on windows then ?
Besides the absolute numbers I wonder how the hardware is behaving regarding resource intensive applications games are. From personnal experience every laptops and computers I have owned had had their fans spinning much louder when running ut2004 (and other games) on linux than on windows. Whether because it's getting hotter for less computational power or because of more aggressive default fan settings in distros.