当前位置:网站首页>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
边栏推荐
- Flexible layout (display:flex;) Attribute details
- QQ情话糖果情话内容获取并保存
- Single user mode
- Qmake uses toplevel or topbuilddir
- Judging the number of leap years from 1 to N years
- Source code analysis of zeromq lockless queue
- Master XSS completely from 0 to 1
- For the first time in China, Chinatelecom 5g underground personnel positioning project is officially commercial: it can track the position in real time to ensure operation safety
- 电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备
- Open a restaurant
猜你喜欢
90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟
Judging the number of leap years from 1 to N years
15 -- k points closest to the origin
Js- get the mouse coordinates and follow them
搭建极简GB28181 网守和网关服务器,建立AI推理和3d服务场景,然后开源代码(一)
Open a restaurant
Single user mode
1090.Phone List
【Try to Hack】vulnhub DC1
How to crop GIF dynamic graph? Take this picture online clipping tool
随机推荐
Iterator failure condition
【中國海洋大學】考研初試複試資料分享
【Try to Hack】vulnhub DC1
2. operator and expression multiple choice questions
Customization and encapsulation of go language zap library logger
Differences between member variables and local variables
Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
Learning notes on February 5, 2022 (C language)
[C language] 32 keyword memory skills
电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备
Luogu p5707 [deep foundation 2. example 12] late for school
p1408
Using Sphinx to automatically generate API documents from py source files
Add the resources directory under test in idea
Introduction to flexible array
Generation method and usage of coredump
Jaspersoft studio installation
HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
Js- get the mouse coordinates and follow them
Breakpad usage and DMP analysis