Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL glBegin ... glEnd [closed]

Tags:

c++

opengl

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?

like image 893
Nathan Wride Avatar asked Jan 13 '13 04:01

Nathan Wride


People also ask

Is glBegin deprecated?

Badly. 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.

What is glBegin?

Description. The glBegin and glEnd subroutines delimit the vertices that define a primitive or group of like primitives. The glBegin subroutine accepts a single argument that specifies which of 10 ways the vertices will be interpreted.


1 Answers

Badly.

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.

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.

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.

Some useful learning materials:

  • An Intro to Modern OpenGL

  • Learning Modern 3D Graphics Programming

  • OpenGL Tutorials for OpenGL ≥3.3

like image 159
Jon Purdy Avatar answered Sep 20 '22 14:09

Jon Purdy