OpenGL glBegin ... glEnd [英] OpenGL glBegin ... glEnd
问题描述
我想知道使用glBegin
而不是GLSL,VBO和VAO等对我的游戏有多严重的影响.他们看起来如此困难而荒谬,难以实现我可以轻松完成的任务.我的选择会产生什么影响?
I wanted to know how badly my games will be affected by using glBegin
and whatnot instead of GLSL and VBOs and VAOs and all that. They just look so difficult and ridiculous to achieve what I can do easier. What will the effect of my choices be?
推荐答案
严重.
不推荐使用带有glBegin()
和glEnd()
的直接模式API,主要是出于性能方面的考虑.它实际上并不支持数据并行性,并且严重依赖于CPU —每个顶点至少需要一个函数调用.那很快就累了.
The direct mode API with glBegin()
and glEnd()
is deprecated, largely for performance reasons. It doesn’t really support data parallelism, and relies heavily on the CPU—requiring at least one function call per vertex. That adds up quickly.
在小型项目中使用直接模式API可能更简单,更愉快,但是在性能和可维护性方面,使用VBO可以更好地扩展.管理数据比管理状态要容易得多.
The direct mode API might be simpler and more pleasant for you to use in small projects, but using VBOs scales better, both in terms of performance and maintainability. It’s much easier to manage data than it is to manage state.
另外,学习新的API意味着您可以了解OpenGL在现实世界中的使用方式和应如何使用.例如,如果您想在游戏行业工作,那只是简单的有用知识.
Also, learning the new API means you’re up to date on how OpenGL is and should be used in the real world. If you’re looking to work in the games industry, for example, that’s just plain useful knowledge.
一些有用的学习材料:
这篇关于OpenGL glBegin ... glEnd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!