Pilpel
Pilpel

Reputation: 241

Deprecated OpenGL features

I recently read this list and I noticed that almost everything I studied from the OpenGL Red Book is considered deprecated. I'm talking about pixel transfer operations, pixel drawings, accumulation buffer, Begin/End functions (!?), automatic mipmap generation and current raster position.

Why did they flag these features as deprecated? Will it be okay to still use them? What are the workarounds?

Upvotes: 3

Views: 5732

Answers (2)

Invalid
Invalid

Reputation: 1890

In my opinion its for the better. But this so called Immediate Mode is indeed deprecated in OpenGL 3.0 mainly because its performance is not optimal.

In immediate mode you use calls like glBegin and glEnd. So the rendering of primitives depends on the program's commands, OpenGL can't advance until it gets the appropiate command from the CPU. Instead you can use buffer objects to store all your vertices and data. And then tell OpenGL to render its primitives using this buffer with commands like glDrawArrays or glDrawElements or even more specialized commands like glDrawElementsInstanced. While the GPU is busy executing those commands and drawing the buffer to the target FrameBuffer (basically a render target). The program can go off and issue some other commands. This way both the CPU and the GPU are busy at the same time, and no time is wasted.

Not the best explanation ever, but my advice: try to learn this new rendering pipeline instead. It's superior to immediate mode by far. I recommend tutorials like:

http://www.arcsynthesis.org/gltut/index.html

http://www.opengl-tutorial.org/

http://ogldev.atspace.co.uk/

Literally try to forget what you know so far, immediate mode is long deprecated and shouldn't be used anymore, instead, focus on the new technology ;)

Edit Excuse me if I used 'intermediate' instead of 'immediate', I think its actually called 'immediate', I tend to mix them up.

Upvotes: 12

Nicol Bolas
Nicol Bolas

Reputation: 474326

Why did they flag these features as deprecated?

First, some terminology: they aren't deprected. In OpenGL 3.0, they are deprecated (meaning "may be removed in later versions"); in 3.1 and above, most of them are removed. The compatibility profile brings the removed features back. And while it is widely implemented on Windows and Linux, Apple's 3.2 implementation only implements the core profile.

As to the reasoning behind the removal, it depends on which feature you're talking about. We can really only speculate as to why the ARB any specific feature:

pixel transfer operations

Pixel transfer operations have not been removed. If you're talking about glDrawPixels, that is a pixel transfer operation, but it is one pixel transfer. Not all of them.

Speaking of which:

pixel drawings

Because it was a horrible idea to begin with. glDrawPixels is a performance trap; it sounds nice and neat, but it performs terribly and because it's simple, people will try to use it.

Having something that is easy to do but terrible in performance encourages people to write terrible OpenGL applications.

accumulation buffer

Shaders can do this just fine. Better in fact; they have a lot more options than accumulation buffers cover.

Begin/End functions (!?),

It's another performance trap. Immediate mode rendering is terribly slow.

automatic mipmap generation

Because it was a terrible idea to begin with. Having OpenGL decide when to do a heavyweight operation like generate mipmaps of a texture is not a good idea. The much better idea the ARB had was to just let you say, "OK, OpenGL, generate some mipmaps for this texture right now."

current raster position.

Another performance trap/bad idea.

Will it be okay to still use them?

That's up to you. NVIDIA has effectively pledged to support the compatibility profile in perpetuity. Which means that AMD and Intel probably will have to as well. So that covers Windows and Linux.

On MacOSX, Apple controls the GL implementations more rigidly, and they seem committed to not supporting the compatibility profile. However, they seem to have little interest in advancing OpenGL, since they stopped with 3.2. Even Mountain Lion didn't update the OpenGL version.

What are the workarounds?

Stop using performance traps. Use buffer objects for your vertex data like everyone else. Use shaders. Use glGenerateMipmap.

Upvotes: 9

Related Questions