不推荐使用的OpenGL功能 [英] Deprecated OpenGL features

查看:151
本文介绍了不推荐使用的OpenGL功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近阅读了列表,我注意到,我从OpenGL学习的几乎所有内容红皮书被视为已弃用。
我说的是像素传输操作,像素图形,累积缓冲区,开始/结束功能(!?),自动mipmap生成和当前光栅位置。

为什么他们将这些功能标记为已弃用?是否仍然可以使用它们?解决方案是什么?

解决方案

在我看来它的更好。但是这种所谓的立即模式在OpenGL 3.0中确实已被弃用,主要是因为它的性能不是最佳的。



模式下,您使用 glBegin glEnd 等调用。因此,原语的渲染取决于程序的命令,OpenGL不能前进,直到它从CPU获得适当的命令。相反,您可以使用缓冲区对象来存储所有的顶点和数据。然后告诉OpenGL使用这个缓冲区使用 glDrawArrays glDrawElements 命令来渲染它的原语, code> glDrawElementsInstanced 。虽然GPU正忙于执行这些命令并将缓冲区绘制到目标 FrameBuffer (基本上是一个渲染目标)。程序可以关闭并发出一些其他命令。这样,CPU和GPU同时忙碌,没有时间浪费。



不是最好的解释,但我的建议:尝试学习新的渲染管道。它远远优于立即模式。我推荐的教程如下:



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



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



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



字面上试图忘记你目前为止所知道的,立即模式已被弃用,不应再使用,关注新技术;)



编辑 如果我使用'intermediate'而不是'immediate',它实际上称为立即,我倾向于混合它们。


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?

解决方案

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.

这篇关于不推荐使用的OpenGL功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆