A method for constructing a three-dimensional digital earth for avionics display and control

By using the GDAL library and modern OpenGL technology to calculate and render the vertex data of the three-dimensional digital earth, the problem of the lack of three-dimensional vision in the avionics display and control interface is solved, an efficient three-dimensional digital earth display is achieved, and the rendering performance is improved.

CN113593028BActive Publication Date: 2024-10-25SICHUAN HANKE COMPUTER INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110881749.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-02
Publication Date
2024-10-25
Estimated Expiration
2041-08-02

AI Technical Summary

Technical Problem

The existing avionics display and control interface design platform can only provide a two-dimensional display and control interface, which cannot meet the needs of modern battlefield situations. It lacks a three-dimensional visual function and is difficult to build a three-dimensional digital earth.

Method used

The GDAL library is used to read terrain files, calculate vertex data, generate vertex attribute data, and use modern OpenGL rendering methods to create vertex shaders and fragment shaders using GLSL language for data transmission and rendering to achieve the display of a three-dimensional digital earth.

Benefits of technology

It realizes the construction of a three-dimensional digital earth in the avionics display and control device, improves the rendering efficiency, is significantly better than traditional OpenGL especially when the amount of data is large, and avoids the risk of video memory allocation failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113593028B_ABST
    Figure CN113593028B_ABST
Patent Text Reader

Abstract

The present invention relates to a three-dimensional digital earth construction method for avionics display and control, including reading terrain files: reading and loading terrain files, parsing terrain data and generating original terrain data into memory; calculating vertex data: calculating and generating vertex attribute data; transmitting vertex data: calculating space size and performing data transmission interaction; creating shaders: generating source code of vertex shaders and fragment shaders, and creating corresponding executable logic units; rendering preparation and rendering: passing corresponding parameters to shaders before rendering, passing parsed VBO data to vertex shaders, calling drawing instructions glDrawElements for rendering, executing vertex shaders and fragment shaders, and outputting rendering results to a window to display the three-dimensional digital earth. The present invention ensures that all vertex data is written into VBO by adopting data segmentation and reuse, and can also avoid the situation of failure due to allocation of large blocks of video memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of avionics display and control technology, and in particular to a three-dimensional digital earth construction method for avionics display and control. Background Art

[0002] The display and control interface is the medium for interaction and information exchange between the system and the user, and it realizes the conversion between the internal form of information and the form acceptable to humans. As one of the important parts of the avionics system, the avionics display and control system has experienced five stages of development from the beginning to the present, namely the first generation of aircraft instruments, electromechanical servo instruments, integrated guidance instruments, CRT electro-optical display instruments and modern display and control systems.

[0003] However, the current mainstream avionics display and control interface design platform (for example: VAPS XT) can only provide visualization development functions for two-dimensional display and control interfaces, and does not have three-dimensional viewing functions. Two dimensions can no longer meet the needs of the current battlefield situation. The three-dimensional digital earth is based on traditional geographic information system technology and uses real three-dimensional scene virtual reality. It has the characteristics of intuitive visualization and high efficiency. It is also the most important component of avionics display and control devices. Therefore, how to construct the three-dimensional digital earth in the three-dimensional avionics display and control device is an urgent problem to be solved at this stage. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a three-dimensional digital earth construction method for avionics display and control, which can realize the construction of a three-dimensional digital earth in a three-dimensional avionics display and control device.

[0005] The object of the present invention is achieved by the following technical solution: a three-dimensional digital earth construction method for avionics display and control, the construction method comprising:

[0006] Read terrain files: Use the GDAL library to read and load terrain files, parse them into terrain data, and then generate raw terrain data into memory;

[0007] Calculate vertex data: calculate vertex attributes including 3D world coordinates, normals and texture coordinates and generate vertex attribute data;

[0008] Transmit vertex data: calculate the space size and perform data transmission interaction;

[0009] Create shaders: Generate source code for vertex shaders and fragment shaders using the GLSL language, and create corresponding executable logic units in the GPU;

[0010] Rendering preparation: pass the corresponding parameters to the shader before rendering, and pass the parsed VBO data to the vertex shader;

[0011] Rendering: Call the drawing instruction glDrawElements for rendering, use the modern OpenGL rendering method to execute the created vertex shader and fragment shader respectively, and output the rendering results to the window to display the three-dimensional digital earth.

[0012] The computing vertex data specifically includes:

[0013] Given the longitude and latitude of the starting point, calculate the longitude and latitude of the vertex based on the two-dimensional coordinates of the vertex. The height of the vertex is the value of its two-dimensional coordinates in the raster metadata. Then, refer to the world coordinate formula in the camera to calculate the world coordinates.

[0014] Select two vertices adjacent to the current vertex according to the current vertex, calculate the vectors between the two vertices and the current vertex, and then cross-multiply the two vectors to get the normal vector;

[0015] Generate texture according to the generated color table file, calculate the texture coordinates of the vertex and then use the texture to obtain the vertex color.

[0016] Generating a texture according to the generated color table file and calculating the texture coordinates of the vertices and then acquiring the vertex colors by using the texture specifically include:

[0017] Generate a one-dimensional color table file through a third-party tool;

[0018] Create a one-dimensional texture based on the one-dimensional color table file. The width of the texture represents the total number of colors. The texture parameters in the memory are written to the video memory through the glTexImage1D function. The coordinate range of the texture in OpenGL is between 0 and 1, so the color table will be mapped to the range between 0 and 1. The texture coordinate 0 corresponds to the first color in the color table, and 1 corresponds to the last color.

[0019] Input the height value of the current vertex, the maximum height value, and the minimum height value to calculate the texture coordinates of the vertex, so as to map the height of the vertex to the range between 0 and 1, which is consistent with the texture coordinates in the video memory.

[0020] Input the texture number and the texture coordinates of the vertex and call the sampling function in the fragment shader to get the vertex color from the texture.

[0021] The transmission of vertex data specifically includes:

[0022] Calculate the space size, use glGenBuffers to create a VBO object, set the VBO type to GL_ARRAY_BUFFER, and store vertex data in the VBO for use by the vertex shader. The glBufferData function will allocate a data storage space for the currently bound VBO and write the vertex data in the memory into the space. The last parameter in glBufferData is GL_STATIC_DRAW, which means that the data storage content is initialized only once to facilitate GPU space allocation.

[0023] If VBO fails to allocate storage space, data segmentation and reuse are used to segment a large block of data into multiple small blocks of the same capacity, and then the small blocks of data are transferred to the video memory for rendering.

[0024] The steps of data segmentation and multiplexing include:

[0025] Set the capacity of a single data block to 6MB, and calculate the number of vertex rows that can be accommodated based on the capacity of the data block;

[0026] Calculate the number of data blocks required based on the total number of vertices and create the same number of VBOs;

[0027] Allocate memory space according to the data block capacity and traverse the vertex array;

[0028] Read the vertices that hold the number of rows, calculate the vertices, and transmit the vertices in sequence.

[0029] The creating of the shader specifically includes:

[0030] The glGetShaderiv function creates a shader program, sets the source code of the vertex shader and fragment shader through the glShaderSource function and compiles the source code according to the glCompileShader function;

[0031] The glAttachShader function binds the vertex shader and fragment shader to the shader program and connects the shader program through the glLinProgram function.

[0032] The rendering preparation specifically includes:

[0033] Run the shader program through the glUseProgram function to enable the input attributes in the shader program;

[0034] Set the corresponding perspective matrix, viewing matrix and model matrix variables in the vertex shader, and set the corresponding lighting parameters and texture number in the fragment shader;

[0035] Bind VBO data to video memory and pass the parsed VBO data to the vertex shader, which associates the structure of the data with the input attributes.

[0036] The modern OpenGL rendering method includes:

[0037] Vertex shader step: used to convert the three 3D coordinates passed in the form of an array into another type of 3D coordinates and then input them into the primitive assembly step;

[0038] Primitive assembly step: used to assemble all points into the specified primitive shape and then input it into the geometry shader step;

[0039] Geometry shader step: used to take the geometry of a series of vertices of the primitive shape as input, generate new vertices to construct new primitives to generate other primitive shapes, and input them to the rasterization step;

[0040] Rasterization step: used to map primitives to corresponding pixels on the final screen and generate fragments for use by the fragment shader unit;

[0041] The fragment shader step is used to calculate the final color of a pixel based on the contained 3D scene data.

[0042] Test and blend step: used to detect the depth value and template value of the fragment to determine the position of the pixel, as well as detect the alpha value and blend the object.

[0043] The present invention has the following advantages: a three-dimensional digital earth construction method for avionics display and control, which adopts a modern OpenGL rendering method that is superior to traditional OpenGL, especially when the amount of data is larger, the efficiency advantage is more obvious; by adopting a data segmentation and reuse method, it is ensured that all vertex data is written into VBO, and the situation of failure in allocating large blocks of video memory can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a schematic diagram of the method flow of the present invention;

[0045] Figure 2 This is a schematic diagram of the data transmission process;

[0046] Figure 3 This is a schematic diagram of the data segmentation and reuse process;

[0047] Figure 4 Prepare the flow chart for rendering. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application provided below in conjunction with the drawings is not intended to limit the scope of protection of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application. The present invention is further described below in conjunction with the drawings.

[0049] like Figure 1 As shown, the present invention relates to a three-dimensional digital earth construction method for avionics display and control, and the construction method comprises:

[0050] S1. Read terrain file: Use GDAL library to read and load terrain file, parse it into terrain data and generate original terrain data into memory;

[0051] Specifically, the GDAL library is used to read terrain files, the format of which is tiff raster data; the full name of the GDAL library is Geospatial Data Abstraction Library, which is a software library for reading raster and vector geospatial data formats, released by the Open Source Geospatial Foundation under the X / MIT license agreement. As a library, it provides a single abstract data model for applications to parse all the formats it supports.

[0052] The projection method of the raster data is the WGS-84 geocentric coordinate system, which contains a set of standard longitude and latitude coordinate systems for the earth; the metadata in the raster file represents the terrain height value in meters; the sampling accuracy of the data represents the range of each data point in the longitude and latitude directions; the starting point coordinates represent the longitude and latitude of the upper left corner of the raster. The longitude and latitude of any vertex can be calculated based on the coordinates of the starting point.

[0053] S2, calculate vertex data: calculate vertex attributes including three-dimensional world coordinates, normals and texture coordinates and generate vertex attribute data;

[0054] Furthermore, the raster data contains the latitude and longitude information of the vertex. Based on the latitude and longitude of the vertex, the world coordinates, normals and texture coordinates of the vertex are calculated respectively, which constitute the vertex data. The world coordinates are used to calculate the spatial position in the vertex shader, the vertex normal is used for the calculation of the light color in the fragment shader, and the texture coordinates of the vertex are used to obtain the color of the vertex. The final color of the vertex combines the color of the vertex itself and the light color.

[0055] Vertex data includes three attributes: world coordinates, normals, and texture coordinates of the vertex;

[0056] The calculation of the world coordinates of the vertex is as follows: first calculate the longitude and latitude of each vertex, and then convert it into world coordinates; specifically: the two-dimensional coordinates of the vertex represent the offset of the vertex relative to the starting point. Given the longitude and latitude of the starting point, the longitude and latitude of the vertex are calculated based on the two-dimensional coordinates of the vertex. The height value of the vertex is the value of its two-dimensional coordinates in the raster metadata;

[0057] Input variables: longitude of the starting point StartLongtitude, latitude of the starting point StartLatituede, number of rows of vertices Rows, number of columns of vertices Cols, raster metadata, sampling precision CellSize, two-dimensional coordinates of the vertex OffsetX, OffsetY; according to the calculation formula Longtitude = StartLongtitude + OffsetX*CellSize, Latitude = StartLatitude - OffsetY*CellSize and Altitude = data[OffsetY][OffsetX]; the output is: longitude of the vertex Longtitude, latitude of the vertex Latitude and altitude of the vertex Altitude.

[0058] The normal of a vertex is calculated as follows: select two vertices adjacent to the current vertex according to the current vertex, calculate the vectors between the two vertices and the current vertex, and then cross-multiply the two vectors to get the normal vector;

[0059] The texture coordinates of the vertex are calculated as follows: The vertex color is obtained by sampling from the texture according to the texture coordinates of the vertex. First, the texture needs to be generated and the texture coordinates of the vertex are calculated. Finally, the fragment shader will perform texture sampling to obtain the vertex color during rendering. Specifically:

[0060] In order to obtain a smoother elevation color effect, a one-dimensional color table file is generated through a third-party tool; the total number of colors in the color table can be set, such as 256 or 64; the value of each color is in RGB format; the color of the key position can be set, and the color between two key positions is obtained through linear interpolation. That is, middleColor(t)=beginColor*(1–t)+endColor*t, 0<=t<=1;

[0061] Texture acquisition obtains vertex colors and creates a one-dimensional texture based on the one-dimensional color table file. The width of the texture represents the total number of colors. The texture parameters in memory are written to the video memory through the glTexImage1D function. The coordinate range of the texture in OpenGL is between 0 and 1, so the color table will be mapped to the range between 0 and 1. The texture coordinate 0 corresponds to the first color in the color table, and 1 corresponds to the last color.

[0062] Input the current vertex height value CurrentHeight, the maximum height value MaxHeight, and the minimum height value MinHeight, and calculate the texture coordinates of the vertex according to the formula texCoord = (CurrentHeight-MinHeight)*(1.0 / (MaxHeight-MinHeight)) to map the vertex height to the range between 0 and 1, which is consistent with the texture coordinates in the video memory.

[0063] Input the texture number TextureId and the texture coordinate texCoord of the vertex, and according to the formula color=texture1D(TextureId,texCoord), call the sampling function in the fragment shader to obtain the vertex color from the texture.

[0064] S3, transfer vertex data: calculate the space size and perform data transmission interaction;

[0065] like Figure 2 As shown, further, calculate the space size, use glGenBuffers to create a VBO object, set the VBO type to GL_ARRAY_BUFFER, VBO stores vertex data, and provides it to the vertex shader. The glBufferData function will allocate a data storage space for the currently bound VBO and write the vertex data in the memory to the space. The last parameter in glBufferData is GL_STATIC_DRAW, which means that the data storage content is initialized only once to facilitate GPU space allocation.

[0066] Among them, the calculated space size is, input variable: the space size SizeOfVertex occupied by a single vertex, which is equal to the sum of the sizes occupied by each attribute of the vertex, the number of rows of vertices: Rows, the number of columns of vertices: Cols, according to the formula NumbersVertex = Rows*Cols and SizeOfAllVertex = SizeOfVertex*NumbersVertex, the space size SizeOfAllVertex occupied by all vertices is obtained.

[0067] However, due to the large number of terrain vertices and the current usage of video memory, allocating a large continuous storage space for VBO may cause allocation failure; the solution is to use data segmentation and reuse, split a large block of data into multiple small blocks of data with the same capacity, and then transfer the small blocks of data to the video memory for rendering. Allocate a small block of data space in the memory and recycle it to achieve memory reuse. Before writing data to the video memory, allocate multiple VBOs in advance, and then write the small blocks of data into the corresponding VBO, which not only ensures that all vertex data is written to the VBO, but also avoids the failure of allocating large blocks of video memory.

[0068] like Figure 3 As shown, specifically: the capacity of a single data block is set to 6MB, and the number of vertex rows that can be accommodated is calculated based on the capacity of the data block;

[0069] Calculate the number of data blocks required based on the total number of vertices and create the same number of VBOs;

[0070] Allocate memory space according to the data block capacity and traverse the vertex array;

[0071] Read the vertices that hold the number of rows, calculate the vertices, and transmit the vertices in sequence.

[0072] S4. Create shaders: Generate source code for vertex shaders and fragment shaders using GLSL language, and create corresponding executable logic units in the GPU;

[0073] Specifically: glGetShaderiv function creates a shader program, sets the source code of the vertex shader and fragment shader through glShaderSource function and compiles the source code according to glCompileShader function;

[0074] The glAttachShader function binds the vertex shader and fragment shader to the shader program and connects the shader program through the glLinProgram function.

[0075] You can get the results of each stage of shader creation after execution. For example, you can use the glGetShaderiv function and the parameter GL_COMPILE_STATUS after compiling the shader source code. By obtaining detailed information about the execution results, you can help detect syntax or logic errors in the source code.

[0076] S5, rendering preparation: pass the corresponding parameters to the shader before rendering, and pass the parsed VBO data to the vertex shader;

[0077] Furthermore, if Figure 4 As shown, the rendering preparation specifically includes:

[0078] Run the shader program through the glUseProgram function to enable the input attributes in the shader program;

[0079] Set the corresponding perspective matrix, viewing matrix and model matrix variables in the vertex shader, and set the corresponding lighting parameters and texture number in the fragment shader;

[0080] Bind VBO data to video memory and pass the parsed VBO data to the vertex shader, which associates the structure of the data with the input attributes.

[0081] Specifically, since the viewing angle or the position of the light needs to be changed in the scene, the corresponding parameters are passed to the shader before rendering. Currently, the vertex shader does not know the structure of the data in the VBO, and the method of parsing the VBO data is informed to the vertex shader. Call the drawing instruction glDrawElements for rendering, OpenGL executes the vertex shader and fragment shader respectively, and outputs the rendering results to the window.

[0082] S6. Rendering: Call the drawing instruction glDrawElements for rendering, use the modern OpenGL rendering method to execute the created vertex shader and fragment shader respectively, and output the rendering results to the window to display the three-dimensional digital earth.

[0083] Furthermore, OpenGL uses the Phong Lighting Model, which consists of three elements: ambient, diffuse, and specular lighting. The color of the lighting is white light. Considering that the current application scenario only uses ambient and diffuse lighting effects, specular lighting is not used. The intensity of ambient and diffuse lighting can be set in the lighting parameters.

[0084] The lighting calculation method is as follows: input variables: lighting color lightColor, ambient light intensity ambient, diffuse reflection intensity diffuse, normal vector Normal, vertex position WorldPos, lighting position lightPos and vertex color colorObj, calculate the ambient light according to the formula AmbientColor = lightColor*ambient; calculate the reverse lighting according to lightDir = normalize(lightPos-WorldPos), calculate the diffuse reflection factor according to DiffuseFactor = dot(lightDir,Normal) (vector dot product), calculate the diffuse reflection according to DiffuseColor = lightColor*DiffuseFactor*diffuse, and then output the color according to FragColor = colorObj*(AmbientColor+DiffuseColor).

[0085] Traditional OpenGL uses an immediate rendering mode, which has low rendering efficiency. Modern OpenGL is superior to traditional OpenGL in rendering efficiency, especially when the amount of data is large, the efficiency advantage is more obvious. The amount of data for three-dimensional terrain is large, reaching hundreds of megabytes, so the rendering method of modern OpenGL can meet the rendering indicators.

[0086] The graphics rendering pipeline receives a set of 3D coordinates and converts them into 2D pixel display output on the screen. The graphics rendering pipeline can be divided into several stages, each of which takes the output of the previous stage as input. All of these stages are highly specialized (they all have a specific function) and are easily executed in parallel. Precisely because of their parallel execution characteristics, most graphics cards today have thousands of small processing cores that run their own small programs on the GPU for each rendering stage, thereby quickly processing data in the graphics rendering pipeline. These small programs are called shaders. The graphics rendering pipeline contains many parts, each of which will handle its own specific stage in the process of converting vertex data to the final pixel. The present invention will explain the various parts of the pipeline in general terms.

[0087] Therefore, modern OpenGL rendering methods specifically include:

[0088] First, three 3D coordinates are passed as input to the graphics rendering pipeline in the form of an array to represent a triangle. This array is called vertex data; vertex data is a series of vertex sets, and a vertex is a data set of 3D coordinates. Vertex data is represented by vertex attributes, which can contain any data we want, such as 3D coordinates, colors, and textures.

[0089] The first part of the graphics rendering pipeline is the vertex shader, which takes a single vertex as input. The main purpose of the vertex shader is to transform 3D coordinates into another type of 3D coordinates, and vertex shading allows us to perform some basic processing on vertex attributes.

[0090] The Primitive Assembly stage takes as input all the vertices output by the vertex shader (if it is GL_Points, then it is a vertex) and assembles all the points into the shape of the specified primitive; such as a triangle.

[0091] The output of the primitive assembly stage is passed to the geometry shader. The geometry shader takes as input the geometry of a primitive in the form of a series of vertices. It can generate other constellations by generating new vertices to construct new (or other) primitives. In this example, it generates another triangle.

[0092] The output of the geometry shader is passed to the rasterization stage, where it maps the primitives to the corresponding pixels on the final screen and generates fragments for the fragment shader. Clipping is performed before the fragment shader runs. Clipping discards all pixels outside the view to improve execution efficiency.

[0093] Among them, a fragment in OpenGL is all the data OpenGL needs to render a pixel, such as vertex coordinates, color, etc. The main purpose of the fragment shader is to calculate the final color of a pixel, which is also where the advanced effects of OpenGL are produced. Usually, the fragment shader contains data about the 3D scene (such as lighting, shadows, textures, etc.), which can be used to calculate the color of the final pixel.

[0094] After all the corresponding color values ​​are confirmed, the final object will be passed to the last stage, called the Alpha test and blending stage. This stage detects the depth value and stencil value of the fragment to determine whether the pixel is behind or in front of other objects and whether it should be discarded. This stage also checks the alpha value (the alpha value defines the transparency of an object) and blends the objects. Therefore, even if the color of a pixel output is calculated in the fragment shader, the final pixel color may be completely different when rendering multiple triangles.

[0095] The vertex shader and fragment shader in the OpenGL rendering module need to be defined by yourself.

[0096] Before you start drawing graphics, you must first input vertex data to OpenGL. This data is managed by Vertex Buffer Objects (VBOs), which store a large number of vertices in the GPU's video memory. The benefit of using these buffer objects is that we can send a large amount of data to the video memory at once, rather than sending it once for each vertex. Sending data from memory to the video memory is relatively slow. Once the data is sent to the video memory, the vertex shader can access the vertex data, and local access is very fast. Allocating a large number of VBOs (a VBO has a capacity of only kilobytes) may cause problems with graphics card drivers. Some drivers can only allocate a certain number of VBOs from the video memory, regardless of the capacity of the VBO, and smaller objects need to be placed in a large VBO.

[0097] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.

Claims

1. A method for constructing a three-dimensional digital earth for avionics display and control, characterized in that: The construction method comprises: Read terrain files: Use the GDAL library to read and load terrain files, parse them into terrain data, and then generate raw terrain data into memory; Calculate vertex data: calculate vertex attributes including 3D world coordinates, normals and texture coordinates and generate vertex attribute data; Transmit vertex data: calculate the space size and perform data transmission interaction; Create shaders: Generate source code for vertex shaders and fragment shaders using the GLSL language, and create corresponding executable logic units in the GPU; Rendering preparation: pass the corresponding parameters to the shader before rendering, and pass the parsed VBO data to the vertex shader; Rendering: Call the drawing instruction glDrawElements for rendering, use the modern OpenGL rendering method to execute the created vertex shader and fragment shader respectively, and output the rendering results to the window to display the three-dimensional digital earth; The transmission of vertex data specifically includes: Calculate the space size, use glGenBuffers to create a VBO object, set the VBO type to GL_ARRAY_BUFFER, VBO stores vertex data for use by the vertex shader, the glBufferData function will allocate a data storage space for the currently bound VBO, and write the vertex data in the memory to the space. The last parameter in glBufferData is GL_STATIC_DRAW, which means that the data storage content is initialized only once to facilitate GPU space allocation; If VBO fails to allocate storage space, it will use data segmentation and reuse to segment a large block of data into multiple small blocks of the same capacity, and then transfer the small blocks of data to the video memory for rendering. The steps of data segmentation and multiplexing include: Set the capacity of a single data block to 6MB, and calculate the number of vertex rows that can be accommodated based on the capacity of the data block; Calculate the number of data blocks required based on the total number of vertices and create the same number of VBOs; Allocate memory space according to the data block capacity and traverse the vertex array; Read the vertices that hold the number of rows, calculate the vertices, and transmit the vertices in sequence.

2. A three-dimensional digital earth construction method for avionics display and control according to claim 1, characterized in that: The computing vertex data specifically includes: Given the latitude and longitude of the starting point, calculate the latitude and longitude of the vertex based on the two-dimensional coordinates of the vertex. The height of the vertex is the value of its two-dimensional coordinates in the raster metadata. Then, refer to the world coordinate formula in the camera to calculate the world coordinates. Select two vertices adjacent to the current vertex according to the current vertex, calculate the vectors between the two vertices and the current vertex, and then cross-multiply the two vectors to get the normal vector; Generate texture according to the generated color table file, calculate the texture coordinates of the vertex and then use the texture to obtain the vertex color.

3. A method for constructing a three-dimensional digital earth for avionics display and control according to claim 2, characterized in that: Generating a texture according to the generated color table file and calculating the texture coordinates of the vertices and then acquiring the vertex colors by using the texture specifically include: Generate a one-dimensional color table file through a third-party tool; Create a one-dimensional texture based on the one-dimensional color table file. The width of the texture represents the total number of colors. The texture parameters in the memory are written to the video memory through the glTexImage1D function. The coordinate range of the texture in OpenGL is between 0 and 1, so the color table will be mapped to the range between 0 and 1. The texture coordinate 0 corresponds to the first color in the color table, and 1 corresponds to the last color. Input the height value of the current vertex, the maximum height value, and the minimum height value to calculate the texture coordinates of the vertex, and map the height of the vertex to the range between 0 and 1, which is consistent with the texture coordinates in the video memory; Input the texture number and the texture coordinates of the vertex and call the sampling function in the fragment shader to get the vertex color from the texture.

4. A three-dimensional digital earth construction method for avionics display and control according to claim 1, characterized in that: The creating of the shader specifically includes: The glGetShaderiv function creates a shader program, sets the source code of the vertex shader and fragment shader through the glShaderSource function and compiles the source code according to the glCompileShader function; The glAttachShader function binds the vertex shader and fragment shader to the shader program and connects the shader program through the glLinProgram function.

5. The method for constructing a three-dimensional digital earth for avionics display and control according to claim 1, characterized in that: The rendering preparation specifically includes: Run the shader program through the glUseProgram function to enable the input attributes in the shader program; Set the corresponding perspective matrix, viewing matrix and model matrix variables in the vertex shader, and set the corresponding lighting parameters and texture number in the fragment shader; Bind VBO data to video memory and pass the parsed VBO data to the vertex shader, which associates the structure of the data with the input attributes.

6. A method for constructing a three-dimensional digital earth for avionics display and control according to claim 1, characterized in that: The modern OpenGL rendering method includes: Vertex shader step: used to convert the three 3D coordinates passed in the form of an array into another type of 3D coordinates and then input them into the primitive assembly step; Primitive assembly step: used to assemble all points into the specified primitive shape and then input it into the geometry shader step; Geometry shader step: used to take the geometry of a series of vertices of the primitive shape as input, generate new vertices to construct new primitives to generate other primitive shapes, and input them to the rasterization step; Rasterization step: used to map primitives to corresponding pixels on the final screen and generate fragments for use by the fragment shader unit; The fragment shader step is used to calculate the final color of a pixel based on the contained 3D scene data. Test and blend step: used to detect the depth value and template value of the fragment to determine the position of the pixel, as well as detect the alpha value and blend the object.