An open gl rendering enabling method, device and computing equipment

CN115390801BActive Publication Date: 2026-09-11UNIONTECH SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210957249.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2026-09-11
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

[0008]综上,上述现有的开启OpenGL渲染的技术需要在应用程序中重写控件类,将OpenGL渲染切换成非OpenGL渲染同样需要在应用程序中重写控件类,对应用程序改动大,实施成本高

Benefits of technology

[0020] The open graphics library rendering enabling method of the present invention can create a background storage agent and an open graphics library drawing device when the application calls the method. The background storage agent judges the open graphics library rendering parameters in the application and decides whether to enable the open graphics library drawing device based on the judgment result.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115390801B_ABST
    Figure CN115390801B_ABST
Patent Text Reader

Abstract

The application discloses an open method, device and computing equipment of OpenGL rendering, and relates to the technical field of GPU rendering, aiming to solve the problem that the existing rendering technology needs to rewrite control classes in an application when switching between OpenGL rendering and non-OpenGL rendering mode, and greatly changes the program. The open method of OpenGL rendering comprises the following steps: creating a background storage agent and an OpenGL drawing device; judging whether the OpenGL rendering parameters in the application meet preset conditions through the background storage agent; and when the OpenGL rendering parameters meet the preset conditions, specifying the OpenGL drawing device as a drawing device to complete the opening of the OpenGL rendering. The application does not need to modify the program code, and only needs to set relevant parameters in the application, so that seamless switching from non-OpenGL rendering to OpenGL rendering can be realized in the program running process.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of invention patent application 2022106850220, filed on June 17, 2022. Technical Field

[0002] This invention relates to the field of image rendering technology, and in particular to a method, apparatus and computing device for enabling rendering in an open graphics library. Background Technology

[0003] A Central Processing Unit (CPU) consists of several cores optimized for serial tasks, while a Graphics Processing Unit (GPU) consists of thousands of smaller, more efficient cores used to handle parallel multitasking. Therefore, GPUs are more efficient than CPUs at processing specific data in parallel. Enabling GPU rendering acceleration during window rendering can improve graphics loading speed, reduce CPU load, and increase software and desktop display frame rates.

[0004] In Qt (a cross-platform C++ graphical user interface application development framework), Qwidget (the base class for all user interface objects in Qt) uses Qwindow (a window class derived from Qwidget) to create windows. By default, it uses the platform's drawing tools to draw windows and hardware acceleration (GPU acceleration) is not enabled. On mobile or embedded platforms, this default rendering method places a more noticeable performance load on the CPU.

[0005] Currently, Qt provides the QOpenGLPaintDevice class (a drawing device for Open Graphics Library rendering). By subclassing QOpenGLWidget (an Open Graphics Library rendering control) and specifying QOpenGLPaintDevice and QOpenGL2PaintEngineEx (a drawing engine that inherits from Qpainter), GPU acceleration is enabled. This uses Open Graphics Library (OpenGL) for rendering, shifting the rendering burden to the GPU and achieving load balancing.

[0006] Qt versions 5.4 and above provide the QOpenGLWidget class. Using QOpenGLWidget as a bridge, OpenGL-rendered graphics can be displayed in the standard Qt application interface, such as... Figure 1As shown. By inheriting the QOpenGLWidget class and providing reimplementations of event handling functions and their associated OpenGL function interfaces, the controls can display OpenGL graphics. These controls can be placed in layouts, communicate with other objects using signals and slots, and operate like any other control. The class structure diagram of the controls is shown below. Figure 2 As shown, to implement the above control, a class needs to be created and named MyGLWidget. MyGLWidget inherits from QOpenGLWidget and QOpenGLFunctions (Open Graphics Library functions), while QOpenGLWidget inherits from Qwidget. If OpenGL rendering is enabled for the application, the QOpenGLWidget and MyGLWidget classes need to be overridden in the application.

[0007] The rendering process involves three key functions: the initializeGL virtual function, the paintGL virtual function, and the resizeGL virtual function. Figure 2 As can be seen, the above method of transferring QWidget to OpenGL rendering requires rewriting the control class in the application to implement the virtual function interface within the framework. After coding, it also needs to go through processes such as compilation, linking, and deployment. Furthermore, switching from OpenGL rendering to non-OpenGL rendering also requires repeating the above workflow.

[0008] In summary, the existing techniques for enabling OpenGL rendering require rewriting control classes in the application, and switching from OpenGL rendering to non-OpenGL rendering also requires rewriting control classes in the application, resulting in significant changes to the application and high implementation costs. Summary of the Invention

[0009] Therefore, the present invention provides a method, apparatus and computing device for enabling open graphics library rendering, in an attempt to solve or at least alleviate at least one of the problems mentioned above.

[0010] According to one aspect of the present invention, a method for enabling Open Graphics Library (OPL) rendering is provided, comprising the steps of: creating a background storage agent and an OPL drawing device; determining, through the background storage agent, whether the OPL rendering parameters in the application meet preset conditions; and when the OPL rendering parameters meet the preset conditions, designating the OPL drawing device as the drawing device, thereby enabling OPL rendering.

[0011] Optionally, in the open graphics library rendering enabling method according to the present invention, the step of creating a background storage agent includes: creating a platform background storage; and creating a background storage agent, wherein the background storage agent inherits from the platform background storage, and the background storage agent is capable of judging the open graphics library rendering parameters in the application that calls the open graphics library rendering enabling method, and selecting a rendering device according to the judgment result.

[0012] Optionally, in the open graphics library rendering method according to the present invention, the open graphics library rendering device inherits the Qt open graphics library rendering device.

[0013] Optionally, in the open graphics library rendering enabling method according to the present invention, the open graphics library rendering parameters include environment variables and attributes. The environment variables include a first environment variable, a second environment variable, and a third environment variable. The first environment variable is used to limit whether to use open graphics library rendering, the second environment variable is used to limit whether to use hardware acceleration, the third environment variable is used to limit whether to use graphics library rendering, and the attribute is used to limit whether to use an open graphics library drawing device.

[0014] Optionally, in the open graphics library rendering enabling method according to the present invention, the preset conditions are: the first environment variable is using open graphics library rendering or the second environment variable is using hardware acceleration, and the third environment variable is using graphics library rendering, and the attribute is using an open graphics library drawing device.

[0015] Optionally, in the open graphics library rendering enabling method according to the present invention, the step of designating the open graphics library drawing device as a drawing device includes: designating the open graphics library drawing device as a drawing device in the size reset function.

[0016] Optionally, in the open graphics library rendering enabling method according to the present invention, the method further includes: determining whether the current environment supports open graphics library rendering through the background storage agent, and performing the step of determining whether the open graphics library rendering parameters in the application meet preset conditions through the background storage agent when the determination result is yes.

[0017] According to another aspect of the present invention, an open graphics library rendering enabling device is also provided, comprising: a plug-in creation unit adapted to create a background storage agent and an open graphics library drawing device; a judgment unit adapted to determine whether the open graphics library rendering parameters in the application meet preset conditions through the background storage agent; and a rendering switching unit adapted to designate the open graphics library drawing device as a drawing device when the open graphics library rendering parameters meet the preset conditions, thereby enabling open graphics library rendering.

[0018] According to another aspect of the present invention, a computing device is also provided, comprising: at least one processor and a memory storing program instructions; when the program instructions are read and executed by the processor, the computing device causes the computing device to perform the above-described method for enabling open graphics library rendering.

[0019] According to another aspect of the present invention, a readable storage medium storing program instructions is also provided, which, when read and executed by a computing device, causes the computing device to perform the above-described method for enabling open graphics library rendering.

[0020] The open graphics library rendering enabling method of the present invention can create a background storage agent and an open graphics library drawing device when the application calls the method. The background storage agent judges the open graphics library rendering parameters in the application and decides whether to enable the open graphics library drawing device based on the judgment result.

[0021] The open graphics library rendering enabling method, apparatus, and computing device of the present invention can achieve at least one of the following beneficial effects: application developers do not need to modify the program code to reimplement the rendering method of QWidget, but only need to set the relevant parameters in the application, which greatly reduces the workload of code writing, compilation, and deployment; the background storage agent judges the relevant parameters, and when the relevant parameters meet certain conditions, the background storage agent can realize seamless switching from non-open graphics library rendering to open graphics library rendering. Attached Figure Description

[0022] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0023] Figure 1 This illustrates the interaction between the Qt platform and OpenGL according to the background technology of the present invention;

[0024] Figure 2 This illustrates the control class that needs to be rewritten to implement OpenGL rendering according to the background technology of the present invention;

[0025] Figure 3 A schematic diagram illustrating an application scenario of an open graphics library rendering method according to an embodiment of the present invention is shown.

[0026] Figure 4 A schematic diagram of a computing device 400 according to an embodiment of the present invention is shown;

[0027] Figure 5 A schematic diagram of a flowchart for plug-in initialization according to an embodiment of the present invention is shown;

[0028] Figure 6 A schematic diagram of a Qt drawing system according to an embodiment of the present invention is shown;

[0029] Figure 7 A flowchart of an open graphics library rendering enabling method 700 according to an embodiment of the present invention is shown;

[0030] Figure 8 A schematic diagram of the structure of a plug-in according to an embodiment of the present invention is shown;

[0031] Figure 9 A schematic diagram illustrating a flowchart of a background storage agent judging rendering parameters of an open graphics library and selecting a drawing device based on the judgment result, according to an embodiment of the present invention.

[0032] Figure 10 A schematic diagram illustrating a flowchart of an application using OpenGL rendering according to an embodiment of the present invention is shown;

[0033] Figure 11 A schematic diagram of the structure of an open graphics library rendering initiation device 1100 according to an embodiment of the present invention is shown. Detailed Implementation

[0034] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0035] The specific implementations of the three key virtual functions involved in the rendering process, initializeGL, paintGL, and resizeGL, are as follows.

[0036] 1. Implementation of the initializeGL virtual function

[0037]

[0038]

[0039] This function is called once before the first call to paintGL() or resizeGL(), and its main function is to set up any necessary OpenGL resources and states. Note that the framebuffer is not yet available at this time, so drawing calls should be avoided from here and deferred to paintGL().

[0040] 2. Implementation of virtual functions in PaintGL

[0041]

[0042] This function is called whenever a control needs to be drawn. Before this function is called, the context and framebuffer are bound together, and the viewport is set by calling glViewport(). The frame does not set any other state, and the function does not perform any cleanup or drawing.

[0043] 3. Implementation of the resizeGL virtual function

[0044]

[0045] This function is called whenever the control size is adjusted. The new size of the control is passed through the parameters w (width) and h (height). At this time, the frame buffer is also bound to the control size.

[0046] Existing methods for migrating QWidget to OpenGL rendering require overriding the control class in the application to implement the virtual function interface within the framework, resulting in significant application modifications and high implementation costs. To address these issues, this invention provides a method for enabling OpenGL rendering that eliminates the need to rewrite the control class in the application; instead, it only requires setting environment variables and properties within the application.

[0047] Figure 3 A schematic diagram illustrating an application scenario of an open graphics library rendering method according to an embodiment of the present invention is shown.

[0048] like Figure 3 As shown, the method for enabling Open Graphics Library (OPL) rendering provides the application with OPL rendering functionality in the form of a control. Application developers need to set environment variables and properties in the application. During application runtime, the control is loaded and run, and the control determines whether to enable OPL rendering based on the values ​​of the environment variables and properties in the application.

[0049] Figure 4 A schematic diagram of a computing device 400 according to an embodiment of the present invention is shown. It should be noted that... Figure 4 The computing device 400 shown is merely an example. In practice, the computing device used to implement the open graphics library rendering enabling method of the present invention can be any type of device, and its hardware configuration can be similar to... Figure 4 The computing device 400 shown is the same as, and can also be used with Figure 4 The computing device 400 shown is different. In practice, the open graphics library rendering enabling method of the present invention affects the operation of the system. Figure 4 The hardware components of the computing device 400 shown are dynamically loaded. This invention does not limit the specific hardware configuration of the computing device.

[0050] like Figure 4 As shown, in the basic configuration 402, the computing device 400 typically includes a system memory 406 and one or more processors 404. A memory bus 408 can be used for communication between the processors 404 and the system memory 406.

[0051] Depending on the desired configuration, processor 404 can be any type of processor, including but not limited to: microprocessor (μP), microcontroller (μC), digital information processor (DSP), or any combination thereof. Processor 404 may include one or more levels of cache such as L1 cache 410 and L2 cache 412, processor core 414, and registers 416. Example processor core 414 may include an arithmetic logic unit (ALU), floating-point unit (FPU), digital signal processing core (DSP core), or any combination thereof. Example memory controller 418 may be used with processor 404, or in some implementations, memory controller 418 may be an internal part of processor 404.

[0052] Depending on the desired configuration, system memory 406 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 406 may include operating system 420, one or more applications 422, and program data 424. In some embodiments, application 422 may be arranged to execute instructions on the operating system using program data 424 by one or more processors 404.

[0053] The computing device 400 also includes a storage device 432, which includes a removable memory 436 and a non-removable memory 438, both of which are connected to a storage interface bus 434.

[0054] The computing device 400 may also include an interface bus 440 that facilitates communication from various interface devices (e.g., output devices 442, peripheral interfaces 444, and communication devices 446) to the basic configuration 402 via a bus / interface controller 430. Example output devices 442 include an image processing unit 448 and an audio processing unit 450. They may be configured to facilitate communication with various external devices such as displays or speakers via one or more A / V ports 452. Example peripheral interfaces 444 may include a serial interface controller 454 and a parallel interface controller 456, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 458. Example communication devices 446 may include a network controller 460, which may be arranged to facilitate communication with one or more other computing devices 462 via a network communication link through one or more communication ports 464.

[0055] A network communication link can be an example of a communication medium. A communication medium can typically be embodied in a modulated data signal, such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A “modulated data signal” can be a signal whose data set, or whose modifications, can be encoded with information within the signal. As a non-limiting example, a communication medium can include wired media such as wired networks or leased lines, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term “computer-readable medium” as used herein can include both storage media and communication media.

[0056] The computing device 400 can be implemented as a server, such as a file server, database server, application server, and web server, or as a personal computer including desktop and laptop computer configurations. Of course, the computing device 400 can also be part of a small-sized portable (or mobile) electronic device. In an embodiment of the present invention, the computing device 400 is configured to execute an open-source graphics library rendering enabling method 700 according to the present invention. The application 422 of the computing device 400 includes multiple program instructions for executing the open-source graphics library rendering enabling method 700, and the program data 424 can also store various data involved in the execution of the application 422.

[0057] According to an embodiment of the present invention, a method for enabling open-source graphics library rendering (OSL) is provided to enable OSL rendering for an application in the form of a plugin. In Qt, after the application starts and before rendering, the plugin needs to be initialized. The initialization process is as follows: Figure 5 As shown. First, the plugin loader searches for the plugin file according to the specified path. If the path is invalid (e.g., the plugin file is stored in an incorrect path), the loader cannot find the plugin, and loading fails. If the path is valid, it checks whether the plugin has already been loaded. If the plugin has been loaded, it is parsed from memory. If the plugin has not been loaded, it is loaded using the loader `dlopen`, and the plugin is parsed using the parsing function `dlsystem`, recording plugin information in memory. The type of the parsed plugin file is converted to the plugin type, and the plugin reference count in the system is incremented by 1, thus completing the plugin initialization. When the application uses the content of the plugin, the loader will use `dlsystem` to find the corresponding function in the plugin and call the address of this function to complete the creation of the plugin.

[0058] Qt's drawing system is primarily based on the QPainter, QpaintEngine (drawing engine), and QPaintDevice (drawing device) classes. QPainter is the drawing tool used to perform drawing operations; QPaintDevice is an abstraction of two-dimensional space on which QPainter can be used to draw; and QPaintEngine provides the interface for Painter to draw on different types of devices. Qt's drawing system allows drawing on both screen and printing devices using the same API, such as... Figure 6As shown, the drawing device can be a subclass of QWidget, QImage (used to load image files and manipulate image data), QPixmap (a background representation of an image that can be used as a drawing device), QGLPixelBuffer (a graphics library pixel buffer), QPicture (a drawing device that can record and replay QPainter commands), QOpenGLPaintDevice, and QPrinter (a printing control). QpaintEngineEx (a drawing engine) inherits from QPaintEngine, QOpenGL2PaintEngineEx inherits from QpaintEngineEx, and classes such as Qwidget, Qimage, and QOpenGLPaintDevice inherit from QPaintDevice.

[0059] QOpenGL2PaintEngineEx provides the interface for QPainter to draw on the QOpenGLPaintDevice device. This interface provides OpenGL rendering capabilities, but QWidget, as a drawing device, defaults to non-OpenGL rendering.

[0060] According to an embodiment of the present invention, an open-source graphics library rendering enabling method 700 uses Qt5 platform plugins (i.e., qt5platform-plugins) as a bridge to enable Qwidgets to seamlessly switch from non-OpenGL rendering mode to OpenGL rendering mode.

[0061] An open graphics library rendering enabling method 700 according to an embodiment of the present invention includes the steps of: creating a background storage agent and an open graphics library drawing device; determining whether the open graphics library rendering parameters in the application meet preset conditions through the background storage agent; and when the open graphics library rendering parameters meet the preset conditions, designating the open graphics library drawing device as the drawing device to complete the enabling of open graphics library rendering.

[0062] Figure 7 A flowchart of an open graphics library rendering enabling method 700 according to an embodiment of the present invention is shown. Method 700 is executed in a computing device (e.g., the aforementioned computing device 400). Figure 7 As shown, method 700 begins with step S710.

[0063] In step S710, a backing store proxy and an OpenGL drawing device are created. For the application to enable OpenGL rendering, the plugin must first be initialized. After plugin initialization, step S710 creates the plugin, primarily two classes: a backing store proxy (DbackingStoreProxy) and an OpenGL drawing device (DOpenGLPaintDevice). The function of DOpenGLPaintDevice is to implement OpenGL rendering, while the main function of the backing store proxy is to determine certain parameters in the application in subsequent steps and enable or disable DOpenGLPaintDevice based on the determination results.

[0064] According to one implementation, the steps for creating a background storage proxy include: creating a platform background storage; and creating a background storage proxy that inherits from the platform background storage. The background storage proxy is capable of determining the rendering parameters of the open-source graphics library in the application calling method 700 and selecting the rendering device based on the determination result. Figure 8 As shown, the plugin created in the above implementation mainly includes three classes: QplatformBackingStore, DbackingStoreProxy, and DOpenGLPaintDevice. DbackingStoreProxy inherits from QplatformBackingStore, and DOpenGLPaintDevice inherits from QOpenGLPaintDevice in Qt5. DOpenGLPaintDevice is the drawing device used for OpenGL rendering.

[0065] Next, in step S720, the background storage agent determines whether the rendering parameters of the open graphics library in the application meet the preset conditions.

[0066] Next, in step S730, when the rendering parameters of the open graphics library meet the preset conditions, the open graphics library drawing device is designated as the drawing device to complete the opening of the open graphics library rendering.

[0067] Method 700 can be implemented only if the application sets open-source graphics library rendering parameters, which are used to limit whether the application uses OpenGL rendering.

[0068] According to one implementation, the Open Graphics Library (OPL) rendering parameters include environment variables and attributes. The environment variables include a first environment variable `D_NO_OPENGL`, a second environment variable `D_NO_HARDWARE_ACCELEATION`, and a third environment variable `D_USE_GL_PAINT`. The attribute `_d_enableGLPaint` refers to the property of the `QWindow` object. Specifically, the first environment variable determines whether to use OPL rendering, the second environment variable determines whether to use hardware acceleration, the third environment variable determines whether to use graphics library rendering, and the attribute `_d_enableGLPaint` determines whether to use an OPL drawing device. The preset conditions can be: the first environment variable is set to use OPL rendering, or the second environment variable is set to use hardware acceleration, and the third environment variable is set to use graphics library rendering, and the attribute is set to use an OPL drawing device.

[0069] In one embodiment, the first environment variable has a value of 0 or 1, where 0 indicates using open-source graphics library rendering and 1 indicates not using open-source graphics library rendering; the second environment variable has a value of 0 or 1, where 0 indicates using hardware acceleration and 1 indicates not using hardware acceleration; the third environment variable has a value of 0 or 1, where 0 indicates not using graphics library rendering and 1 indicates using graphics library rendering; the attribute value is true or false, where true indicates using an open-source graphics library rendering device and false indicates not using an open-source graphics library rendering device. The process by which the background storage agent judges the open-source graphics library rendering parameters and selects the rendering device based on the judgment result is as follows: Figure 9 As shown: First, the first environment variable and the second environment variable are judged. If either the first environment variable or the second environment variable has a value of 1, then OpenGL rendering is turned off. When the values ​​of the first environment variable and the second environment variable are both 0, the third environment variable is judged. If the value of the third environment variable is 0, then OpenGL rendering is turned off. If the value of the third environment variable is 1, the attribute is further judged. If the attribute value is false, then OpenGL rendering is turned off. If the attribute value is true, then the DOpenGLPaintDevice created in step S710 is designated as the drawing device, that is, OpenGL rendering is enabled. The specific method of designating DOpenGLPaintDevice as the drawing device can be to set the drawing device PaintDevice to DOpenGLPaintDevice in the size resize function resize.

[0070] In summary, the background storage proxy of this invention adds a switch function to the platform's background storage. It determines whether to start OpenGL rendering by judging relevant parameters in the application. This switch function disables OpenGL rendering by default to avoid affecting the compatibility of the Qt library. Furthermore, this switch function will not be enabled if the current environment does not support OpenGL.

[0071] The ability to enable / disable OpenGL rendering via the background storage proxy can be implemented using the following code:

[0072]

[0073] The code above first determines whether the current environment supports OpenGL rendering. If the current environment supports OpenGL rendering, it checks whether the first and second environment variables meet the conditions for enabling OpenGL rendering; otherwise, it disables OpenGL rendering. If the first and second environment variables meet the conditions for enabling OpenGL rendering, it checks whether the third environment variable meets the conditions for enabling OpenGL rendering. If the third environment variable meets the conditions for enabling OpenGL rendering, it checks whether the attribute meets the conditions for enabling OpenGL rendering. If the attribute meets the conditions for enabling OpenGL rendering, it enables OpenGL rendering.

[0074] The complete process of an application using OpenGL rendering is as follows: Figure 10 As shown. After the application starts, it begins to initialize the plugin; then it queries the state of the platform's default window. The query method can use various existing methods or the plugin of this embodiment of the invention to query. The window state includes maximized, minimized, full-screen, and active; then it creates a new QWidget window, creates the platform background storage, background storage proxy, and open graphics library drawing device in the plugin, enables OpenGL rendering, and finally displays the image in the QWidget window according to the window state.

[0075] The method 700 of this invention can be implemented as a plugin. Within the Qt framework, the qt5platform-plugins platform plugin is implemented by subclassing QplatformIntegrationPlugin. Within the Qt rendering system framework, the DOpenGLPaintDevice and DBackingStoreProxy classes are implemented in the plugin, seamlessly migrating the Qwidget rendering method from non-OpenGL to OpenGL rendering. By loading the plugin upon program startup, the backend storage proxy, acting as the backend, determines the Qwidget rendering method based on relevant environment variables and properties. Application developers do not need to modify the code to reimplement the Qwidget rendering method; they only need to set the relevant environment variables and properties in the application, greatly reducing the workload of code writing, compilation, and deployment. Method 700 supports hardware acceleration when using QPainter within Qwidgets (including child widgets).

[0076] Embodiments of the present invention also provide an open-source graphics library rendering enabling device 1100, which is capable of performing the steps of the open-source graphics library rendering enabling method 700 as described above. Below, in conjunction with... Figure 11 The above-mentioned open graphics library rendering start device 1100 is described.

[0077] like Figure 11 As shown, the open graphics library rendering start device 1100 includes a plug-in creation unit 1110, a judgment unit 1120 and a rendering switching unit 1130.

[0078] The plug-in creation unit 1110 is suitable for creating background storage agents and open graphics library drawing devices.

[0079] The judgment unit 1120 is adapted to determine whether the rendering parameters of the open graphics library in the application meet the preset conditions through the background storage agent.

[0080] The rendering switching unit 1130 is adapted to designate the open graphics library drawing device as the drawing device when the rendering parameters of the open graphics library meet the preset conditions, thereby enabling the rendering of the open graphics library.

[0081] According to one implementation of the present invention, the plug-in creation unit 1110 creates a background storage agent through the following steps: creating a platform background storage; and creating a background storage agent, wherein the background storage agent inherits from the platform background storage, and the background storage agent is able to determine the open graphics library rendering parameters in the application that calls the open graphics library rendering start method, and select a drawing device according to the determination result.

[0082] According to one implementation of the present invention, the open graphics library rendering device inherits the Qt open graphics library rendering device.

[0083] According to one implementation of the present invention, the open graphics library rendering parameters include environment variables and attributes. The environment variables include a first environment variable, a second environment variable, and a third environment variable. The first environment variable is used to limit whether to use open graphics library rendering, the second environment variable is used to limit whether to use hardware acceleration, and the third environment variable is used to limit whether to use graphics library rendering. The attributes are used to limit whether to use an open graphics library drawing device.

[0084] According to one implementation of the present invention, the preset conditions are: the first environment variable is rendering using an open graphics library or the second environment variable is hardware acceleration, and the third environment variable is rendering using a graphics library, and the attribute is drawing device using an open graphics library.

[0085] According to one implementation of the present invention, the rendering switching unit designates the open graphics library drawing device as the drawing device through the following steps: in the size reset function, the open graphics library drawing device is designated as the drawing device.

[0086] According to one implementation of the present invention, the open graphics library rendering enabling device 1100 further includes an environment judgment unit. The environment judgment unit is adapted to determine whether the current environment supports open graphics library rendering through a background storage agent, and when the judgment result is yes, execute the step of determining whether the open graphics library rendering parameters in the application meet the preset conditions through the background storage agent.

[0087] The open graphics library rendering enabling device 1100 of this embodiment can execute the steps of the open graphics library rendering enabling method 700 of this embodiment and can achieve the same technical effect as method 700. The principle will not be repeated here.

[0088] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.

[0089] When the program code is executed on a programmable computer, the computing device generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the open-source graphics library rendering method of the present invention according to instructions in the program code stored in the memory.

[0090] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.

[0091] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing preferred embodiments of the invention.

[0092] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0093] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more aspects of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Those skilled in the art will understand that modules, units, or components of the devices in the examples disclosed herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or further divided into multiple sub-modules.

[0094] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0095] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments. Additionally, some of the embodiments described herein are described as methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the method or method elements forms means for implementing the method or method elements. Furthermore, the elements described herein in the device embodiments are examples of means for implementing the functions performed by elements for the purposes of carrying out the invention.

[0096] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.

[0097] Although the invention has been described with respect to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of explaining or limiting the subject matter of the invention.

Claims

1. A method for enabling rendering in an open-source graphics library, comprising the following steps: Create a background storage agent and an open graphics library drawing device; The background storage agent determines whether the rendering parameters of the open graphics library in the application meet the preset conditions. as well as When the rendering parameters of the open graphics library meet the preset conditions, the open graphics library drawing device is designated as the drawing device to complete the opening of the open graphics library rendering. The open graphics library rendering parameters include environment variables and attributes. The environment variables include a first environment variable, a second environment variable, and a third environment variable. The first environment variable is used to limit whether to use open graphics library rendering. The second environment variable is used to limit whether to use hardware acceleration. The third environment variable is used to limit whether to use graphics library rendering. The attribute is used to limit whether to use open graphics library drawing device. The preset conditions are: the first environment variable is rendering using an open graphics library or the second environment variable is hardware acceleration, the third environment variable is rendering using a graphics library, and the attribute is a drawing device using an open graphics library.

2. The method of Claim 1, wherein, The steps to create a backend storage agent include: Create platform backend storage; and A background storage proxy is created, which inherits from the platform's background storage. The background storage proxy is able to determine the open graphics library rendering parameters in the application that calls the open graphics library rendering start method, and select the rendering device based on the determination result.

3. The method of Claim 1 or 2, wherein, The open graphics library rendering device is inherited from the Qt open graphics library rendering device.

4. The method of Claim 1, wherein, The step of designating the open graphics library rendering device as the rendering device includes: In the size reset function, specify the open graphics library drawing device as the drawing device.

5. The method for enabling open-source graphics library rendering as described in claim 1 further includes: The background storage agent determines whether the current environment supports open graphics library rendering, and if the determination result is yes, the step of determining whether the open graphics library rendering parameters in the application meet the preset conditions is executed.

6. An open-source graphics library rendering initiation device, comprising: The plugin creation unit is suitable for creating background storage agents and open-source graphics library drawing devices; The judgment unit is adapted to determine whether the rendering parameters of the open graphics library in the application meet preset conditions through the background storage agent; as well as The rendering switching unit is adapted to designate the open graphics library drawing device as the drawing device when the rendering parameters of the open graphics library meet the preset conditions, so as to start the rendering of the open graphics library. The open graphics library rendering parameters include environment variables and attributes. The environment variables include a first environment variable, a second environment variable, and a third environment variable. The first environment variable is used to limit whether to use open graphics library rendering. The second environment variable is used to limit whether to use hardware acceleration. The third environment variable is used to limit whether to use graphics library rendering. The attribute is used to limit whether to use open graphics library drawing device. The preset conditions are: the first environment variable is rendering using an open graphics library or the second environment variable is hardware acceleration, the third environment variable is rendering using a graphics library, and the attribute is a drawing device using an open graphics library.

7. A computing device, comprising: At least one processor and a memory storing program instructions; When the program instructions are read and executed by the processor, the computing device performs the open graphics library rendering method as described in any one of claims 1-5.

8. A readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform an open graphics library rendering method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Management of L-Shaped Swim Lanes of Variable Heights and Widths in a Graphical Editor Used to Represent Multiple Asynchronous Process in the Same View

    US20200110583A1

  • Method and apparatus for rendering image

    US20210209837A1