OpenGL glBegin ... glEnd [英] OpenGL glBegin ... glEnd

查看:86
本文介绍了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.

一些有用的学习材料:

学习现代3D图形编程

适用于OpenGL≥3.3的OpenGL教程

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

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