当前位置:网站首页>Core mode and immediate rendering mode of OpenGL
Core mode and immediate rendering mode of OpenGL
2022-06-25 15:07:00 【Knowledge first】
Render now mode
In the early OpenGL Use immediate rendering mode (Immediate mode, That is, fixed rendering pipeline ), Drawing graphics in this mode is very convenient .
OpenGL Most of the functions of are hidden by the library , Developers have little control OpenGL Freedom of how to calculate . And developers are eager for more flexibility . Over time , Norms are becoming more flexible , Developers have more control over drawing details .
The core model
Immediate rendering mode is really easy to use and understand , But it's too inefficient . So from OpenGL3.2 Start , The specification document begins to discard the immediate rendering mode , And encourage developers to OpenGL The core model of (Core-profile) Under development , The specification of this branch completely removes the old features .
When using OpenGL The core mode of ,OpenGL Force us to use modern functions . When we try to use an obsolete function ,OpenGL Will throw an error and terminate the drawing . The advantage of modern functions is higher flexibility and efficiency , However, it is also more difficult to learn . Immediate rendering mode from OpenGL Many details have been abstracted from the actual operation , So while it's easy to learn , It's also hard for people to grasp OpenGL How does it work . Modern functions require users to really understand OpenGL And graphic programming , It has some difficulty , However, it provides more flexibility , Higher efficiency , More importantly, we can have a deeper understanding of graphic programming .
That's why our tutorial is for OpenGL3.3 The core model of . Although it's more difficult to get started , But the effort is worth it .
The latest version opengl
Today, , Higher version OpenGL Has been released ( The latest version at the time of writing is 4.5), You may ask : since OpenGL 4.5 All out , Why should we learn OpenGL 3.3? The answer is simple , all OpenGL Higher versions of are in 3.3 On the basis of , Introduced additional features , No changes to the core architecture . The new version just introduces some more efficient or useful ways to accomplish the same function . therefore , All the concepts and technologies in modern times OpenGL Consistent in the version . When you have enough experience , You can easily use from a later version OpenGL New features .
opengl An extension of
OpenGL A major feature of is the extension (Extension) Support for , When a graphics card company comes up with a new feature or a big optimization in rendering , It is usually implemented in the driver in an extended way . If a program runs on a graphics card that supports this extension , Developers can use this extension to provide some more advanced and effective graphics functions . In this way , Developers don't have to wait for a new OpenGL Specifications available , You can use these new rendering features , Simply check whether the graphics card supports this extension . Usually , When an extension is very popular or useful , It will eventually become the future OpenGL Part of the norm .
opengl State machine
OpenGL It's a huge state machine (State Machine): A series of variable descriptions OpenGL How to run at this moment .OpenGL The state of is usually called OpenGL Context (Context). We usually use the following ways to change OpenGL state : set an option , Operation buffer . Last , We use the current OpenGL Context to render .
Suppose when we want to tell OpenGL When drawing line segments instead of triangles , We change... By changing some context variables OpenGL state , To tell OpenGL How to draw . Once we change OpenGL The state of is to draw line segments , The next draw command will draw line segments instead of triangles .
When using OpenGL When , We will encounter some state setting functions (State-changing Function), This kind of function will change the context . And state usage functions (State-using Function), Such functions will be based on the current OpenGL State to perform some operations . As long as you remember OpenGL It's essentially a big state machine , It's easier to understand most of its features .
opengl object
OpenGL The library uses C Written language , It also supports the derivation of multiple languages , But its kernel is still a C library . because C Some language structures are not easy to translate into other high-level languages , therefore OpenGL Some abstraction layers are introduced during development .“ object (Object)” It's one of them .
stay OpenGL An object in is a collection of options , It represents OpenGL A subset of States . such as , We can use an object to represent the settings of the drawing window , Then we can set its size 、 Number of supported colors, etc . You can think of an object as C Style structure (Struct):
struct object_name {
float option1;
int option2;
char[] name;
};
Text reference :https://learnopengl-cn.github.io/01%20Getting%20started/01%20OpenGL/
Also recommend tutorials :https://www.bootwiki.com/opengl/opengl-tutorial1.html
边栏推荐
猜你喜欢

电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备

Build a minimalist gb28181 gatekeeper and gateway server, establish AI reasoning and 3D service scenarios, and then open source code (I)

Jaspersoft studio installation

Gif动画怎么在线制作?快试试这款gif在线制作工具

Std:: vector minutes

System Verilog — interface

System Verilog - thread

Single user mode

定位position(5种方式)

Source code analysis of zeromq lockless queue
随机推荐
Customization and encapsulation of go language zap library logger
从0到1完全掌握 XSS
The robot is playing an old DOS based game
[try to hack] vulhub shooting range construction
BM setup process
semget No space left on device
@Font face fonts only work on their own domain - @font-face fonts only work on their own domain
Using Sphinx to automatically generate API documents from py source files
Learning notes on February 8, 2022 (C language)
QQ love talk candy love talk content acquisition and storage
Common classes in QT
HMS Core机器学习服务实现同声传译,支持中英文互译和多种音色语音播报
定位position(5种方式)
Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment
多张动图怎样合成一张gif?仅需三步快速生成gif动画图片
2. operator and expression multiple choice questions
Stderr and stdout related standard outputs and other C system APIs
Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
Bessie's weight problem [01 backpack]
90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟