OpenGL
英文:https://learnopengl.com/Getting-started/OpenGL
中文:https://learnopengl-cn.github.io/01%20Getting%20started/01%20OpenGL/
OpenGL一般被认为是 一个API,但OpenGL本身并不是API,OpenGL本身并不是一个API,它仅仅是一个由Khronos组织制定并维护的规范(Specification)。教程的规OpenGL版本是OpenGL3,.3。
Core-profile vs Immediate mode
Immediate mode:
- fixed function pipeline
- 绘制图形方便,容易理解
- 灵活性低,效率低
- 在3.2版本之前 ,3.2版本之后废弃这种渲染模式,
Core-profile:
When using OpenGL’s core-profile, OpenGL forces us to use modern practices. Whenever we try to use one of OpenGL’s deprecated functions, OpenGL raises an error and stops drawing. The advantage of learning the modern approach is that it is very flexible and efficient, but unfortunately is also more difficult to learn. The immediate mode abstracted quite a lot from the actual operations OpenGL performed and while it was easy to learn, it was hard to grasp how OpenGL actually operates. The modern approach requires the developer to truly understand OpenGL and graphics programming and while it is a bit difficult, it allows for much more flexibility, more efficiency and most importantly a much better understanding of graphics programming.
Extensions
State machine
OpenGL是一个大的状态机,一系列的变量描述OpenGL应该如何运行。OpenGL的状态通常被称为Context。
Objects
OpenGL库是用C语言写的,同时也支持多种语言的派生,但其内核仍是一个C库。由于C的一些语言结构不易被翻译到其它的高级语言,因此OpenGL开发的时候引入了一些抽象层。“对象(Object)”就是其中一个。