CN111739136B - Rendering method, computer device, and storage medium - Google Patents

Rendering method, computer device, and storage medium Download PDF

Info

Publication number
CN111739136B
CN111739136B CN201910515246.5A CN201910515246A CN111739136B CN 111739136 B CN111739136 B CN 111739136B CN 201910515246 A CN201910515246 A CN 201910515246A CN 111739136 B CN111739136 B CN 111739136B
Authority
CN
China
Prior art keywords
rendering
data
thread
storage area
rendered
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910515246.5A
Other languages
Chinese (zh)
Other versions
CN111739136A (en
Inventor
刘振桂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910515246.5A priority Critical patent/CN111739136B/en
Publication of CN111739136A publication Critical patent/CN111739136A/en
Application granted granted Critical
Publication of CN111739136B publication Critical patent/CN111739136B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The application relates to a rendering method, a computer device and a storage medium, which can be applied to map-like application programs, wherein the method comprises the following steps: acquiring data to be rendered; preprocessing data to be rendered through a data thread to obtain processed data, wherein the processed data can be directly used for rendering; setting a mark to be rendered for the processed data in the controller through a data thread; and when the identifier to be rendered is inquired in the controller through the rendering thread, extracting the processed data through the rendering thread, and rendering the processed data. According to the rendering method, in the process of rendering the data, the rendering thread can judge that the data needing to be rendered currently exists only when the identifier to be rendered is determined by the controller, and the data obtained by processing the data thread is extracted for rendering, so that the rendering efficiency can be improved.

Description

Rendering method, computer device, and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a rendering method, a computer device, and a storage medium.
Background
With the development of computer technology, a user can navigate on a terminal by using a map; during navigation, the marking information, the route, the area surface, the head portrait information and the like on the map display interface can be displayed only through rendering.
Rendering in computer graphics refers to the process of generating images from models with software; the process of rendering data is usually completed through a rendering thread, however, in the rendering method in the prior art, when the method is applied to the rendering of navigation of such complex scenes, the problem of stuttering easily occurs.
Disclosure of Invention
In view of the above, it is necessary to provide a rendering method, a computer device, and a storage medium for addressing the above technical problems.
A method of rendering, the method comprising:
acquiring data to be rendered;
preprocessing the data to be rendered through a data thread to obtain processed data, wherein the processed data can be directly used for rendering;
setting a mark to be rendered for the processed data in a controller through the data thread;
and when the identifier to be rendered is inquired in the controller through a rendering thread, extracting the processed data through the rendering thread, and rendering the processed data.
A computer device comprising a memory area storing a computer program and a processor implementing the steps of the above method when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
According to the rendering method, the computer equipment and the storage medium, after the data to be rendered is obtained, the preprocessing process of the data to be rendered is completed through the data thread, the processed data which can be directly used for rendering is obtained, the identifier to be rendered is set in the controller, then when the identifier to be rendered is inquired through the rendering thread, the processed data is extracted through the rendering thread for rendering. According to the rendering method, in the process of rendering the data, the rendering thread can judge that the data needing to be rendered currently exists only when the identifier to be rendered is determined by the controller, and the data obtained by processing the data thread is extracted for rendering, so that the rendering efficiency can be improved.
Drawings
FIG. 1 is a diagram of an application environment of a rendering method in one embodiment;
FIG. 2 is a flow diagram of a rendering method in one embodiment;
FIG. 3 is a flow diagram that illustrates querying, by a rendering thread, an identifier to be rendered in one embodiment;
FIG. 4 is a diagram of a framework structure for implementing a rendering method in another embodiment;
FIG. 5 is a flow diagram illustrating steps of a rendering method in accordance with an exemplary embodiment;
FIG. 6 is a diagram of a map interface in one embodiment;
FIG. 7 is a schematic diagram showing a configuration of a rendering apparatus according to an embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The rendering method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 110 communicates with the server 120 through a network. The terminal acquires data to be rendered, wherein the data to be rendered can be acquired from a server in one embodiment; preprocessing data to be rendered through a data thread to obtain processed data which can be used for direct rendering, and setting a mark to be rendered for the processed data in a controller; and when the identifier to be rendered is inquired through the rendering thread, extracting the processed data through the rendering thread and rendering. The terminal 110 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a rendering method is provided, which is described by taking the method as an example applied to the terminal in fig. 1, and includes steps S210 to S230.
Step S210, data to be rendered is acquired.
Rendering in computer graphics refers to the process of generating images from a model with software. A model is a description of a three-dimensional object in a well-defined language or data structure that includes geometric, viewpoint, texture, and lighting information. In this embodiment, data to be rendered (geometric, viewpoint, texture, and lighting information) is recorded as data to be rendered, and usually, the original data to be rendered cannot be directly used for rendering, but only needs to be directly used for rendering after certain processing; rendering data to be rendered typically includes the steps of parsing, assembling, and rendering. In one embodiment, the data to be rendered may be data set by a user at a terminal. For example, in one embodiment, the data to be rendered may be a layer or setting data in a map, and the data to be rendered is acquired as the layer or setting data of the acquired map. When a user sets a layer or sets data, the terminal can acquire the data to be rendered.
Step S220, preprocessing the data to be rendered through a data thread to obtain processed data; the processed data is data which can be directly used for rendering.
The thread is the minimum unit which can be operated and scheduled by an operating system; it is included in the process and is the actual unit of operation in the process. A thread refers to a single sequential control flow in a process, multiple threads can be concurrently executed in a process, and each thread executes different tasks in parallel. In rendering data, the rendering thread is most commonly involved. In the existing rendering method, all steps required for rendering are generally completed by a rendering thread, including: when a complex application scene (such as a map, navigation and the like) is rendered, if the parsing and assembling of a certain data to be rendered are time-consuming, the frame rate is difficult to guarantee, and the problem of blocking easily occurs for equipment with poor performance. Where the frame rate is the frequency (rate) at which bitmap images appear continuously on the display in units of frames.
In this embodiment, a data thread is introduced in addition to a rendering thread for rendering, and is used to pre-process (analyze and assemble) data to be rendered to obtain processed data that can be directly used for rendering. The method specifically comprises the following steps: after the terminal acquires the data to be rendered, preprocessing the data to be rendered through the data thread to obtain processed data. In an actual rendering process, a terminal may acquire a plurality of data to be rendered at different times, and a data thread performs a preprocessing operation on one of the data to be rendered each time, or may perform a preprocessing operation on the data to be rendered acquired within a preset time period.
When the terminal acquires data to be rendered, a data thread is activated; in one embodiment, after the data to be rendered is acquired, the data to be rendered is preprocessed through a data thread to acquire processed data, and the method includes: analyzing and assembling the data to be rendered to obtain processed data which can be directly used for rendering; in this embodiment, data obtained by preprocessing data to be rendered by a data thread is recorded as processed data.
In one embodiment, after preprocessing the data to be rendered by the data thread, when the processed data is obtained, the method further includes starting the rendering thread.
Step S230, setting a to-be-rendered identifier for the processed data in the controller through the data thread.
And the mark to be rendered is used for indicating that new processed data needs to be rendered currently. Before rendering is performed through the rendering thread, in order to enable the rendering thread to know that there is currently processed data that needs to be rendered, in this embodiment, after the data to be rendered that is currently acquired is preprocessed through the data thread to obtain the current processed data, a to-be-rendered identifier is set for the processed data in the controller through the data thread.
In one embodiment, the identifier to be rendered is set for the processed data in the controller, and may be a new processed data obtained by processing through a data thread, the identifier to be rendered is set for the new processed data, and the identifier to be rendered is sent to the controller; in this embodiment, the identifier to be rendered corresponds to the processed data. Or, a data processing identification bit may be set in the controller, and when new processed data is obtained through the data thread, an instruction is sent to the controller through the data thread, so that the data processing identification bit in the controller is modified into the identifier to be rendered. It will be appreciated that in other embodiments, setting the to-be-rendered flag for the processed data in the controller may be implemented in other ways.
And S240, when the identifier to be rendered is inquired in the controller through the rendering thread, extracting the processed data through the rendering thread, and rendering the processed data.
In step S230, after the data thread executes the preprocessing operation to obtain new processed data, a to-be-rendered identifier is set in the controller, so in this embodiment, the rendering thread is used to query whether the to-be-rendered identifier exists in the controller to determine whether the processed data needing to be rendered currently exists; when the identifier to be rendered is inquired in the controller through the rendering thread, the fact that new processed data needing to be processed exist at the moment is judged.
The processed data obtained by preprocessing the data to be rendered through the data thread can be directly used for rendering, that is, the rendering thread in the embodiment does not need to perform preprocessing operation on the data to be rendered, but directly extracts the processed data and renders the data. Therefore, the data to be rendered are preprocessed to obtain the processed data, the processed data are extracted and rendered, the data are processed by two different threads respectively, understandably, the process of extracting and rendering the processed data through the rendering thread can not be influenced by the time consumption of the preprocessing process of the data to be rendered through the data thread, and therefore the overall rendering efficiency can be improved.
Further, in one embodiment, the processed data may be point information, line information, area information, and avatar information. In this embodiment, rendering the processed data includes: rendering the point information as annotation information on the map, rendering the line information as route information on the map, rendering the area information as an area on the map, and rendering the picture information as a head portrait on the map.
In a specific embodiment, rendering the processed data by the rendering thread includes: and calling GL Library (Graphics Library) through a rendering thread to render the processed data.
The rendering method in this embodiment may be implemented by an MVC (Model View Controller) framework. The MVC framework organizes code by a method of separating business logic, data and interface display, and gathers the business logic into one component, so that the business logic does not need to be rewritten while improving and personalizing a customized interface and user interaction. MVC is often used to map traditional input, processing, and output functions in the structure of a logical graphical user interface. Wherein the model is a portion of the application for processing application data logic; views are the part of an application that handles the display of data; the controller is the part of the application that handles user interaction. In this embodiment, the data thread, the rendering thread, and the controller respectively correspond to a model layer, a view layer, and a control layer of an MVC frame, and as shown in fig. 3, are a schematic diagram of a frame structure for implementing the rendering method in one embodiment.
According to the rendering method, after the data to be rendered is obtained, the preprocessing process of the data to be rendered is completed through the data thread, processed data which can be directly used for rendering are obtained, the identifier to be rendered is set in the controller, and then when the identifier to be rendered is inquired through the rendering thread, the processed data are extracted through the rendering thread to be rendered. According to the rendering method, in the process of rendering the data, the rendering thread can judge that the data needing to be rendered currently exists only when the identifier to be rendered is determined by the controller, and the data obtained by processing the data thread is extracted for rendering, so that the rendering efficiency can be improved.
Further, in one embodiment, as shown in fig. 4, the identifier to be rendered is queried in the controller by the rendering thread, which includes steps S410 to S430.
In step S410, an inquiry request is sent to the controller through the rendering thread.
In this embodiment, since the identifier to be rendered needs to be set in the controller through the data thread after the data to be rendered is preprocessed through the data thread to obtain the processed data, in this embodiment, the processed data is obtained through the data thread, and before the processed data is extracted through the rendering thread, an inquiry request is sent to the controller through the rendering thread to know whether the identifier to be rendered exists in the controller; it is to be understood that the query request in this embodiment is a request initiated to the controller by the rendering thread to query whether there is an identifier to be rendered currently in the controller.
In step S420, when the controller detects that the identifier to be rendered exists, an inquiry response that needs to be rendered is returned to the rendering thread.
The query response is a response returned by the controller to the rendering thread after receiving the query request, and may or may not need to be rendered. It can be understood that when the controller detects that the identifier to be rendered exists, the corresponding returned inquiry response is that rendering is required; in another embodiment, the query response returned to the rendering thread is no need to be rendered when the identification to be rendered is not detected in the controller.
Step S430, when the rendering thread receives the inquiry response that the rendering is required, it is determined that the identifier to be rendered is queried by the rendering thread.
Only when the controller detects that the identifier to be rendered exists, sending an inquiry response needing rendering to the rendering thread, so in the embodiment, if the inquiry response needing rendering sent by the controller is received through the rendering thread, judging that the identifier to be rendered is inquired through the rendering thread; the processed data may be fetched by the rendering thread at this time.
Further, in an embodiment, after rendering the processed data, the method further includes: and canceling the identifier to be rendered in the controller.
In the foregoing step, the processed data is extracted and rendered by the rendering thread, that is, the identifier to be rendered of the processed data is no longer needed, so in this embodiment, after the processed data is rendered by the rendering thread, the step of canceling the identifier to be rendered in the controller is further included.
Further, in an embodiment, if the setting of the identifier to be rendered for the processed data in the controller is implemented by setting the identifier to be rendered for the new processed data through the data thread and then sending the identifier to be rendered to the controller, the cancellation of the identifier to be rendered may be a deletion of the identifier to be rendered for the processed data in the controller. Or in another embodiment, the setting of the to-be-rendered flag for the processed data in the controller is realized by sending an instruction to the controller through a data thread after new processed data is obtained and modifying a data processing flag bit in the controller to be a to-be-rendered flag, and then canceling the to-be-rendered flag is: the data processing flag of this processed data in the controller is modified to indicate the rendered flag. It will be appreciated that in other embodiments, cancelling the to-be-rendered identification in the controller may be implemented in other ways as well.
In one embodiment, after preprocessing the data to be rendered by the data thread to obtain processed data, the method further includes: storing the processed data into a first storage area; wherein the first memory area is associated with a data thread. The method comprises the following steps of extracting processed data through a rendering thread and before rendering the processed data, further comprising: storing the processed data into a second storage area; wherein the second storage area is associated with a rendering thread. Extracting the processed data through the rendering thread, and rendering the processed data, including: and extracting the processed data from the associated second storage area through the rendering thread, and rendering the processed data.
In the embodiment, a storage area associated with a data thread is recorded as a first storage area, and a storage area associated with a rendering thread is recorded as a second storage area; storing processed data obtained after preprocessing data to be rendered through a data thread into a first storage area; and before the processed data is extracted through the rendering thread and rendered, the processed data is stored in the second storage area, so that the processed data can be extracted from the second storage area through the rendering thread and rendered.
Further, in one embodiment, storing the processed data in a second memory area, the second memory area associated with a rendering thread, includes: setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread; and setting the second storage area originally associated with the rendering thread as the first storage area associated with the data thread.
The method comprises the steps that processed data obtained through data thread preprocessing are stored in a first storage area associated with a data thread, when a rendering thread needs to extract the processed data, the original first storage area is set as a second storage area, and after the setting, the rendering thread is associated with the storage area (the original first storage area and the set second storage area) in which the processed data are stored; further, the original second storage area is set as a new first storage area, so that the second storage area is associated with the data thread. That is, in the present embodiment, storing the processed data in the second storage area is realized by exchanging the first storage area and the second storage area.
Further, in one embodiment, when the identifier to be rendered is queried in the controller by the rendering thread, the processed data is stored in the second storage area. In the embodiment, the acquired data to be rendered is preprocessed through the data thread, the preprocessed data are stored in the first storage area, and the identifier to be rendered is set in the controller; and when the identifier to be rendered is inquired in the controller through the rendering thread, storing the processed data into the second storage area, namely, associating the storage area in which the processed data is stored with the rendering thread, then extracting the processed data in the second storage area through the rendering thread, and rendering.
In one embodiment, a first storage area originally associated with a data thread is set by a controller as a second storage area associated with a rendering thread; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
Wherein, in one embodiment, the first memory area comprises a memory area pointed to by a pointer of the data thread; the second memory area includes a memory area to which a pointer of the rendering thread points.
In the embodiment, a first storage area originally associated with a data thread is set as a second storage area associated with a rendering thread through a controller; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread, including:
modifying, by the controller, the pointer of the rendering thread to a first storage area to which the pointer of the data thread originally points, so as to set the first storage area originally associated with the data thread as a second storage area associated with the rendering thread; and modifying the pointer of the data thread into a second storage area originally pointed by the pointer pointing to the rendering thread through the controller so as to set the second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
In computer science, a Pointer (Pointer) is an object in a programming language whose value directly points (points to) a value stored elsewhere in computer memory, using an address. Since the desired variable location can be found by the address, the address can be said to point to the variable location. In this embodiment, a storage area pointed to by a pointer of a data thread is recorded as a storage area associated with the data thread, i.e. a first storage area; the memory area pointed to by the pointer of the rendering thread is recorded as the memory area associated with the rendering thread, i.e. the second memory area. In this embodiment, the first storage area and the second storage area, specifically, the storage areas pointed by the pointers of the data thread and the rendering thread, are exchanged through the controller when the processed data in the storage area originally associated with the data thread needs to be extracted through the rendering thread.
In the rendering method, the first storage area is assumed to be A, the second storage area is assumed to be B, and before the processed data is extracted through the rendering thread, the pointer originally used by the rendering thread to point to the second storage area B is modified to point to the first storage area A through the controller, so that the rendering thread is associated with the original first storage area A, and the processed data can be directly extracted from the original first storage area A in which the processed data is stored through the rendering thread and then rendered; furthermore, the pointer originally used for pointing to the first storage area A of the data thread is modified to point to the original second storage area B through the controller, so that the data thread is associated with the original second storage area B, and the processed data obtained by preprocessing the data thread subsequently is stored in the original second storage area B. The time required for exchanging the pointers of the two threads through the controller is very short, so that the time for extracting the processed data for the rendering thread and rendering is reduced, and the rendering efficiency is improved.
In another embodiment, storing the processed data in a second memory area, the second memory area associated with a rendering thread, comprises: the processed data in the first storage area is extracted by the controller and the extracted processed data is stored in the second storage area.
In this embodiment, the processed data in the first storage area is extracted and then stored in the second storage area, so that the rendering thread can extract the processed data from the second storage area associated with the rendering thread and render the data. Further, in one embodiment, the identification to be rendered in the controller is cancelled after the extracted processed data is stored in the second storage area by the controller.
In another embodiment, the processed data is stored in the second storage area, and the second storage area is associated with the rendering thread, or the processed data in the first storage area is copied by the controller, and the copied processed data is stored in the second storage area. Further, in one embodiment, the identification to be rendered in the controller is cancelled after the copied processed data is stored in the second storage area by the controller.
It will be appreciated that the process of storing the processed data in the second memory area, which is associated with the rendering thread, may also be implemented in other ways in other embodiments.
In the rendering method, storage areas which are respectively associated with the data thread and the rendering thread are respectively arranged, so that the current processed data obtained by preprocessing the current data to be rendered through the data thread is stored in a first storage area, then the processed data in the first storage area is extracted or copied and stored in a second storage area, or the first storage area and the second storage area are exchanged through a controller, then the exchanged processed data in the second storage area is extracted through the rendering thread, and rendering is carried out. Therefore, in the process of extracting the processed data by the rendering thread, the data thread may pre-process the data to be rendered at the next moment, so that the time for the rendering thread to wait for the pre-processing of the data to be rendered is avoided, and the rendering efficiency of the rendering thread can be improved; in terms of display, the frame rate of display can be improved; for a terminal with poor performance, the display effect can be optimized.
In another embodiment, after preprocessing the data to be rendered by the data thread to obtain processed data, the method further includes: storing the processed data into a third storage area; wherein the third storage area is associated with the data thread and the rendering thread.
In this embodiment, extracting the processed data through the rendering thread and rendering the processed data includes: and extracting the processed data with the identifier to be rendered from the third storage area through the rendering thread, and rendering the processed data.
In the rendering method, a storage area associated with a data thread and a rendering thread is set and marked as a third storage area; storing the processed data into a third storage area through a data thread, setting a mark to be rendered for the processed data in the controller, and determining that the processed data needing rendering exists in the third storage area when the mark to be rendered exists in the controller through the rendering thread; at this time, the processed data in the third storage area is extracted by the rendering thread and rendered. Further, in this embodiment, after the processed data in which the identifier to be rendered exists is extracted from the third storage area by the rendering thread, the identifier to be rendered in the controller is cancelled.
Further, in an embodiment, the third storage area may be a memory capable of performing reading and writing simultaneously, so that data obtained by preprocessing the data thread is stored in the third storage area, and a process of extracting the processed data from the third storage area by the rendering thread for rendering may be performed simultaneously without interfering with each other, for example, the process of preprocessing the data to be rendered at the next time by the data thread to obtain the processed data at the next time, and the process of extracting the current processed data by the rendering thread for rendering may be performed simultaneously; the rendering thread can identify the data to be processed which needs to be extracted for rendering through the identification to be rendered.
According to the rendering method, the preprocessing process of the data thread and the rendering process of the rendering thread can be carried out simultaneously, and the rendering process of the rendering thread does not need to wait for the time of the data preprocessing process, so that the rendering efficiency of the rendering thread can be improved.
Further, in an embodiment, after canceling the identifier to be rendered in the controller, the rendering method further includes: the processed data in the second storage area is deleted. In this manner, the amount of data in the second storage area can be reduced.
In a specific embodiment, the detailed description is given by taking an example that the rendering method is applied to rendering of a map through an MVC framework, wherein a storage area associated with a data thread is taken as a back buffer area, and a storage area associated with a rendering thread is taken as a front buffer area; recording data in the front buffer area as front buffer data, and recording data in the rear buffer area as rear buffer data; in this embodiment, all data processing operations of the data thread, rendering thread, and controller are managed by the layer management module. As shown in fig. 5, the rendering process includes the steps of:
the user adds a layer or sets data (the data to be rendered) on the client or the interactive interface, and the terminal acquires the data to be rendered and activates a data thread.
The data to be rendered is analyzed and assembled through a data thread to obtain processed data (the data is analyzed and preprocessed to a back buffer area shown in a corresponding graph), and the method comprises the following steps: point information, line information, plane information, or avatar information, etc.; storing the processed data into a back buffer area; and setting a mark to be exchanged (the mark to be rendered) for the processed data in the controller through the data thread. In one embodiment, prior to preprocessing data to be rendered by a data thread, the data thread sends a request to execute preprocessing to a graphics layer management module.
Starting a rendering thread, sending an inquiry request (corresponding to the drawing step shown in the figure) to a controller through the rendering thread, returning an inquiry response needing to be rendered to the rendering thread when the controller inquires that the identifier to be exchanged exists, judging that the identifier to be rendered is inquired when the rendering thread receives the inquiry response needing to be rendered, modifying a pointer originally pointing to a front buffer area of the rendering thread to a rear buffer area through the controller, modifying a pointer originally pointing to the rear buffer area of the data thread to a pointer pointing to the front buffer area through the controller, and exchanging the front buffer area and the rear buffer area through the controller; the original front buffer area is set as a new rear buffer area, and the original rear buffer area is set as a new front buffer area.
Then, extracting the processed data in the new front buffer area through a rendering thread, and calling a GL library to render the processed data in the front buffer area; rendering the point information as annotation information on the map, rendering the line information as route information on the map, rendering the area information as an area on the map, and rendering the picture information as a head portrait on the map. Further, after the processed data is rendered by the rendering thread, the to-be-exchanged identifier in the controller is cancelled. FIG. 6 is a diagram illustrating a map interface in one embodiment; in the figure, reference numeral 610 denotes label information, 620 denotes route information, 630 denotes area surface information, and 640 denotes avatar information.
In the rendering method, the rendering thread is only responsible for rendering related work, and all time-consuming and complex work (analyzing and assembling data to be rendered) is performed by the data thread, so that the rendering efficiency can be greatly improved, and the display frame rate is improved.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 7, the present application further provides a rendering apparatus, including: a data acquisition module 710, a data processing module 720, a setup module 730, and a rendering module 740, wherein:
and a data obtaining module 710, configured to obtain data to be rendered.
The data processing module 720 is configured to pre-process data to be rendered through a data thread to obtain processed data, where the processed data is data that can be directly used for rendering.
A setting module 730, configured to set, in the controller, an identifier to be rendered for the processed data through the data thread.
And the rendering module 740 is configured to, when the identifier to be rendered is queried in the controller through the rendering thread, extract the processed data through the rendering thread, and render the processed data.
According to the rendering device, after the data to be rendered are obtained, the preprocessing process of the data to be rendered is completed through the data thread, processed data which can be directly used for rendering are obtained, the identifier to be rendered is set in the controller, and then when the identifier to be rendered is inquired through the rendering thread, the processed data are extracted through the rendering thread to be rendered. According to the rendering method, in the process of rendering the data, the rendering thread can judge that the data needing to be rendered currently exists only when the identifier to be rendered is determined by the controller, and the data obtained by processing the data thread is extracted for rendering at the moment, so that the rendering efficiency of the rendering thread can be improved.
For the specific definition of the rendering device, reference may be made to the definition of the rendering method above, and details are not described here. The modules in the rendering device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a storage area in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
FIG. 8 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may specifically be the terminal 110 in fig. 1. As shown in fig. 8, the computer apparatus includes a processor, a memory, a network interface, an input device, and a display screen connected through a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement the rendering method. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform the rendering method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the rendering apparatus provided herein may be implemented in the form of a computer program that is executable on a computer device such as that shown in fig. 8. The memory of the computer device may store therein various program modules constituting the rendering apparatus, such as a data acquisition module, a data processing module, a setting module, and a rendering module shown in fig. 7. The program modules constitute computer programs that cause a processor to execute the steps in the rendering method according to the embodiments of the present application described in the present specification.
For example, the computer device shown in fig. 8 may perform the step of acquiring the data to be rendered by a data acquisition module in the rendering apparatus shown in fig. 7. The computer equipment can execute the step of preprocessing the data to be rendered through the data thread through the data processing module to obtain processed data, wherein the processed data is data which can be directly used for rendering. The computer device can execute the step of setting the identifier to be rendered for the processed data in the controller through the data thread through the setting module. The computer equipment can execute the steps of extracting processed data through the rendering thread and rendering the processed data through the rendering thread when the identifier to be rendered is inquired in the controller through the rendering thread through the rendering module.
In one embodiment, there is provided a computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to carry out the steps of:
acquiring data to be rendered;
preprocessing data to be rendered through a data thread to obtain processed data, wherein the processed data are data which can be directly used for rendering;
setting a mark to be rendered for the processed data in the controller through a data thread;
and when the identifier to be rendered is inquired in the controller through the rendering thread, extracting the processed data through the rendering thread, and rendering the processed data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inquiring the identifier to be rendered in the controller through the rendering thread, wherein the method comprises the following steps:
sending an inquiry request to a controller through a rendering thread;
when the controller detects that the identifier to be rendered exists, returning an inquiry response needing rendering to the rendering thread;
when the rendering thread receives an inquiry response needing to be rendered, the rendering thread queries the controller for the identifier to be rendered.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inquiring the identifier to be rendered through the rendering thread, wherein the inquiring includes:
sending an inquiry request to a controller through a rendering thread;
when the controller detects that the identifier to be rendered exists, returning an inquiry response needing rendering to the rendering thread;
when the rendering thread receives an inquiry response needing to be rendered, the identifier to be rendered is judged to be inquired by the rendering thread.
In one embodiment, the processor, when executing the computer program, further performs the steps of: after preprocessing the data to be rendered through the data thread and obtaining the processed data, the method further comprises the following steps: storing the processed data into a first storage area, wherein the first storage area is associated with a data thread;
the method comprises the following steps of extracting processed data through a rendering thread and before rendering the processed data, further comprising: storing the processed data into a second storage area, wherein the second storage area is associated with the rendering thread;
extracting the processed data through the rendering thread, and rendering the processed data, including: and extracting the processed data from the associated second storage area through the rendering thread, and rendering the processed data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: storing the processed data into a second storage area, the second storage area being associated with the rendering thread, comprising:
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread; and setting the second storage area originally associated with the rendering thread as the first storage area associated with the data thread.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread through a controller; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the first memory area includes a memory area pointed to by a pointer of the data thread; the second memory area includes a memory area to which a pointer of the rendering thread points;
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread through a controller; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread, including:
modifying, by the controller, the pointer of the rendering thread to a first storage area to which the pointer of the data thread originally points, so as to set the first storage area originally associated with the data thread as a second storage area associated with the rendering thread;
and modifying the pointer of the data thread into a second storage area originally pointed by the pointer pointing to the rendering thread through the controller so as to set the second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
In one embodiment, the processor, when executing the computer program, further performs the steps of: storing the processed data into a second storage area, the second storage area being associated with the rendering thread, comprising:
the processed data in the first storage area is extracted by the controller and the extracted processed data is stored in the second storage area.
In one embodiment, the processor, when executing the computer program, further performs the steps of: after rendering the processed data, the method further comprises the following steps: and canceling the identifier to be rendered in the controller.
In one embodiment, the processor, when executing the computer program, further performs the steps of: after preprocessing the data to be rendered through the data thread and obtaining the processed data, the method further comprises the following steps: storing the processed data into a third storage area, wherein the third storage area is associated with a data thread and a rendering thread;
extracting the processed data through the rendering thread, and rendering the processed data, including: and extracting the processed data with the identifier to be rendered from the third storage area through the rendering thread, and rendering the processed data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring data to be rendered, comprising: and acquiring a map layer of the map or setting data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the processed data comprises at least one of point information, line information, face information and head portrait information;
rendering the processed data, wherein the rendering comprises at least one of the following modes: rendering the point information as annotation information on the map, rendering the line information as route information on the map, rendering the area information as an area on the map, and rendering the picture information as a head portrait on the map.
In one embodiment, a computer readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of:
acquiring data to be rendered;
preprocessing data to be rendered through a data thread to obtain processed data, wherein the processed data are data which can be directly used for rendering;
setting a mark to be rendered for the processed data in the controller through a data thread;
and when the identifier to be rendered is inquired in the controller through the rendering thread, extracting the processed data through the rendering thread, and rendering the processed data.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring the identifier to be rendered in the controller through the rendering thread, wherein the method comprises the following steps:
sending an inquiry request to a controller through a rendering thread;
when the controller detects that the identifier to be rendered exists, returning an inquiry response needing rendering to the rendering thread;
when the rendering thread receives an inquiry response needing to be rendered, the rendering thread queries the controller for the identifier to be rendered.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring the identifier to be rendered through the rendering thread, wherein the inquiring includes:
sending an inquiry request to a controller through a rendering thread;
when the controller detects that the identifier to be rendered exists, returning an inquiry response needing rendering to the rendering thread;
when the rendering thread receives an inquiry response needing to be rendered, the identifier to be rendered is judged to be inquired by the rendering thread.
In one embodiment, the computer program when executed by the processor further performs the steps of: after preprocessing the data to be rendered through the data thread and obtaining the processed data, the method further comprises the following steps: storing the processed data into a first storage area, wherein the first storage area is associated with a data thread;
the method comprises the following steps of extracting processed data through a rendering thread and before rendering the processed data, further comprising: storing the processed data into a second storage area, wherein the second storage area is associated with the rendering thread;
extracting the processed data through the rendering thread, and rendering the processed data, including: and extracting the processed data from the associated second storage area through the rendering thread, and rendering the processed data.
In one embodiment, the computer program when executed by the processor further performs the steps of: storing the processed data into a second storage area, the second storage area being associated with the rendering thread, comprising:
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread; and setting the second storage area originally associated with the rendering thread as the first storage area associated with the data thread.
In one embodiment, the computer program when executed by the processor further performs the steps of:
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread through a controller; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the first memory area includes a memory area pointed to by a pointer of the data thread; the second memory area includes a memory area to which a pointer of the rendering thread points;
setting a first storage area originally associated with the data thread as a second storage area associated with the rendering thread through a controller; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread, including:
modifying, by the controller, the pointer of the rendering thread to a first storage area to which the pointer of the data thread originally points, so as to set the first storage area originally associated with the data thread as a second storage area associated with the rendering thread;
and modifying the pointer of the data thread into a second storage area originally pointed by the pointer pointing to the rendering thread through the controller so as to set the second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
In one embodiment, the computer program when executed by the processor further performs the steps of: storing the processed data into a second storage area, the second storage area being associated with the rendering thread, comprising:
the processed data in the first storage area is extracted by the controller and the extracted processed data is stored in the second storage area.
In one embodiment, the computer program when executed by the processor further performs the steps of: after rendering the processed data, the method further comprises the following steps: and canceling the identifier to be rendered in the controller.
In one embodiment, the computer program when executed by the processor further performs the steps of: after preprocessing the data to be rendered through the data thread and obtaining the processed data, the method further comprises the following steps: storing the processed data into a third storage area, wherein the third storage area is associated with a data thread and a rendering thread;
extracting the processed data through the rendering thread, and rendering the processed data, including: and extracting the processed data with the identifier to be rendered from the third storage area through the rendering thread, and rendering the processed data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring data to be rendered, comprising: and acquiring a map layer of the map or setting data.
In one embodiment, the computer program when executed by the processor further performs the steps of: the processed data comprises at least one of point information, line information, face information and head portrait information;
rendering the processed data, wherein the rendering comprises at least one of the following modes: rendering the point information as annotation information on the map, rendering the line information as route information on the map, rendering the area information as an area on the map, and rendering the picture information as a head portrait on the map.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (12)

1. A method of rendering, the method comprising:
acquiring data to be rendered;
activating a data thread, and preprocessing the data to be rendered through the data thread to obtain processed data, wherein the processed data is data which can be directly used for rendering;
setting a mark to be rendered for the processed data in a controller through the data thread;
starting a rendering thread, extracting the processed data through the rendering thread when the identifier to be rendered is inquired in the controller through the rendering thread, and rendering the processed data;
after the data to be rendered is preprocessed through the data thread to obtain processed data, the method further comprises the following steps: storing the processed data into a first storage area, wherein the first storage area is associated with the data thread;
extracting the processed data through a rendering thread, and before rendering the processed data, further comprising: storing the processed data into a second storage area, wherein the second storage area is associated with the rendering thread;
extracting the processed data through a rendering thread, and rendering the processed data, including: and extracting the processed data from the associated second storage area through a rendering thread, and rendering the processed data.
2. The method of claim 1, wherein the querying the identifier to be rendered in the controller by a rendering thread comprises:
sending an inquiry request to a controller through the rendering thread;
when the controller detects that the identifier to be rendered exists, returning an inquiry response needing rendering to the rendering thread;
when the rendering thread receives the inquiry response needing to be rendered, the fact that the rendering thread inquires the identifier to be rendered in the controller is judged.
3. The method of claim 1, wherein storing the processed data in a second storage area, the second storage area associated with the rendering thread, comprises:
setting a first storage area originally associated with a data thread as a second storage area associated with the rendering thread; and setting the second storage area originally associated with the rendering thread as the first storage area associated with the data thread.
4. The method of claim 3, wherein:
setting, by a controller, a first storage area originally associated with a data thread as a second storage area associated with the rendering thread; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
5. The method of claim 4, wherein the first memory region comprises a memory region to which a pointer of the data thread points; the second memory area comprises a memory area pointed to by a pointer of the rendering thread;
setting, by a controller, a first storage area originally associated with a data thread as a second storage area associated with the rendering thread; setting, by the controller, a second storage area originally associated with the rendering thread as a first storage area associated with the data thread, including:
modifying, by the controller, the pointer of the rendering thread to a first storage area to which the pointer of the data thread originally points, so as to set the first storage area originally associated with the data thread as a second storage area associated with the rendering thread;
and modifying the pointer of the data thread into a second storage area originally pointed by the pointer of the rendering thread through the controller so as to set the second storage area originally associated with the rendering thread as a first storage area associated with the data thread.
6. The method of claim 1, wherein storing the processed data in a second storage area, the second storage area associated with the rendering thread, comprises:
and extracting the processed data in the first storage area through a controller, and storing the extracted processed data into the second storage area.
7. The method of any of claims 1 to 6, wherein after rendering the processed data, further comprising:
canceling the identifier to be rendered in the controller.
8. The method according to any one of claims 1 to 6, wherein after the pre-processing the data to be rendered by the data thread to obtain processed data, the method further comprises: storing the processed data into a third storage area, wherein the third storage area is associated with the data thread and the rendering thread;
extracting the processed data through a rendering thread, and rendering the processed data, including: and extracting the processed data with the identifier to be rendered from the third storage area through the rendering thread, and rendering the processed data.
9. The method of any one of claims 1 to 6, comprising at least one of:
the first item, acquiring data to be rendered, includes: acquiring a map layer or setting data of a map;
a second item, the processed data including at least one of point information, line information, plane information, and avatar information;
rendering the processed data, wherein the rendering comprises at least one of the following modes: rendering the point information as labeling information on a map, rendering the line information as route information on the map, rendering the area information as an area on the map, and rendering the avatar information as an avatar on the map.
10. An apparatus for rendering, the apparatus comprising: data acquisition module, data processing module, setting module and rendering module, wherein:
the data acquisition module is used for acquiring data to be rendered;
the data processing module is used for activating a data thread, preprocessing the data to be rendered through the data thread and obtaining processed data, wherein the processed data can be directly used for rendering;
the setting module is used for setting a to-be-rendered identifier for the processed data in the controller through the data thread;
the rendering module is used for starting a rendering thread, extracting the processed data through the rendering thread when the identifier to be rendered is inquired in the controller through the rendering thread, and rendering the processed data;
the data processing module is also used for storing the processed data into a first storage area, and the first storage area is associated with the data thread;
the rendering module is further configured to store the processed data in a second storage area, where the second storage area is associated with the rendering thread, extract the processed data from the associated second storage area through the rendering thread, and render the processed data.
11. A computer device comprising a memory area and a processor, the memory area storing a computer program, characterized in that the processor realizes the steps of the method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 9.
CN201910515246.5A 2019-06-14 2019-06-14 Rendering method, computer device, and storage medium Active CN111739136B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910515246.5A CN111739136B (en) 2019-06-14 2019-06-14 Rendering method, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910515246.5A CN111739136B (en) 2019-06-14 2019-06-14 Rendering method, computer device, and storage medium

Publications (2)

Publication Number Publication Date
CN111739136A CN111739136A (en) 2020-10-02
CN111739136B true CN111739136B (en) 2022-04-15

Family

ID=72645899

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910515246.5A Active CN111739136B (en) 2019-06-14 2019-06-14 Rendering method, computer device, and storage medium

Country Status (1)

Country Link
CN (1) CN111739136B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231125B (en) * 2020-12-16 2021-03-09 智道网联科技(北京)有限公司 Map display method and device for intelligent vehicle-mounted internet terminal
CN112287064A (en) * 2020-12-25 2021-01-29 智道网联科技(北京)有限公司 Rendering method and device for map engine anchor point
CN117130774B (en) * 2023-04-28 2024-07-12 荣耀终端有限公司 Thread acceleration processing method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070120865A1 (en) * 2005-11-29 2007-05-31 Ng Kam L Applying rendering context in a multi-threaded environment
CN103617027B (en) * 2013-10-29 2015-07-29 合一网络技术(北京)有限公司 Based on image rendering engine construction method and the system of Android system
CN107015871A (en) * 2016-12-07 2017-08-04 阿里巴巴集团控股有限公司 A kind of data processing method and device
CN107223264B (en) * 2016-12-26 2022-07-08 达闼机器人股份有限公司 Rendering method and device

Also Published As

Publication number Publication date
CN111739136A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
CN107391653B (en) Distributed NewSQL database system and picture data storage method
CN109343851B (en) Page generation method, page generation device, computer equipment and storage medium
CN110008455B (en) Table editing method, apparatus, computer device and storage medium
CN111739136B (en) Rendering method, computer device, and storage medium
CN108664582B (en) Enterprise relation query method and device, computer equipment and storage medium
CN111061475B (en) Software code generating method, device, computer equipment and storage medium
CN110780939B (en) Method, device, computer equipment and storage medium for loading resource file
CN109542962B (en) Data processing method, data processing device, computer equipment and storage medium
CN111309991A (en) Query statement generation method and device and data query method and system
CN111596911A (en) Method and device for generating control, computer equipment and storage medium
CN112596708A (en) Webpage generating method and device, computer equipment and storage medium
CN110321467A (en) Airport engineering project information methods of exhibiting, device, system, equipment and medium
CN110910475A (en) Picture editing method and device, computer equipment and storage medium
CN108469977B (en) Interface data management method
CN109711809B (en) Merchant attribute setting method and device, computer equipment and storage medium
CN110727481A (en) Picture editing method and device, computer equipment and storage medium
CN114327435A (en) Technical document generation method and device and computer readable storage medium
CN110728736A (en) Picture labeling method and device, computer equipment and storage medium
CN111651969A (en) Style migration
CN110222290B (en) Page generation method and device, computer equipment and storage medium
CN112269473B (en) Man-machine interaction method and system based on flexible scene definition
CN113901033A (en) Data migration method, device, equipment and medium
CN109871214B (en) Program code generation method, program code generation device, computer device, and storage medium
CN113010128A (en) Multi-screen interaction method and system based on BIM (building information modeling)
CN110659316A (en) Data processing method, data processing device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40030741

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant