WO2018050003A1 - 3d canvas web page element rendering method and apparatus, and electronic device - Google Patents

3d canvas web page element rendering method and apparatus, and electronic device Download PDF

Info

Publication number
WO2018050003A1
WO2018050003A1 PCT/CN2017/100536 CN2017100536W WO2018050003A1 WO 2018050003 A1 WO2018050003 A1 WO 2018050003A1 CN 2017100536 W CN2017100536 W CN 2017100536W WO 2018050003 A1 WO2018050003 A1 WO 2018050003A1
Authority
WO
WIPO (PCT)
Prior art keywords
canvas
rendering
instruction
webpage element
opengl
Prior art date
Application number
PCT/CN2017/100536
Other languages
French (fr)
Chinese (zh)
Inventor
黄刚
潘华
李�杰
胡吉嵩
Original Assignee
阿里巴巴集团控股有限公司
黄刚
潘华
李�杰
胡吉嵩
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 阿里巴巴集团控股有限公司, 黄刚, 潘华, 李�杰, 胡吉嵩 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2018050003A1 publication Critical patent/WO2018050003A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present application relates to the field of mobile Internet technologies, and in particular, to a method, an apparatus, and an electronic device for rendering a 3D canvas webpage element.
  • the application also relates to a method, a device and an electronic device for rendering a 2D canvas webpage element.
  • HTML5 development is getting hotter and hotter.
  • HTML5 development has the advantages of cross-platform, low development cost, fast iteration, and easy dynamic release. It has a larger and larger proportion in mobile app development.
  • Canvas element plays an indispensable role in mobile development page display, especially in image processing and animation display.
  • HTML5's 3D canvas relies on the system Webview to complete the rendering, which depends on whether the system Webview supports the WebGL interface.
  • WebGL is a 3D drawing standard that allows JavaScript and OpenGL ES 2.0 to be combined. By adding a JavaScript binding to OpenGL ES 2.0, WebGL can provide hardware 3D accelerated rendering for HTML5 Canvas, so that Web developers You can use the system graphics card to more smoothly display 3D scenes and models in the browser, as well as create complex navigation and data visualization.
  • the WebGL technology standard eliminates the hassle of developing web-specific rendering plug-ins, can be used to create website pages with complex 3D structures, and can even be used to design 3D web games.
  • WebGL in HTML5's 3D canvas is not supported until Android 5.0 and iOS 8.0, and the supported version is only WebGL 1.1, not the latest WebGL 2.0.
  • the prior art has some problems that the mobile operating system does not support WebGL rendering.
  • the present application provides a method, a device, and an electronic device for rendering a 3D canvas webpage element to solve the problem that a part of the mobile operating system does not support WebGL rendering in the prior art.
  • the application also provides a method, a device and an electronic device for rendering a 2D canvas webpage element.
  • the application provides a rendering method of a 3D canvas webpage element, including:
  • the OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • intercepting the WebGL drawing instruction for the 3D canvas webpage element is as follows:
  • the WebGL drawing instruction is intercepted by the replacement DOM object of the 3D canvas webpage element.
  • it also includes:
  • the DOM object of the 3D canvas webpage element is replaced with the replacement DOM object.
  • the method before the replacing the DOM object of the 3D canvas webpage element with the replacement DOM object, the method further includes:
  • the transmitting the instruction information carried by the WebGL drawing instruction to the system framework layer includes:
  • the rendering command is passed from the system framework layer.
  • the instruction information carried by the WebGL drawing instruction is transmitted to the system framework layer by using the following manner:
  • the instruction information is transmitted to the system framework layer via a JS bridge or a JavaScript engine.
  • the instruction information carried by the WebGL drawing instruction is transmitted to the system framework layer by using the following manner:
  • the instruction information is transmitted to the system framework layer according to a preset time interval.
  • the generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction includes:
  • the OpenGL drawing instruction is generated according to the instruction information.
  • the drawing the OpenGL drawing instruction to the OpenGL rendering window of the system includes:
  • the rendering target is input to an offscreen buffer of the system.
  • the inputting the rendering target to the off-screen buffer of the system is as follows:
  • a plurality of the rendering targets are synthesized into the off-screen buffer by FBO technology; different rendering targets correspond to different 3D canvas webpage elements.
  • the method before the acquiring the context information corresponding to the 3D canvas element and the rendering target, the method further includes:
  • Determining whether the context information and the rendering target are present if not, creating the context information and the rendering target, and binding the context information and the rendering target.
  • it also includes:
  • the OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 3D canvas webpage element is located.
  • the synthesizing the OpenGL rendering window and the webview window of the system are as follows:
  • the OpenGL rendering window and the Webview window are mixed by a window management mechanism of the system.
  • the non-3D canvas webpage element in the webpage is drawn in the webview window.
  • the system includes an Andriod system or an iOS system.
  • the present application further provides a rendering device for a 3D canvas webpage element, including:
  • a WebGL instruction intercepting unit for intercepting a WebGL drawing instruction for a 3D canvas webpage element
  • a WebGL instruction transfer unit configured to transfer instruction information carried by the WebGL drawing instruction to a system framework layer
  • An OpenGL instruction generating unit configured to generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information
  • An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • the WebGL instruction intercepting unit is specifically configured to intercept the WebGL drawing instruction by using a replacement DOM object of the 3D canvas webpage element.
  • the WebGL instruction delivery unit includes:
  • An instruction information extraction subunit configured to extract the instruction information from the WebGL drawing instruction
  • a rendering command generating subunit configured to generate a rendering command corresponding to the WebGL drawing instruction according to the first preset instruction conversion rule and the instruction information
  • a rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  • the OpenGL instruction generating unit includes:
  • An instruction information transmitting subunit configured to transfer the instruction information from the system framework layer to a system local layer
  • the OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the local layer of the system.
  • an electronic device including:
  • a program for storing a rendering method for implementing a 3D canvas webpage element After the device is powered on and runs the program of the rendering method of the 3D canvas webpage element by the processor, the following steps are performed: intercepting the 3D canvas webpage element a WebGL drawing instruction; transmitting instruction information carried by the WebGL drawing instruction to a system framework layer; generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and drawing the OpenGL drawing instruction to a system OpenGL Rendering a window to form a rendering result of the 3D canvas webpage element.
  • the present application further provides a method for rendering a 2D canvas webpage element, including:
  • the OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • intercepting the WebGL drawing instruction for the 2D canvas webpage element is as follows:
  • Drawing instructions of the 2D canvas webpage element are intercepted by the replacement DOM object of the 2D canvas webpage element.
  • the transmitting the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer including:
  • the rendering command is passed from the system framework layer.
  • the generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element includes:
  • the OpenGL drawing instruction is generated according to the instruction information.
  • the drawing the OpenGL drawing instruction to the OpenGL rendering window of the system includes:
  • the rendering target is input to an offscreen buffer of the system.
  • it also includes:
  • the OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 2D canvas webpage element is located.
  • the present application further provides a rendering apparatus for a 2D canvas webpage element, including:
  • An instruction intercepting unit configured to intercept a drawing instruction for a 2D canvas webpage element
  • An instruction transmitting unit configured to transmit instruction information carried by the drawing instruction of the 2D canvas webpage element to a system framework layer
  • An OpenGL instruction generating unit configured to generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information
  • An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • the instruction intercepting unit is configured to intercept a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
  • the instruction transmission unit includes:
  • An instruction information extraction subunit configured to extract the instruction information from a drawing instruction of the 2D canvas webpage element
  • a rendering command generating subunit configured to generate a rendering command corresponding to the drawing instruction of the 2D canvas webpage element according to the first preset instruction conversion rule and the instruction information
  • a rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  • the OpenGL instruction generating unit includes:
  • An instruction information transmitting subunit configured to transfer the instruction information from the system framework layer to a system local layer
  • An OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the system local layer.
  • an electronic device including:
  • a program for storing a rendering method for implementing a 2D canvas webpage element After the device is powered on and runs the program of the rendering method of the 2D canvas webpage element by the processor, the following steps are performed: intercepting the 2D canvas webpage element a drawing instruction; transmitting instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer; and generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; The drawing instructions are drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas web page element.
  • the method provided by the present application intercepts a WebGL drawing instruction for a 3D canvas webpage element; transmits instruction information carried by the WebGL drawing instruction to a system framework layer; and generates and coordinates according to the instruction information.
  • An OpenGL drawing instruction corresponding to the WebGL drawing instruction; the OpenGL drawing instruction is drawn to an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • the intercepted instruction information carried by the WebGL drawing instruction for the 3D canvas webpage element is transmitted from the client script layer to the system framework layer, and corresponding to the WebGL drawing instruction according to the instruction information.
  • OpenGL drawing instructions then draw OpenGL drawing instructions into the system's OpenGL rendering window to form the rendering result of the 3D canvas web page elements; this way, avoid using the system Webview to render the 3D canvas web page elements; therefore, can improve the movement
  • HTML5 3D Canvas in web applications enables applications in mobile devices that do not support WebGL or support WebGL to be animated using WebGL.
  • the rendering method of the 3D canvas webpage element provided by the present application fully removes the dependence on the operating system by introducing the JavaScript bridge layer and the system framework layer, and is compatible with the existing released mobile operating system, and has strong compatibility, so that Achieve cross-platform technical effects.
  • FIG. 1 is a flowchart of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application
  • FIG. 2 is a schematic structural diagram of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application
  • FIG. 3 is a specific flowchart of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application
  • FIG. 4 is a schematic diagram of an embodiment of a rendering apparatus for a 3D canvas webpage element provided by the present application
  • FIG. 5 is a schematic diagram of an embodiment of an electronic device provided by the present application.
  • FIG. 6 is a flowchart of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application
  • FIG. 7 is a schematic structural diagram of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application.
  • FIG. 8 is a specific flowchart of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application
  • FIG. 9 is a schematic diagram of an embodiment of a rendering device of a 2D canvas webpage element provided by the present application.
  • FIG. 10 is a schematic diagram of an embodiment of an electronic device provided by the present application.
  • the basic idea of the rendering method of the 3D canvas webpage element is: intercepting the WebGL drawing instruction of the 3D canvas webpage element, and transmitting the instruction information carried by the intercepted WebGL drawing instruction from the client script layer to the system framework. Layer, and according to the instruction information, obtain the OpenGL drawing instruction corresponding to the WebGL drawing instruction, and then draw the OpenGL drawing instruction into the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • FIG. 1 is a flowchart of an embodiment of a method for rendering a 3D canvas webpage element of the present application.
  • the method includes the following steps:
  • Step S101 intercepting a WebGL drawing instruction for the 3D canvas webpage element.
  • the canvas tag appears in HTML5.
  • the canvas element is a rectangular area that controls each pixel in it.
  • the canvas element itself has no drawing capabilities, and all drawing work must be done inside JavaScript, ie the canvas element uses JavaScript to draw an image on a web page.
  • WebGL is a set of 3D graphics API based on OpenGL ES 2.0 that allows 3D rendering to be implemented in web pages using OpenGL-like WebGL.
  • WebGL perfectly solves two problems of existing Web interactive 3D animation: First, it implements Web interactive 3D animation through HTML script itself, without any browser plug-in support; Second, it utilizes the underlying graphics. Graphics rendering with hardware acceleration is achieved through a unified, standard, cross-platform OpenGL interface.
  • WebGL's graphics API is used by the HTML 5 3D canvas tag.
  • This application refers to a drawing operation instruction for a 3D canvas webpage element in a JavaScript code, which is called a WebGL drawing instruction.
  • the JavaScript drawing code for the element Can be as follows:
  • Var c document.getElementById("myCanvas");
  • JavaScript uses the id to find the canvas element, and then creates the context object.
  • the getContext("3d") object is a built-in HTML5 object with a variety of methods for drawing 3D graphics; among them, cxt.fillRect(0, The 0, 150, 75) instruction is a WebGL drawing instruction; through the above code, a red rectangle can be drawn in the canvas element.
  • the 3D canvas webpage element is drawn through the webview window of the system; and the method provided by the present application intercepts the WebGL drawing instruction of the 3D canvas webpage element, and draws the 3D canvas webpage element in the system. OpenGL rendering in the window.
  • the method provided by the present application does not limit the interception manner of the WebGL drawing instruction, and the WebGL drawing instruction for the 3D canvas webpage element can be intercepted by any technique.
  • the step may be implemented by intercepting the WebGL drawing instruction by replacing the DOM object of the 3D canvas webpage element.
  • the DOM (Document Object Model) of the webpage where the 3D canvas webpage element is located includes a DOM object corresponding to the 3D canvas webpage element, and the DOM can be accessed through JavaScript (and other programming languages).
  • the replacement DOM object refers to a replacement object of the DOM object of the 3D canvas webpage element.
  • the DOM object of the 3D canvas webpage element in the DOM tree of the webpage where the 3D canvas webpage element is located needs to be replaced with the replacement DOM object.
  • the 3D canvas webpage element may be first obtained by the getElementById(id) method, and then the replacement DOM object of the 3D canvas webpage element is inserted by the appendChild(node) method, and the replacement DOM object may be a customized sub-object. Node, and finally, remove the 3D canvas page element by the removeChild(node) method.
  • the WebGL drawing instruction for the 3D canvas webpage element can be intercepted by replacing the DOM object.
  • the method before the replacing the DOM object of the 3D canvas webpage element with the replacement DOM object, the method further includes: determining whether the operating system allows an operation of performing DOM object replacement; If the result of the determination is yes, the step of replacing the DOM object of the 3D canvas webpage element with the replacement DOM object is performed; otherwise, the 3D canvas webpage element is drawn using a Webview window.
  • the 3D canvas webpage element can be drawn through the default Webview window of the system, thereby improving the user.
  • the setting process that does not allow DOM object replacement is performed in advance in order to ensure the security of the operating system
  • the next step is taken to transfer the instruction information carried by the intercepted WebGL drawing instruction from the client script layer to the system framework layer.
  • Step S103 Transfer the instruction information carried by the WebGL drawing instruction to the system framework layer.
  • the instruction information carried by the WebGL drawing instruction includes, but is not limited to, an instruction name and an instruction parameter.
  • the drawCircle 200, 300, 5) is a name of the instruction carried by the WebGL drawing instruction, and the instruction parameter is: the x coordinate is 200.
  • the y coordinate is 300 and the radius is 5.
  • the instruction information carried by the WebGL drawing instruction may be transmitted from the client script layer to the system framework layer in a form of directly transmitting the instruction information, and the following preferred solution may also be adopted as a specific implementation.
  • the step S103 may include the following specific steps: 1) extracting the instruction information from the WebGL drawing instruction; 2) generating a UI according to the first preset instruction conversion rule and the instruction information. a rendering command corresponding to the WebGL drawing instruction; 3) transmitting the rendering command to the system framework layer.
  • the various instruction information may be spliced according to the first preset instruction conversion rule to form a preset form of the rendering command (ie, the normalized expression form of the instruction information), and then the third step is used to render
  • the command form transfers the instruction information from the client script layer to the system framework layer; this processing method makes it easy for the subsequent links to parse the command, and then obtains the OpenGL drawing instruction corresponding to the WebGL drawing instruction.
  • a GCanvas class is set, and the class includes the instruction conversion program code corresponding to the second step described above as follows:
  • the drawing instruction of WebGL is: WebGLRenderingContext.uniform4f(location, x, y, z, w).
  • the instruction is converted into a rendering command (command string): "17, 3, 100, 200, 300, 400;”; where “17” refers to the instruction ID of the uniform4f method in GCanvas, “3” refers to the ID of the location object, "100, 200, 300” represents the position "x, y, z", “400” Represents the width "w", the comma ",” is a variable separator in GCanvas, and the semicolon ";” indicates the command terminator in GCanvas.
  • the client script layer may include the following functions: 1) finding whether there is a replaceable 3D canvas element in the HTML5 page, and if it can be successfully replaced, a new replacement DOM object is inserted into the original DOM tree, and the original The 3D canvas element is deleted, all subsequent calls and operations on the original 3D canvas element will be hosted by the newly inserted DOM object; 2) the WebGL drawing instruction for the original 3D canvas webpage element is intercepted, and the instruction information carried by the drawing instruction is The client script layer is passed to the system framework layer.
  • the client script layer is further configured to respond to a user's interaction instruction to a webpage element, a response callback function, calculate a size and location of a canvas webpage element, and layer management of a plurality of canvas webpage elements.
  • the system framework layer refers to an application framework layer that uses an operating system native language development program.
  • the system framework layer is a program layer developed by the Java language
  • the system framework layer is the program layer developed by the Object-C language.
  • the instruction information may be transmitted from the client script layer to the system framework layer in a real-time manner.
  • this method requires a rendering process of the system frame layer for each intercepted instruction, this processing method has a problem of degrading system performance.
  • the step may be implemented by transmitting the instruction information from the client script layer to the system framework layer according to a preset time interval. In this way, a certain image frame rate can be guaranteed, thereby satisfying the user's visual experience and avoiding degrading system performance.
  • the instruction information is transmitted to the system framework layer through a JS bridge or a JavaScript engine.
  • the interaction between the JavaScript code and the system framework layer code can be implemented, thereby transferring the instruction information from the client script layer to the system framework layer.
  • the V8 engine may be employed when the method of the present application is applied to the Android system; the JavaScriptCore engine may be employed when the method of the present application is applied to the iOS system.
  • an adaptation plug-in of the JS bridge needs to be implemented in the system framework layer, and the adaptation plug-in is used to receive the JS bridge to be passed to the JS bridge.
  • the method provided by the present application fully removes the dependence on the operating system by introducing a JavaScript bridging layer and a system framework layer, and is compatible with the existing released mobile operating system, and has strong compatibility, thereby achieving Cross-platform technical effects.
  • Step S105 Generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information.
  • This step generates an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the received instruction information.
  • the original WebGL drawing instruction can be finally converted into a corresponding OpenGL drawing instruction.
  • the Android system framework layer provides two classes for application development to implement support for the 3D graphics API OpenGL ES, namely GLSurfaceView and GLSurfaceView.Renderer; through these two interface classes, you can develop 3D graphics based on OpenGL ES.
  • this embodiment has the problem of low rendering efficiency.
  • this step and the next step can be implemented in the local layer of the system (for example, NDK of the Android system, Native Development Kit).
  • the system local layer is also known as the C++ engine layer.
  • This method is similar to the above method. Taking the Android system as an example, the difference between the method and the above method is mainly: the implementation part of the GLSurfaceView.Renderer is implemented locally, and then the communication between the Java end and the C end is realized through the JNI.
  • this step and the next step are implemented at the local layer of the system.
  • the first step is to transfer the instruction information from the system framework layer to the system local layer, and then, in the system local layer, generate the OpenGL drawing instruction according to the instruction information. Higher rendering performance can be achieved by generating and executing the OpenGL drawing instructions at the system local level.
  • the step S105 may be implemented by: generating the OpenGL drawing instruction according to the second preset instruction conversion rule and the instruction information.
  • the second preset instruction conversion rule is related to the first preset instruction conversion rule, and converts the WebGL drawing instruction into a rendering command according to the first preset instruction conversion rule; according to the second preset instruction, The instruction information in the form of a rendering command is converted into an OpenGL drawing instruction corresponding to the WebGL drawing instruction.
  • the client-side script layer converts the WebGL drawing instruction into a rendering command "B, 1", which is passed to the system local layer (C++ engine layer) after being passed through the system framework layer, and is processed by the following code:
  • the instruction is the OpenGL drawing instruction that the WebGL drawing instruction actually corresponds to.
  • Step S107 Drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • the OpenGL drawing instruction generated in the previous step is drawn into the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • the OpenGL rendering window for drawing OpenGL drawing instructions to the system is a public technical technique in the technical field, and the present application does not limit the specific drawing manner.
  • An optional specific implementation method is given below.
  • the step may include the following steps: 1) acquiring context information and a rendering target corresponding to the 3D canvas webpage element; 2) performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction. ; 3) Input the render target into the off-screen buffer of the system.
  • the system local layer needs to have the following functions: 1) create, manage, and destroy the 3D canvas entity and the context entity of the 3D canvas, wherein The context entity stores the context information of the canvas element, the canvas entity holds the attribute information of the canvas element, and 2) manages the rendering of different canvas elements to the render target of the render layer; ) Combine multiple render targets into off-screen render buffers via FBO techniques in OpenGL.
  • the render target is a surface, and the graphics API can "draw" things up.
  • the render target is a contiguous memory area. Such a memory area can exist multiple times at the same time, that is, multiple render targets.
  • different 3D canvas webpage elements correspond to different rendering targets.
  • the context information and the rendering target are generated when the 3D canvas webpage element is drawn for the first time. Therefore, before the acquiring the context information corresponding to the 3D canvas element and the rendering target, the method further includes: determining the location Descriptive context information and whether the rendering target exists; if not, the context information and the rendering target need to be created, and the context information and the rendering target are bound.
  • the 3D canvas element, the context information, and the render target are associated by binding the newly created context information to the render target.
  • the present step After the context information and the rendering target corresponding to the 3D canvas webpage element are obtained, the present step performs graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction generated in step S105 to form a rendering result of the 3D canvas webpage element.
  • the canvas context entity invokes an API corresponding to the renderer according to the generated OpenGL drawing instruction, and the renderer calls the corresponding OpenGL ES API and renders the result to the rendering target.
  • GPU screen rendering can be done in two ways: 1) current screen rendering (On-Screen Rendering); 2) off-screen rendering.
  • the current screen rendering means that the GPU performs a rendering operation in the screen buffer currently used for display; off-screen rendering means that the GPU newly opens a buffer for rendering operations outside the current screen buffer.
  • this step uses the off-screen rendering mode to input the rendered rendering target into the off-screen buffer of the system.
  • the input of the rendering target to the offscreen buffer of the system may be as follows: FBO (Frame Buffer)
  • FBO Framework Buffer
  • the rendering effect of the canvas page element's rendering effect is blended together.
  • the data of the off-screen buffer needs to be copied to the OpenGL rendering window of the system framework layer (for example, in the GlSurfaceView of the Android system, the system framework layer synthesizes the OpenGL rendering window and the Webview window of the system to form an overall rendering effect of the webpage where the 3D canvas webpage element is located.
  • the system framework layer synthesizes the OpenGL rendering window and the Webview window of the system to form an overall rendering effect of the webpage where the 3D canvas webpage element is located.
  • the OpenGL rendering window and the Webview window may be mixed by a window management mechanism of the system.
  • the non-3D canvas webpage element in the webpage is drawn in the webview window.
  • HybridViewController class inherited from ViewController
  • WebView and GCanvasView are added to the ViewGroup of the original element, and some of the source code is as follows:
  • the traditional method uses WebView to render 3D canvas webpage elements, and the method provided by the present application first renders the animation content of the 3D canvas webpage element in the OpenGL rendering window of the system, and then opens the OpenGL rendering window and the WebView. Window fusion, the overall rendering effect of the web page.
  • FIG. 2 is a schematic structural diagram of an embodiment of a method for rendering a 3D canvas webpage element of the present application.
  • the rendering method of the 3D canvas webpage element of the present application has a four-layer structure, namely: a JavaScript hosting module layer, a bridge module layer, an operating system adaptation module layer, and an engine module layer. These levels are briefly described below.
  • JavaScript escrow module layer mainly used to host HTML5 3D canvas API (WebGL drawing instruction) and implement this scheme for these APIs.
  • the functions of this layer include but are not limited to: canvas element replacement, rendering instruction splicing and passing, interactive instruction Response, response of the callback function, calculation of the size and position of the canvas element, layer management of multiple canvases, etc.
  • Bridge module layer mainly used for JavaScript and operating system layer (ie: the above system frame layer) code (android: Java / iOS: OC) to interact, there are two ways to achieve JavaScript and the underlying code interaction, respectively : JS bridge, JS engine.
  • operating system adaptation module layer mainly used to implement a custom rendering window (ie: the above OpenGL rendering window), the custom rendering window is used to display the rendering output of the HTML5 3D canvas; and, manage multiple windows Use (custom rendering windows and rendering windows for other HTML5 elements) to synthesize the final rendering results.
  • the JS bridge scheme is used in the upper layer (bridge module layer)
  • the JS bridge adapter plugin is also needed to receive the interaction or rendering instructions passed by the JS bridge to the system layer. And process or forward as needed.
  • Engine module layer The system local layer is mainly used to create, manage, and destroy the canvas entity (entity) and the canvas 3d context entity.
  • the corresponding OpenGL ES API is called according to the received rendering instruction.
  • this layer it is also responsible for managing rendering targets that are rendered to multiple render layers for different canvases.
  • multiple rendering targets are synthesized into off-screen rendering buffers by FBO technology in OpenGL.
  • FIG. 3 is a specific flowchart of an embodiment of a method for rendering a 3D canvas webpage element of the present application.
  • the flowchart shown in FIG. 3 corresponds to the specific processing procedure of the foregoing solution, and the processing procedure of the foregoing scheme can be more intuitively understood in conjunction with FIG. 3.
  • the specific flow chart shown in FIG. 3 will be briefly described below with reference to FIG.
  • the synthesizer After receiving the command, parse it to get the corresponding 3D canvas context (if not new); the synthesizer gets a render target (created if not) and assigns it to the 3D canvas context; it is called by the 3D canvas context based on the parsed command result
  • the renderer corresponds to the API, the renderer calls the corresponding OpenGL ES API and renders the result to the render target; the synthesizer combines multiple render targets through the FBO technique and inputs them into the system's off-screen buffer.
  • a rendering method of a 3D canvas webpage element is provided.
  • the present application further provides a rendering apparatus for a 3D canvas webpage element.
  • the device corresponds to an embodiment of the above method.
  • FIG. 4 is a schematic diagram of an embodiment of a rendering apparatus for a 3D canvas webpage element of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
  • the rendering device of the 3D canvas webpage element of the embodiment includes: a WebGL instruction intercepting unit 101, configured to intercept a WebGL drawing instruction for the 3D canvas webpage element; and a WebGL instruction transmitting unit 103, configured to carry the WebGL drawing instruction
  • the instruction information is transmitted to the system framework layer;
  • the OpenGL instruction generating unit 105 is configured to generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information;
  • an OpenGL instruction drawing unit 107 configured to use the OpenGL drawing instruction Draws into the OpenGL rendering window of the system to form the rendering result of the 3D canvas web page element.
  • the WebGL instruction intercepting unit 101 is specifically configured to intercept the WebGL drawing instruction by using a replacement DOM object of the 3D canvas webpage element.
  • the WebGL instruction transfer unit 103 includes:
  • An instruction information extraction subunit configured to extract the instruction information from the WebGL drawing instruction
  • a rendering command generating subunit configured to generate a rendering command corresponding to the WebGL drawing instruction according to the first preset instruction conversion rule and the instruction information
  • a rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  • the OpenGL instruction generating unit 105 includes:
  • An instruction information transmitting subunit configured to transfer the instruction information from the system framework layer to a system local layer
  • the OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the local layer of the system.
  • FIG. 5 is a schematic diagram of an embodiment of an electronic device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • the device embodiments described below are merely illustrative.
  • the electronic device includes: a display 101; a processor 102; and a memory 103, configured to store a program for implementing a rendering method of a 3D canvas webpage element, the device is After executing the program of the rendering method of the 3D canvas webpage element by the processor, performing the following steps: intercepting a WebGL drawing instruction for the 3D canvas webpage element; and transmitting the instruction information carried by the WebGL drawing instruction to the system framework And generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and drawing the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  • the present application also provides a rendering method of a 2D canvas webpage element.
  • the following is a brief description of the rendering method and existing problems of the 2D canvas webpage elements in the prior art.
  • the HTML5 2D canvas relies on the system Webview to complete the rendering and drawing in the mobile app, and the performance depends on the system Webview.
  • the performance of the HTML5 canvas element on the mobile side is not good, especially in some high-interaction pages such as games and animations.
  • the performance of the canvas is more obvious, and the picture will appear stuck and slow.
  • due to the numerous Android system versions of Android phones various mobile phone manufacturers have different support and serious customization.
  • the performance bottleneck of HTML5 canvas is particularly prominent on Android phones.
  • the prior art has a problem that the rendering performance of the 2D canvas webpage element is low.
  • FIG. 6 is a flowchart of a method for rendering a 2D canvas webpage element provided by the present application. The same parts of the first embodiment are not described again. Please refer to the corresponding example in the first embodiment. section.
  • a rendering method of a 2D canvas webpage element provided by the present application includes:
  • Step S101 Intercepting a drawing instruction to the 2D canvas webpage element.
  • This step corresponds to the step S101 of the first embodiment, and the difference is that the processing object of the first embodiment is a 3D canvas webpage element, and the processing object of the method is a 2D canvas webpage element; correspondingly, the above implementation Example 1 intercepts the WebGL drawing instruction, and the method intercepts the drawing instruction for the 2D canvas.
  • the rendering method of the 2D canvas webpage element provided by the present application is completely consistent with the core idea and processing steps of the above-mentioned 3D canvas webpage element rendering method. Therefore, the specific steps are not specifically described in this embodiment. For the corresponding part, refer to the first embodiment. The related descriptions are not repeated here.
  • the method embodiments described below are merely illustrative.
  • the step may be performed by capturing a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
  • Step S103 Transfer instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer.
  • the step may include the following steps: 1) extracting the instruction information from a drawing instruction of the 2D canvas webpage element; 2) converting the rule and the instruction information according to the first preset instruction, Generating a rendering command corresponding to the drawing instruction of the 2D canvas webpage element; 3) transferring the rendering command from the system framework layer.
  • Step S105 Generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information.
  • the step may include the following specific steps: 1) transmitting the instruction information from the system framework layer to a system local layer; 2) in the system local layer, according to the instruction information
  • the OpenGL drawing instruction is generated.
  • Step S107 Drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • the step may include the following steps: 1) acquiring context information corresponding to the 2D canvas webpage element and a rendering target; 2) rendering the rendering according to the context information and the OpenGL drawing instruction.
  • the target is rendered graphically; 3) the rendering target is input to the off-screen buffer of the system.
  • the method provided by the present application further includes synthesizing the OpenGL rendering window and the Webview window of the system to form a rendering result of the webpage where the 2D canvas webpage element is located.
  • FIG. 7 is a schematic structural diagram of an embodiment of a method for rendering a 2D canvas webpage element of the present application.
  • the rendering method for implementing the 2D canvas webpage element of the present application has a four-layer structure: a JavaScript hosting module layer, a bridge module layer, an operating system adaptation module layer, and an engine module layer. These levels are briefly described below.
  • JavaScript escrow module layer mainly used to host HTML5 2D canvas API (drawing instructions) and implement the program for these APIs.
  • the functions of this layer include but are not limited to: canvas element replacement, rendering instruction splicing and delivery, interactive command response , the response of the callback function, the calculation of the size and position of the canvas element, and the layer management of multiple canvases.
  • Bridge module layer mainly used for JavaScript and operating system layer (ie: the above system frame layer) code (android: Java / iOS: OC) to interact, there are two ways to achieve JavaScript and the underlying code interaction, respectively : JS bridge, JS engine.
  • operating system adaptation module layer mainly used to implement a custom rendering window (ie: the above OpenGL rendering window), the custom rendering window is used to display the rendering output of the HTML5 2D canvas; and, manage multiple windows Use (custom rendering windows and rendering windows for other HTML5 elements) to synthesize the final rendering results.
  • the JS bridge scheme is used in the upper layer (bridge module layer)
  • the JS bridge adapter plugin is also needed to receive the interaction or rendering instructions passed by the JS bridge to the system layer. And process or forward as needed.
  • Engine module layer The system local layer is mainly used to create, manage, and destroy the canvas entity (entity) and the canvas 2d context entity.
  • the corresponding OpenGL ES API is called according to the received rendering instruction.
  • this layer it is also responsible for managing rendering targets that are rendered to multiple render layers for different canvases.
  • multiple rendering targets are synthesized into off-screen rendering buffers by FBO technology in OpenGL.
  • FIG. 8 is a specific flowchart of an embodiment of a method for rendering a 2D canvas webpage element of the present application.
  • the flowchart shown in FIG. 8 corresponds to the specific processing procedure of the above solution, and the processing procedure of the above scheme can be more intuitively understood in conjunction with FIG. 8.
  • the specific flowchart shown in FIG. 8 will be briefly described below with reference to FIG.
  • the synthesizer After receiving the command, parse and obtain the corresponding 2D canvas context (if not new); the synthesizer acquires a render target (if not created) and assigns it to the 2D canvas context; the 2D canvas context is called according to the parsed command result Renderer corresponding to the renderer The corresponding OpenGL ES API is called and the result is rendered into the render target; the synthesizer combines multiple render targets through the FBO technique and inputs them into the system's off-screen buffer.
  • a rendering method of a 2D canvas webpage element is provided.
  • the present application further provides a rendering apparatus for a 2D canvas webpage element.
  • the device corresponds to an embodiment of the above method.
  • FIG. 9 is a schematic diagram of an embodiment of a rendering apparatus for a 2D canvas webpage element of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
  • the apparatus for rendering a 2D canvas webpage element of the embodiment includes: an instruction intercepting unit 101, configured to intercept a drawing instruction for a 2D canvas webpage element; an instruction transmitting unit 103, configured to draw a drawing instruction of the 2D canvas webpage element The command information carried is transmitted to the system framework layer; the OpenGL instruction generating unit 105 is configured to generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; and an OpenGL instruction drawing unit 107, configured to The OpenGL drawing instruction is drawn to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • the instruction intercepting unit 101 is configured to intercept a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
  • the instruction transmitting unit 103 includes:
  • An instruction information extraction subunit configured to extract the instruction information from a drawing instruction of the 2D canvas webpage element
  • a rendering command generating subunit configured to generate a rendering command corresponding to the drawing instruction of the 2D canvas webpage element according to the first preset instruction conversion rule and the instruction information
  • a rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  • the OpenGL instruction generating unit 105 includes:
  • An instruction information transmitting subunit configured to transfer the instruction information from the system framework layer to a system local layer
  • An OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the system local layer.
  • FIG. 10 is a schematic diagram of an embodiment of an electronic device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • the device embodiments described below are merely illustrative.
  • the electronic device includes: a display 1101; a processor 1102; and a memory 1103, configured to store a program for implementing a rendering method of a 2D canvas webpage element, the device is powered on and runs by the processor
  • the following steps are performed: intercepting the drawing instruction of the 2D canvas webpage element; transmitting the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer; according to the instruction And generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element; drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • the method, device and electronic device for rendering a 2D canvas webpage element transmit the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer by intercepting the drawing instruction of the 2D canvas webpage element on the mobile App level. And generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; and drawing the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), Other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, CD-ROM (CD-ROM) ), a digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape storage or other magnetic storage device or any other non-transportable medium that can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware.
  • the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.

Abstract

A 3D canvas web page element rendering method and apparatus and an electronic device, and a 2D canvas web page element rendering method and apparatus and an electronic device. The 3D canvas web page element rendering method comprises: intercepting a WebGL drawing instruction with respect to a 3D canvas web page element (S101); transmitting instruction information carried by the WebGL drawing instruction to a system framework layer (S103); according to the instruction information, generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction (S105); and drawing the OpenGL drawing instruction onto an OpenGL rendering window of the system, and forming a rendering result of the 3D canvas web page element (S107). The method can prevent the use of a system Webview to render and draw a 3D canvas web page element, thereby achieving the effect of improving the compatibility and coverage ratio supported by 3D Canvas.

Description

3D canvas网页元素的渲染方法、装置及电子设备Rendering method, device and electronic device of 3D canvas webpage element 技术领域Technical field
本申请涉及移动互联网技术领域,具体涉及一种3D canvas网页元素的渲染方法、装置及电子设备。本申请同时涉及一种2D canvas网页元素的渲染方法、装置及电子设备。The present application relates to the field of mobile Internet technologies, and in particular, to a method, an apparatus, and an electronic device for rendering a 3D canvas webpage element. The application also relates to a method, a device and an electronic device for rendering a 2D canvas webpage element.
背景技术Background technique
随着Web技术的发展和HTML5标准的落地,HTML5开发越来越火热。HTML5开发具有跨平台、开发成本低、迭代快、易动态发布等优点,在移动App开发中占据的比重越来越大。Canvas元素作为HTML5的一个重要特性,在移动开发页面展示中,特别是图片处理、动画展示等场合,起了不可或缺的作用。With the development of Web technologies and the landing of HTML5 standards, HTML5 development is getting hotter and hotter. HTML5 development has the advantages of cross-platform, low development cost, fast iteration, and easy dynamic release. It has a larger and larger proportion in mobile app development. As an important feature of HTML5, Canvas element plays an indispensable role in mobile development page display, especially in image processing and animation display.
在移动应用程序中,HTML5的3D canvas依靠系统Webview来完成渲染绘制,实现上依赖于系统Webview是否支持WebGL接口。WebGL是一种3D绘图标准,这种绘图技术标准允许把JavaScript和OpenGL ES 2.0结合在一起,通过增加OpenGL ES 2.0的一个JavaScript绑定,WebGL可以为HTML5 Canvas提供硬件3D加速渲染,这样Web开发人员就可以借助系统显卡来在浏览器里更流畅地展示3D场景和模型了,还能创建复杂的导航和数据视觉化。显然,WebGL技术标准免去了开发网页专用渲染插件的麻烦,可被用于创建具有复杂3D结构的网站页面,甚至可以用来设计3D网页游戏等。In the mobile application, HTML5's 3D canvas relies on the system Webview to complete the rendering, which depends on whether the system Webview supports the WebGL interface. WebGL is a 3D drawing standard that allows JavaScript and OpenGL ES 2.0 to be combined. By adding a JavaScript binding to OpenGL ES 2.0, WebGL can provide hardware 3D accelerated rendering for HTML5 Canvas, so that Web developers You can use the system graphics card to more smoothly display 3D scenes and models in the browser, as well as create complex navigation and data visualization. Obviously, the WebGL technology standard eliminates the hassle of developing web-specific rendering plug-ins, can be used to create website pages with complex 3D structures, and can even be used to design 3D web games.
然而,HTML5的3D canvas中的WebGL直到Android 5.0、iOS 8.0才被支持,并且支持的版本仅为WebGL 1.1,而非最新的WebGL 2.0。综上所述,现有技术存在部分移动操作系统不支持WebGL渲染的问题。However, WebGL in HTML5's 3D canvas is not supported until Android 5.0 and iOS 8.0, and the supported version is only WebGL 1.1, not the latest WebGL 2.0. In summary, the prior art has some problems that the mobile operating system does not support WebGL rendering.
发明内容Summary of the invention
本申请提供一种3D canvas网页元素的渲染方法、装置及电子设备,以解决现有技术下部分移动操作系统不支持WebGL渲染的问题。本申请还提供一种2D canvas网页元素的渲染方法、装置及电子设备。 The present application provides a method, a device, and an electronic device for rendering a 3D canvas webpage element to solve the problem that a part of the mobile operating system does not support WebGL rendering in the prior art. The application also provides a method, a device and an electronic device for rendering a 2D canvas webpage element.
本申请提供一种3D canvas网页元素的渲染方法,包括:The application provides a rendering method of a 3D canvas webpage element, including:
截获对3D canvas网页元素的WebGL绘图指令;Intercepting WebGL drawing instructions for 3D canvas webpage elements;
将所述WebGL绘图指令携带的指令信息传送到系统框架层;Transmitting instruction information carried by the WebGL drawing instruction to a system framework layer;
根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;Generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information;
将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。The OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
可选的,所述截获对3D canvas网页元素的WebGL绘图指令,采用如下方式:Optionally, the intercepting the WebGL drawing instruction for the 3D canvas webpage element is as follows:
通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。The WebGL drawing instruction is intercepted by the replacement DOM object of the 3D canvas webpage element.
可选的,还包括:Optionally, it also includes:
将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象。The DOM object of the 3D canvas webpage element is replaced with the replacement DOM object.
可选的,在所述将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象之前,还包括:Optionally, before the replacing the DOM object of the 3D canvas webpage element with the replacement DOM object, the method further includes:
判断所述操作系统是否允许执行DOM对象替换的操作;若是,则进入下一步骤;若否,则使用Webview视窗绘制所述3D canvas网页元素。Determining whether the operating system allows to perform the operation of DOM object replacement; if yes, proceeding to the next step; if not, using the Webview window to draw the 3D canvas webpage element.
可选的,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,包括:Optionally, the transmitting the instruction information carried by the WebGL drawing instruction to the system framework layer includes:
从所述WebGL绘图指令中提取所述指令信息;Extracting the instruction information from the WebGL drawing instruction;
根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;Generating, according to the first preset instruction conversion rule and the instruction information, a rendering command corresponding to the WebGL drawing instruction;
将所述渲染命令从传送到所述系统框架层。The rendering command is passed from the system framework layer.
可选的,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,采用如下方式:Optionally, the instruction information carried by the WebGL drawing instruction is transmitted to the system framework layer by using the following manner:
通过JS bridge或者JavaScript引擎,将所述指令信息传送到所述系统框架层。The instruction information is transmitted to the system framework layer via a JS bridge or a JavaScript engine.
可选的,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,采用如下方式:Optionally, the instruction information carried by the WebGL drawing instruction is transmitted to the system framework layer by using the following manner:
根据预设的时间间隔,将所述指令信息传送到所述系统框架层。 The instruction information is transmitted to the system framework layer according to a preset time interval.
可选的,所述生成与所述WebGL绘图指令对应的OpenGL绘图指令,包括:Optionally, the generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction includes:
将所述指令信息从所述系统框架层传送到系统本地层;Transmitting the instruction information from the system framework layer to a system local layer;
在所述系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。In the system local layer, the OpenGL drawing instruction is generated according to the instruction information.
可选的,所述将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,包括:Optionally, the drawing the OpenGL drawing instruction to the OpenGL rendering window of the system includes:
获取所述3D canvas网页元素对应的上下文信息及渲染目标;Obtaining context information and a rendering target corresponding to the 3D canvas webpage element;
根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;Performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction;
将所述渲染目标输入到系统的离屏缓冲区。The rendering target is input to an offscreen buffer of the system.
可选的,所述将所述渲染目标输入到系统的离屏缓冲区,采用如下方式:Optionally, the inputting the rendering target to the off-screen buffer of the system is as follows:
通过FBO技术,将多个所述渲染目标合成到所述离屏缓冲区;不同的所述渲染目标对应不同的所述3D canvas网页元素。A plurality of the rendering targets are synthesized into the off-screen buffer by FBO technology; different rendering targets correspond to different 3D canvas webpage elements.
可选的,在所述获取所述3D canvas元素对应的上下文信息及所述渲染目标之前,还包括:Optionally, before the acquiring the context information corresponding to the 3D canvas element and the rendering target, the method further includes:
判断所述上下文信息及所述渲染目标是否存在;若否,则创建所述上下文信息及所述渲染目标,以及对所述上下文信息和所述渲染目标进行绑定。Determining whether the context information and the rendering target are present; if not, creating the context information and the rendering target, and binding the context information and the rendering target.
可选的,还包括:Optionally, it also includes:
对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述3D canvas网页元素所在网页的渲染结果。The OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 3D canvas webpage element is located.
可选的,所述对所述OpenGL渲染视窗和系统的Webview视窗进行合成,采用如下方式:Optionally, the synthesizing the OpenGL rendering window and the webview window of the system are as follows:
通过系统的窗口管理机制,将所述OpenGL渲染视窗和所述Webview视窗混合。The OpenGL rendering window and the Webview window are mixed by a window management mechanism of the system.
可选的,所述Webview视窗中绘制了所述网页内的非3D canvas网页元素。Optionally, the non-3D canvas webpage element in the webpage is drawn in the webview window.
可选的,所述系统包括Andriod系统或iOS系统。Optionally, the system includes an Andriod system or an iOS system.
相应的,本申请还提供一种3D canvas网页元素的渲染装置,包括:Correspondingly, the present application further provides a rendering device for a 3D canvas webpage element, including:
WebGL指令截获单元,用于截获对3D canvas网页元素的WebGL绘图指令;a WebGL instruction intercepting unit for intercepting a WebGL drawing instruction for a 3D canvas webpage element;
WebGL指令传送单元,用于将所述WebGL绘图指令携带的指令信息传送到系统框架层; a WebGL instruction transfer unit, configured to transfer instruction information carried by the WebGL drawing instruction to a system framework layer;
OpenGL指令生成单元,用于根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;An OpenGL instruction generating unit, configured to generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information;
OpenGL指令绘制单元,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
可选的,所述WebGL指令截获单元,具体用于通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。Optionally, the WebGL instruction intercepting unit is specifically configured to intercept the WebGL drawing instruction by using a replacement DOM object of the 3D canvas webpage element.
可选的,所述WebGL指令传送单元包括:Optionally, the WebGL instruction delivery unit includes:
指令信息提取子单元,用于从所述WebGL绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from the WebGL drawing instruction;
渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the WebGL drawing instruction according to the first preset instruction conversion rule and the instruction information;
渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
可选的,所述OpenGL指令生成单元包括:Optionally, the OpenGL instruction generating unit includes:
指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层;An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
OpenGL指令生成子单元,用于在所述系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。The OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the local layer of the system.
相应的,本申请还提供一种电子设备,包括:Correspondingly, the present application further provides an electronic device, including:
显示器;monitor;
处理器;以及Processor;
存储器,用于存储实现3D canvas网页元素的渲染方法的程序,该设备通电并通过所述处理器运行该3D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对3D canvas网页元素的WebGL绘图指令;将所述WebGL绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。a program for storing a rendering method for implementing a 3D canvas webpage element. After the device is powered on and runs the program of the rendering method of the 3D canvas webpage element by the processor, the following steps are performed: intercepting the 3D canvas webpage element a WebGL drawing instruction; transmitting instruction information carried by the WebGL drawing instruction to a system framework layer; generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and drawing the OpenGL drawing instruction to a system OpenGL Rendering a window to form a rendering result of the 3D canvas webpage element.
相应的,本申请还提供一种2D canvas网页元素的渲染方法,包括:Correspondingly, the present application further provides a method for rendering a 2D canvas webpage element, including:
截获对2D canvas网页元素的绘图指令;Intercepting drawing instructions for 2D canvas webpage elements;
将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层; Transmitting instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer;
根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;Generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information;
将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。The OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
可选的,所述截获对2D canvas网页元素的WebGL绘图指令,采用如下方式:Optionally, the intercepting the WebGL drawing instruction for the 2D canvas webpage element is as follows:
通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。Drawing instructions of the 2D canvas webpage element are intercepted by the replacement DOM object of the 2D canvas webpage element.
可选的,所述将所述对2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层,包括:Optionally, the transmitting the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer, including:
从所述2D canvas网页元素的绘图指令中提取所述指令信息;Extracting the instruction information from a drawing instruction of the 2D canvas webpage element;
根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;Generating, according to the first preset instruction conversion rule and the instruction information, a rendering command corresponding to the drawing instruction of the 2D canvas webpage element;
将所述渲染命令从传送到所述系统框架层。The rendering command is passed from the system framework layer.
可选的,所述生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令,包括:Optionally, the generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element includes:
将所述指令信息从所述系统框架层传送到系统本地层;Transmitting the instruction information from the system framework layer to a system local layer;
在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。In the system local layer, the OpenGL drawing instruction is generated according to the instruction information.
可选的,所述将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,包括:Optionally, the drawing the OpenGL drawing instruction to the OpenGL rendering window of the system includes:
获取所述2D canvas网页元素对应的上下文信息及渲染目标;Obtaining context information and a rendering target corresponding to the 2D canvas webpage element;
根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;Performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction;
将所述渲染目标输入到系统的离屏缓冲区。The rendering target is input to an offscreen buffer of the system.
可选的,还包括:Optionally, it also includes:
对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述2D canvas网页元素所在网页的渲染结果。The OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 2D canvas webpage element is located.
相应的,本申请还提供一种2D canvas网页元素的渲染装置,包括:Correspondingly, the present application further provides a rendering apparatus for a 2D canvas webpage element, including:
指令截获单元,用于截获对2D canvas网页元素的绘图指令; An instruction intercepting unit, configured to intercept a drawing instruction for a 2D canvas webpage element;
指令传送单元,用于将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;An instruction transmitting unit, configured to transmit instruction information carried by the drawing instruction of the 2D canvas webpage element to a system framework layer;
OpenGL指令生成单元,用于根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;An OpenGL instruction generating unit, configured to generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information;
OpenGL指令绘制单元,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
可选的,所述指令截获单元,具体用于通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。Optionally, the instruction intercepting unit is configured to intercept a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
可选的,所述指令传送单元包括:Optionally, the instruction transmission unit includes:
指令信息提取子单元,用于从所述2D canvas网页元素的绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from a drawing instruction of the 2D canvas webpage element;
渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the drawing instruction of the 2D canvas webpage element according to the first preset instruction conversion rule and the instruction information;
渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
可选的,所述OpenGL指令生成单元包括:Optionally, the OpenGL instruction generating unit includes:
指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层;An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
OpenGL指令生成子单元,用于在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。An OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the system local layer.
相应的,本申请还提供一种电子设备,包括:Correspondingly, the present application further provides an electronic device, including:
显示器;monitor;
处理器;以及Processor;
存储器,用于存储实现2D canvas网页元素的渲染方法的程序,该设备通电并通过所述处理器运行该2D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对2D canvas网页元素的绘图指令;将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。 a program for storing a rendering method for implementing a 2D canvas webpage element. After the device is powered on and runs the program of the rendering method of the 2D canvas webpage element by the processor, the following steps are performed: intercepting the 2D canvas webpage element a drawing instruction; transmitting instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer; and generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; The drawing instructions are drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas web page element.
与现有技术相比,本申请提供的方法,通过截获对3D canvas网页元素的WebGL绘图指令;将所述WebGL绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。Compared with the prior art, the method provided by the present application intercepts a WebGL drawing instruction for a 3D canvas webpage element; transmits instruction information carried by the WebGL drawing instruction to a system framework layer; and generates and coordinates according to the instruction information. An OpenGL drawing instruction corresponding to the WebGL drawing instruction; the OpenGL drawing instruction is drawn to an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
使用本申请提供的3D canvas网页元素的渲染方法,将截获的针对3D canvas网页元素的WebGL绘图指令携带的指令信息从客户端脚本层传送到系统框架层,并根据指令信息获取与WebGL绘图指令对应的OpenGL绘图指令,再将OpenGL绘图指令绘制到系统的OpenGL渲染视窗中,形成3D canvas网页元素的渲染结果;这种处理方式,避免使用系统Webview对3D canvas网页元素渲染绘制;因此,可以提高移动Web应用内HTML5 3D Canvas支持的兼容性与覆盖率,使得原先不支持WebGL或者支持WebGL不理想的移动设备中的应用均可使用WebGL进行动画渲染。Using the rendering method of the 3D canvas webpage element provided by the present application, the intercepted instruction information carried by the WebGL drawing instruction for the 3D canvas webpage element is transmitted from the client script layer to the system framework layer, and corresponding to the WebGL drawing instruction according to the instruction information. OpenGL drawing instructions, then draw OpenGL drawing instructions into the system's OpenGL rendering window to form the rendering result of the 3D canvas web page elements; this way, avoid using the system Webview to render the 3D canvas web page elements; therefore, can improve the movement The compatibility and coverage of HTML5 3D Canvas in web applications enables applications in mobile devices that do not support WebGL or support WebGL to be animated using WebGL.
本申请提供的3D canvas网页元素的渲染方法,通过引入JavaScript桥接层与系统框架层,充分解除了对于操作系统的依赖,能够兼容现有发布的移动操作系统,具有很强的兼容性,从而可以达到跨平台的技术效果。The rendering method of the 3D canvas webpage element provided by the present application fully removes the dependence on the operating system by introducing the JavaScript bridge layer and the system framework layer, and is compatible with the existing released mobile operating system, and has strong compatibility, so that Achieve cross-platform technical effects.
附图说明DRAWINGS
图1是本申请提供的一种3D canvas网页元素的渲染方法的实施例的流程图;1 is a flowchart of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application;
图2是本申请提供的一种3D canvas网页元素的渲染方法的实施例的结构示意图;2 is a schematic structural diagram of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application;
图3是本申请提供的一种3D canvas网页元素的渲染方法的实施例的具体流程图;3 is a specific flowchart of an embodiment of a method for rendering a 3D canvas webpage element provided by the present application;
图4是本申请提供的一种3D canvas网页元素的渲染装置的实施例的示意图;4 is a schematic diagram of an embodiment of a rendering apparatus for a 3D canvas webpage element provided by the present application;
图5是本申请提供的一种电子设备的实施例的示意图;FIG. 5 is a schematic diagram of an embodiment of an electronic device provided by the present application; FIG.
图6是本申请提供的一种2D canvas网页元素的渲染方法的实施例的流程图; 6 is a flowchart of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application;
图7是本申请提供的一种2D canvas网页元素的渲染方法的实施例的结构示意图;7 is a schematic structural diagram of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application;
图8是本申请提供的一种2D canvas网页元素的渲染方法的实施例的具体流程图;8 is a specific flowchart of an embodiment of a method for rendering a 2D canvas webpage element provided by the present application;
图9是本申请提供的一种2D canvas网页元素的渲染装置的实施例的示意图;9 is a schematic diagram of an embodiment of a rendering device of a 2D canvas webpage element provided by the present application;
图10是本申请提供的一种电子设备的实施例的示意图。FIG. 10 is a schematic diagram of an embodiment of an electronic device provided by the present application.
具体实施方式detailed description
在下面的描述中阐述了很多具体细节以便于充分理解本申请。但是,本申请能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似推广,因此本申请不受下面公开的具体实施的限制。Numerous specific details are set forth in the description below in order to provide a thorough understanding of the application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar promotion without departing from the scope of the present application, and thus the present application is not limited by the specific embodiments disclosed below.
在本申请中,提供了一种3D canvas网页元素的渲染方法、装置及电子设备。在下面的实施例中逐一进行详细说明。In the present application, a method, a device, and an electronic device for rendering a 3D canvas webpage element are provided. Detailed description will be made one by one in the following embodiments.
本申请提供的3D canvas网页元素的渲染方法,其核心的基本思想为:截获对3D canvas网页元素的WebGL绘图指令,并将截获的WebGL绘图指令携带的指令信息从客户端脚本层传送到系统框架层,并根据指令信息获取与WebGL绘图指令对应的OpenGL绘图指令,再将OpenGL绘图指令绘制到系统的OpenGL渲染视窗中,形成3D canvas网页元素的渲染结果。由于能够避免使用系统Webview对3D canvas网页元素进行渲染绘制,因而,可以提高移动Web应用内HTML5 3D Canvas支持的兼容性与覆盖率。The basic idea of the rendering method of the 3D canvas webpage element provided by the present application is: intercepting the WebGL drawing instruction of the 3D canvas webpage element, and transmitting the instruction information carried by the intercepted WebGL drawing instruction from the client script layer to the system framework. Layer, and according to the instruction information, obtain the OpenGL drawing instruction corresponding to the WebGL drawing instruction, and then draw the OpenGL drawing instruction into the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element. By avoiding the use of the system Webview to render and render 3D canvas webpage elements, the compatibility and coverage of HTML5 3D Canvas support in mobile web applications can be improved.
请参考图1,其为本申请的3D canvas网页元素的渲染方法实施例的流程图。所述方法包括如下步骤:Please refer to FIG. 1 , which is a flowchart of an embodiment of a method for rendering a 3D canvas webpage element of the present application. The method includes the following steps:
步骤S101:截获对3D canvas网页元素的WebGL绘图指令。Step S101: intercepting a WebGL drawing instruction for the 3D canvas webpage element.
canvas标签是在HTML5中出现的,最先开始支持的是2D图形绘制,现在又开始有了基于WebGL的3D绘制。canvas元素是一个矩形区域,可以控制其中的每一像素。canvas元素本身是没有绘图能力的,所有的绘制工作必须在JavaScript内部完成,即:canvas元素使用JavaScript在网页上绘制图像。 The canvas tag appears in HTML5. The first to support 2D graphics rendering, now with WebGL-based 3D rendering. The canvas element is a rectangular area that controls each pixel in it. The canvas element itself has no drawing capabilities, and all drawing work must be done inside JavaScript, ie the canvas element uses JavaScript to draw an image on a web page.
WebGL是一套基于OpenGL ES 2.0的3d图形API,能够允许在网页中使用类似于OpenGL的WebGL实现3D渲染。WebGL完美地解决了现有的Web交互式三维动画的两个问题:第一,它通过HTML脚本本身实现Web交互式三维动画的制作,无需任何浏览器插件支持;第二,它利用底层的图形硬件加速功能进行的图形渲染,是通过统一的、标准的、跨平台的OpenGL接口实现的。WebGL is a set of 3D graphics API based on OpenGL ES 2.0 that allows 3D rendering to be implemented in web pages using OpenGL-like WebGL. WebGL perfectly solves two problems of existing Web interactive 3D animation: First, it implements Web interactive 3D animation through HTML script itself, without any browser plug-in support; Second, it utilizes the underlying graphics. Graphics rendering with hardware acceleration is achieved through a unified, standard, cross-platform OpenGL interface.
WebGL的图形API是通过HTML 5的3D canvas标签来使用的。本申请将JavaScript代码中对3D canvas网页元素的绘图操作指令,称为WebGL绘图指令。WebGL's graphics API is used by the HTML 5 3D canvas tag. This application refers to a drawing operation instruction for a 3D canvas webpage element in a JavaScript code, which is called a WebGL drawing instruction.
例如,一个canvas元素的代码为<canvas id="myCanvas"width="200"height="100"></canvas>,该元素包括id属性、宽度属性和高度属性;对该元素的JavaScript绘图代码可如下所示:For example, the code for a canvas element is <canvas id="myCanvas"width="200"height="100"></canvas>, which includes the id attribute, the width attribute, and the height attribute; the JavaScript drawing code for the element Can be as follows:
<script type="text/javascript"><script type="text/javascript">
var c=document.getElementById("myCanvas");Var c=document.getElementById("myCanvas");
var cxt=c.getContext("3d");Var cxt=c.getContext("3d");
cxt.fillStyle="#FF0000";cxt.fillStyle="#FF0000";
cxt.fillRect(0,0,150,75);cxt.fillRect(0,0,150,75);
</script></script>
由上述代码可见,JavaScript使用id来寻找canvas元素,然后,创建context对象,getContext("3d")对象是内建的HTML5对象,拥有多种绘制3D图形的方法;其中,cxt.fillRect(0,0,150,75)指令即为一条WebGL绘图指令;通过上述代码,可在canvas元素中绘制一个红色的矩形。As can be seen from the above code, JavaScript uses the id to find the canvas element, and then creates the context object. The getContext("3d") object is a built-in HTML5 object with a variety of methods for drawing 3D graphics; among them, cxt.fillRect(0, The 0, 150, 75) instruction is a WebGL drawing instruction; through the above code, a red rectangle can be drawn in the canvas element.
在系统默认的情况下,是通过系统的Webview视窗绘制所述3D canvas网页元素的;而本申请提供的方法将截获对3D canvas网页元素的WebGL绘图指令,将所述3D canvas网页元素绘制在系统的OpenGL渲染视窗中。In the default case of the system, the 3D canvas webpage element is drawn through the webview window of the system; and the method provided by the present application intercepts the WebGL drawing instruction of the 3D canvas webpage element, and draws the 3D canvas webpage element in the system. OpenGL rendering in the window.
本申请提供的方法对WebGL绘图指令的截获方式不加以限制,可使用任意一种技术截获对3D canvas网页元素的WebGL绘图指令。The method provided by the present application does not limit the interception manner of the WebGL drawing instruction, and the WebGL drawing instruction for the 3D canvas webpage element can be intercepted by any technique.
作为一种可选的方案,本步骤可采用如下方式实现:通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。 As an optional solution, the step may be implemented by intercepting the WebGL drawing instruction by replacing the DOM object of the 3D canvas webpage element.
所述3D canvas网页元素所在网页的DOM(Document Object Model,文档对象模型)包括所述3D canvas网页元素对应的DOM对象,可通过JavaScript(以及其他编程语言)对DOM进行访问。The DOM (Document Object Model) of the webpage where the 3D canvas webpage element is located includes a DOM object corresponding to the 3D canvas webpage element, and the DOM can be accessed through JavaScript (and other programming languages).
所述替换DOM对象是指,所述3D canvas网页元素的DOM对象的替换对象。要通过所述替换DOM对象截获所述WebGL绘图指令,首先需要将所述3D canvas网页元素所在网页的DOM树中所述3D canvas网页元素的DOM对象替换为所述替换DOM对象。The replacement DOM object refers to a replacement object of the DOM object of the 3D canvas webpage element. To intercept the WebGL drawing instruction by the replacement DOM object, firstly, the DOM object of the 3D canvas webpage element in the DOM tree of the webpage where the 3D canvas webpage element is located needs to be replaced with the replacement DOM object.
具体实施时,可首先通过getElementById(id)方法获取3D canvas网页元素,然后,再通过appendChild(node)方法插入所述3D canvas网页元素的替换DOM对象,该替换DOM对象可以为一个自定义的子节点,最后,再通过removeChild(node)方法删除3D canvas网页元素。经过上述处理后,对于该3D canvas网页元素的WebGL绘图指令,即可通过替换DOM对象截获。In a specific implementation, the 3D canvas webpage element may be first obtained by the getElementById(id) method, and then the replacement DOM object of the 3D canvas webpage element is inserted by the appendChild(node) method, and the replacement DOM object may be a customized sub-object. Node, and finally, remove the 3D canvas page element by the removeChild(node) method. After the above processing, the WebGL drawing instruction for the 3D canvas webpage element can be intercepted by replacing the DOM object.
作为一种可选的方案,在所述将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象之前,还包括:判断所述操作系统是否允许执行DOM对象替换的操作的步骤;如果判断结果为是,则执行所述将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象的步骤;否则,则使用Webview视窗绘制所述3D canvas网页元素。As an optional solution, before the replacing the DOM object of the 3D canvas webpage element with the replacement DOM object, the method further includes: determining whether the operating system allows an operation of performing DOM object replacement; If the result of the determination is yes, the step of replacing the DOM object of the 3D canvas webpage element with the replacement DOM object is performed; otherwise, the 3D canvas webpage element is drawn using a Webview window.
采用这种判断处理的方式,如果为了保证操作系统的安全性,预先做了不允许进行DOM对象替换的设置处理,则可以通过系统默认的Webview视窗绘制所述3D canvas网页元素,从而提高了用户体验。In this way of judging processing, if the setting process that does not allow DOM object replacement is performed in advance in order to ensure the security of the operating system, the 3D canvas webpage element can be drawn through the default Webview window of the system, thereby improving the user. Experience.
在截获到对3D canvas网页元素的WebGL绘图指令之后,就可以进入下一步骤,将截获的WebGL绘图指令携带的指令信息从客户端脚本层传送到系统框架层。After intercepting the WebGL drawing instruction for the 3D canvas webpage element, the next step is taken to transfer the instruction information carried by the intercepted WebGL drawing instruction from the client script layer to the system framework layer.
步骤S103:将所述WebGL绘图指令携带的指令信息传送到系统框架层。Step S103: Transfer the instruction information carried by the WebGL drawing instruction to the system framework layer.
所述WebGL绘图指令携带的指令信息,包括但不限于:指令名称及指令参数,例如,drawCircle(200,300,5)这个WebGL绘图指令所携带的指令名称为drawCircle,指令参数为:x坐标为200、y坐标为300,半径为5。The instruction information carried by the WebGL drawing instruction includes, but is not limited to, an instruction name and an instruction parameter. For example, the drawCircle (200, 300, 5) is a name of the instruction carried by the WebGL drawing instruction, and the instruction parameter is: the x coordinate is 200. The y coordinate is 300 and the radius is 5.
本步骤S103可采用直接传递所述指令信息的形式,将所述WebGL绘图指令携带的指令信息从客户端脚本层传送到系统框架层,也可以采用下述优选的方案作为具体实施方案。 In this step S103, the instruction information carried by the WebGL drawing instruction may be transmitted from the client script layer to the system framework layer in a form of directly transmitting the instruction information, and the following preferred solution may also be adopted as a specific implementation.
作为一种优选的方案,本步骤S103可包括如下具体步骤:1)从所述WebGL绘图指令中提取所述指令信息;2)根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;3)将所述渲染命令传送到所述系统框架层。As a preferred solution, the step S103 may include the following specific steps: 1) extracting the instruction information from the WebGL drawing instruction; 2) generating a UI according to the first preset instruction conversion rule and the instruction information. a rendering command corresponding to the WebGL drawing instruction; 3) transmitting the rendering command to the system framework layer.
通过上述第2个步骤,可根据第一预设指令转换规则对各种指令信息进行拼接形成预设形式的渲染命令(即:指令信息的规范化表达形式),再通过上述第3个步骤以渲染命令形式将指令信息从客户端脚本层传送到系统框架层;这种处理方式,可以使得后续环节易于对该命令进行解析,进而获得与WebGL绘图指令对应的OpenGL绘图指令。Through the second step, the various instruction information may be spliced according to the first preset instruction conversion rule to form a preset form of the rendering command (ie, the normalized expression form of the instruction information), and then the third step is used to render The command form transfers the instruction information from the client script layer to the system framework layer; this processing method makes it easy for the subsequent links to parse the command, and then obtains the OpenGL drawing instruction corresponding to the WebGL drawing instruction.
本实施例中,设置了一个GCanvas类,该类包括与上述第2个步骤对应的指令转换程序代码如下所示:In this embodiment, a GCanvas class is set, and the class includes the instruction conversion program code corresponding to the second step described above as follows:
Figure PCTCN2017100536-appb-000001
Figure PCTCN2017100536-appb-000001
例如,WebGL的绘图指令为:WebGLRenderingContext.uniform4f(location,x,y,z,w),经过上述代码处理后该指令转换为渲染命令(命令串):“17,3,100,200,300,400;”;其中,“17”指代uniform4f方法在GCanvas中的指令ID,“3”指代location对象的ID,“100,200,300”代表位置“x,y,z”,“400”代表宽度“w”,逗号“,”在GCanvas中是变量分隔符,分号“;”在GCanvas中表示命令结束符。For example, the drawing instruction of WebGL is: WebGLRenderingContext.uniform4f(location, x, y, z, w). After the above code processing, the instruction is converted into a rendering command (command string): "17, 3, 100, 200, 300, 400;"; where "17" refers to the instruction ID of the uniform4f method in GCanvas, "3" refers to the ID of the location object, "100, 200, 300" represents the position "x, y, z", "400" Represents the width "w", the comma "," is a variable separator in GCanvas, and the semicolon ";" indicates the command terminator in GCanvas.
需要说明的是,本步骤S103及上一步骤S101均运行在客户端脚本层。所述客户端脚本层可包括如下功能:1)查找HTML5页面中是否有可供替换的3D canvas元素,如有且能成功替换,则新建一个替换DOM对象将之插入原DOM树,并将原3D canvas元素删除,后续所有对于原3D canvas元素的调用、操作都将被新插入的DOM对象托管;2)截获对原3D canvas网页元素的WebGL绘图指令,并将该绘图指令携带的指令信息从客户端脚本层传送到系统框架层。此外,所述客户端脚本层还用于响应用户对网页元素的交互指令、响应回调函数、计算canvas网页元素的大小与位置、及多个canvas网页元素的层管理等。 It should be noted that both the step S103 and the previous step S101 are run in the client script layer. The client script layer may include the following functions: 1) finding whether there is a replaceable 3D canvas element in the HTML5 page, and if it can be successfully replaced, a new replacement DOM object is inserted into the original DOM tree, and the original The 3D canvas element is deleted, all subsequent calls and operations on the original 3D canvas element will be hosted by the newly inserted DOM object; 2) the WebGL drawing instruction for the original 3D canvas webpage element is intercepted, and the instruction information carried by the drawing instruction is The client script layer is passed to the system framework layer. In addition, the client script layer is further configured to respond to a user's interaction instruction to a webpage element, a response callback function, calculate a size and location of a canvas webpage element, and layer management of a plurality of canvas webpage elements.
所述系统框架层是指,使用操作系统原生语言开发程序的应用程序框架层,例如,当本申请的方法应用在Android系统中时,系统框架层即为Java语言开发的程序层;当本申请的方法应用在iOS系统中时,系统框架层即为Object-C语言开发的程序层。The system framework layer refers to an application framework layer that uses an operating system native language development program. For example, when the method of the present application is applied in an Android system, the system framework layer is a program layer developed by the Java language; When the method is applied in the iOS system, the system framework layer is the program layer developed by the Object-C language.
具体实施时,可通过实时的方式将所述指令信息从客户端脚本层传送到系统框架层。然而,由于这种方式需要对截获的每一条指令进行系统框架层的渲染处理,因此,这种处理方法存在降低系统性能的问题。In a specific implementation, the instruction information may be transmitted from the client script layer to the system framework layer in a real-time manner. However, since this method requires a rendering process of the system frame layer for each intercepted instruction, this processing method has a problem of degrading system performance.
为了避免对系统性能产生负面影响,作为一种优选的方案,本步骤可采用如下方式实现:根据预设的时间间隔,将所述指令信息从客户端脚本层传送到所述系统框架层。这样,既可以保证一定的图像帧率,从而满足用户的视觉体验,又可以避免降低系统性能。In order to avoid negative impact on system performance, as a preferred solution, the step may be implemented by transmitting the instruction information from the client script layer to the system framework layer according to a preset time interval. In this way, a certain image frame rate can be guaranteed, thereby satisfying the user's visual experience and avoiding degrading system performance.
此外,为了能够将所述指令信息从客户端脚本层传送到系统框架层,可采用如下技术实现:通过JS bridge或者JavaScript引擎,将所述指令信息传送到所述系统框架层。In addition, in order to be able to transfer the instruction information from the client script layer to the system framework layer, the following technology may be implemented: the instruction information is transmitted to the system framework layer through a JS bridge or a JavaScript engine.
通过所述JS bridge或者JavaScript引擎,可以实现JavaScript代码与系统框架层代码的交互,从而将指令信息从客户端脚本层传送到系统框架层。Through the JS bridge or JavaScript engine, the interaction between the JavaScript code and the system framework layer code can be implemented, thereby transferring the instruction information from the client script layer to the system framework layer.
如果采用JS bridge方法传递信息,可应用cordova等较为成熟的方案。如果采用JavaScript引擎方法传递信息,则当本申请的方法应用在Android系统中时,可采用V8引擎;当本申请的方法应用在iOS系统中时,可采用JavaScriptCore引擎。If you use the JS bridge method to pass information, you can apply a more mature solution such as cordova. If the information is transmitted using the JavaScript engine method, the V8 engine may be employed when the method of the present application is applied to the Android system; the JavaScriptCore engine may be employed when the method of the present application is applied to the iOS system.
需要注意的是,如果使用了JS bridge的方案,那么针对所选取的JS bridge,还需要在所述系统框架层中实现JS bridge的适配插件,该适配插件用以接收由JS bridge传递给系统框架层的交互指令或渲染指令(即:指令信息),并且根据需要进行处理或者转发。It should be noted that if the JS bridge solution is used, for the selected JS bridge, an adaptation plug-in of the JS bridge needs to be implemented in the system framework layer, and the adaptation plug-in is used to receive the JS bridge to be passed to the JS bridge. Interactive instructions or rendering instructions (ie, instruction information) of the system framework layer, and processed or forwarded as needed.
需要说明的是,本申请提供的方法,通过引入JavaScript桥接层与系统框架层,充分解除了对于操作系统的依赖,能够兼容现有发布的移动操作系统,具有很强的兼容性,从而可以达到跨平台的技术效果。It should be noted that the method provided by the present application fully removes the dependence on the operating system by introducing a JavaScript bridging layer and a system framework layer, and is compatible with the existing released mobile operating system, and has strong compatibility, thereby achieving Cross-platform technical effects.
当所述WebGL绘图指令携带的指令信息被传送到系统框架层后,就可以进入下一步骤,根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令。 After the instruction information carried by the WebGL drawing instruction is transmitted to the system framework layer, the process proceeds to the next step, and an OpenGL drawing instruction corresponding to the WebGL drawing instruction is generated according to the instruction information.
步骤S105:根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令。Step S105: Generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information.
本步骤根据接收到的所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令。通过本步骤及上述步骤的处理,能够将原始的WebGL绘图指令最终转换为对应的OpenGL绘图指令。This step generates an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the received instruction information. Through the processing of this step and the above steps, the original WebGL drawing instruction can be finally converted into a corresponding OpenGL drawing instruction.
需要说明的是,本步骤及下一步骤可直接在系统框架层实施,例如,Android系统框架层为应用程序的开发提供了两个类来实现对3D图形API OpenGL ES的支持,分别是GLSurfaceView和GLSurfaceView.Renderer;通过这两个接口类,就可以基于OpenGL ES来进行3D图形的开发了。然而,这种实施方式存在渲染效率较低的问题。It should be noted that this step and the next step can be directly implemented in the system framework layer. For example, the Android system framework layer provides two classes for application development to implement support for the 3D graphics API OpenGL ES, namely GLSurfaceView and GLSurfaceView.Renderer; through these two interface classes, you can develop 3D graphics based on OpenGL ES. However, this embodiment has the problem of low rendering efficiency.
作为一种优选的方案,本步骤及下一步骤可在系统本地层(如:Android系统的NDK,Native Development Kit)实施。所述系统本地层又称为C++引擎层。该方式和上述方式类似,以Android系统为例,该方式与上述方式的不同之处主要为:将GLSurfaceView.Renderer的实现部分放到本地来实现,然后通过JNI来实现Java端和C端的通信。As a preferred solution, this step and the next step can be implemented in the local layer of the system (for example, NDK of the Android system, Native Development Kit). The system local layer is also known as the C++ engine layer. This method is similar to the above method. Taking the Android system as an example, the difference between the method and the above method is mainly: the implementation part of the GLSurfaceView.Renderer is implemented locally, and then the communication between the Java end and the C end is realized through the JNI.
在本实施例中,本步骤及下一步骤在系统本地层实施。为此,本步骤首先要将所述指令信息从所述系统框架层传送到系统本地层,然后,在系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。通过在系统本地层生成并执行所述OpenGL绘图指令,可获得较高的渲染性能。In this embodiment, this step and the next step are implemented at the local layer of the system. To this end, the first step is to transfer the instruction information from the system framework layer to the system local layer, and then, in the system local layer, generate the OpenGL drawing instruction according to the instruction information. Higher rendering performance can be achieved by generating and executing the OpenGL drawing instructions at the system local level.
具体实施时,本步骤S105可采用如下方式实现:根据第二预设指令转换规则和所述指令信息,生成所述OpenGL绘图指令。In a specific implementation, the step S105 may be implemented by: generating the OpenGL drawing instruction according to the second preset instruction conversion rule and the instruction information.
所述第二预设指令转换规则与上述第一预设指令转换规则相关,根据所述第一预设指令转换规则,将WebGL绘图指令转换为渲染命令;根据所述第二预设指令,将渲染命令形式的指令信息转换为与WebGL绘图指令对应的OpenGL绘图指令。The second preset instruction conversion rule is related to the first preset instruction conversion rule, and converts the WebGL drawing instruction into a rendering command according to the first preset instruction conversion rule; according to the second preset instruction, The instruction information in the form of a rendering command is converted into an OpenGL drawing instruction corresponding to the WebGL drawing instruction.
例如,在客户端脚本层将所述WebGL绘图指令转换为渲染命令“B,1”,在经过系统框架层传递到系统本地层(C++引擎层)后,会被如下代码处理:For example, the client-side script layer converts the WebGL drawing instruction into a rendering command "B, 1", which is passed to the system local layer (C++ engine layer) after being passed through the system framework layer, and is processed by the following code:
Figure PCTCN2017100536-appb-000002
Figure PCTCN2017100536-appb-000002
Figure PCTCN2017100536-appb-000003
Figure PCTCN2017100536-appb-000003
通过上述代码处理后,“1”被转化为枚举值“kEJCompositeOperationSourceOver”,然后,在SetGlobalCompositeOperation方法中继续处理,该方法代码如下所示:After processing by the above code, "1" is converted to the enumeration value "kEJCompositeOperationSourceOver", and then continues processing in the SetGlobalCompositeOperation method, the method code is as follows:
Figure PCTCN2017100536-appb-000004
Figure PCTCN2017100536-appb-000004
经过上述代码解析出“glBlendFunc”,该指令为WebGL绘图指令真正对应的OpenGL的绘图指令。After the above code parses out "glBlendFunc", the instruction is the OpenGL drawing instruction that the WebGL drawing instruction actually corresponds to.
生成与所述WebGL绘图指令对应的OpenGL绘图指令后,就可以进入下一步骤,根据这些OpenGL绘图指令绘制所述3D canvas网页元素。After generating the OpenGL drawing instruction corresponding to the WebGL drawing instruction, the process proceeds to the next step, and the 3D canvas webpage element is drawn according to the OpenGL drawing instructions.
步骤S107:将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。Step S107: Drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
本步骤将上一步骤生成的所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗中,以形成所述3D canvas网页元素的渲染结果。In this step, the OpenGL drawing instruction generated in the previous step is drawn into the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
将OpenGL绘图指令绘制到系统的OpenGL渲染视窗为本技术领域的公职技术,本申请对具体绘制方式不加以限制。下面给出一种可选的具体实施方法。The OpenGL rendering window for drawing OpenGL drawing instructions to the system is a public technical technique in the technical field, and the present application does not limit the specific drawing manner. An optional specific implementation method is given below.
具体实施时,本步骤可包括如下步骤:1)获取所述3D canvas网页元素对应的上下文信息及渲染目标;2)根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;3)将所述渲染目标输入到系统的离屏缓冲区。 In a specific implementation, the step may include the following steps: 1) acquiring context information and a rendering target corresponding to the 3D canvas webpage element; 2) performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction. ; 3) Input the render target into the off-screen buffer of the system.
1)获取所述3D canvas网页元素对应的上下文信息及渲染目标。1) Obtain context information and a rendering target corresponding to the 3D canvas webpage element.
要实现将OpenGL绘图指令绘制到系统的OpenGL渲染视窗的处理,需要系统本地层具有如下功能:1)创建、管理、销毁3D canvas实体(entity)与3D canvas的上下文实体(context entity),其中,上下文实体中保存有canvas元素的上下文信息,canvas实体保存有canvas元素的属性信息;2)负责管理将不同的canvas元素渲染到多个渲染层(render layer)的渲染目标(render target)中;3)将多个渲染目标通过OpenGL中的FBO技术合成到离屏渲染缓冲区。To implement the processing of drawing OpenGL drawing instructions into the OpenGL rendering window of the system, the system local layer needs to have the following functions: 1) create, manage, and destroy the 3D canvas entity and the context entity of the 3D canvas, wherein The context entity stores the context information of the canvas element, the canvas entity holds the attribute information of the canvas element, and 2) manages the rendering of different canvas elements to the render target of the render layer; ) Combine multiple render targets into off-screen render buffers via FBO techniques in OpenGL.
简单来说,渲染目标是一个表面,图形API可以往上面“画”东西,实质上,渲染目标是一个连续的内存区域,这样的内存区域可以同时的存在多个,也就是多个渲染目标。在本实施例中,不同的3D canvas网页元素对应不同的渲染目标。To put it simply, the render target is a surface, and the graphics API can "draw" things up. In essence, the render target is a contiguous memory area. Such a memory area can exist multiple times at the same time, that is, multiple render targets. In this embodiment, different 3D canvas webpage elements correspond to different rendering targets.
所述上下文信息及所述渲染目标是在第一次绘制3D canvas网页元素时生成的,因此,在所述获取所述3D canvas元素对应的上下文信息及所述渲染目标之前,还包括:判断所述上下文信息及所述渲染目标是否存在;如果不存在,则需要创建所述上下文信息及所述渲染目标,以及对所述上下文信息和所述渲染目标进行绑定。通过将新创建的所述上下文信息和所述渲染目标绑定,使得3D canvas元素、上下文信息及渲染目标三者相关联。The context information and the rendering target are generated when the 3D canvas webpage element is drawn for the first time. Therefore, before the acquiring the context information corresponding to the 3D canvas element and the rendering target, the method further includes: determining the location Descriptive context information and whether the rendering target exists; if not, the context information and the rendering target need to be created, and the context information and the rendering target are bound. The 3D canvas element, the context information, and the render target are associated by binding the newly created context information to the render target.
2)根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染。2) performing graphics rendering on the render target according to the context information and the OpenGL drawing instruction.
获取到3D canvas网页元素对应的上下文信息及渲染目标后,本步骤根据上下文信息和步骤S105生成的OpenGL绘图指令,对所述渲染目标进行图形渲染,以形成所述3D canvas网页元素的渲染结果。After the context information and the rendering target corresponding to the 3D canvas webpage element are obtained, the present step performs graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction generated in step S105 to form a rendering result of the 3D canvas webpage element.
具体实施时,由canvas上下文实体根据生成的OpenGL绘图指令调用渲染器(renderer)对应的API,渲染器调用相应的OpenGL ES API并将结果渲染至渲染目标中。In a specific implementation, the canvas context entity invokes an API corresponding to the renderer according to the generated OpenGL drawing instruction, and the renderer calls the corresponding OpenGL ES API and renders the result to the rendering target.
3)将所述渲染目标输入到系统的离屏缓冲区。3) Input the render target into the off-screen buffer of the system.
OpenGL中,GPU屏幕渲染有以下两种方式:1)当前屏幕渲染(On-Screen Rendering);2)离屏渲染(Off-Screen Rendering)。其中,当前屏幕渲染是指,GPU在当前用于显示的屏幕缓冲区中进行渲染操作;离屏渲染是指,GPU在当前屏幕缓冲区以外新开辟一个缓冲区进行渲染操作。 In OpenGL, GPU screen rendering can be done in two ways: 1) current screen rendering (On-Screen Rendering); 2) off-screen rendering. The current screen rendering means that the GPU performs a rendering operation in the screen buffer currently used for display; off-screen rendering means that the GPU newly opens a buffer for rendering operations outside the current screen buffer.
由于所述3D canvas网页元素的渲染结果最终需要融合到系统Webview视窗,因此,本步骤采用离屏渲染方式,将渲染后的渲染目标输入到系统的离屏缓冲区。Since the rendering result of the 3D canvas webpage element finally needs to be merged into the system webview window, this step uses the off-screen rendering mode to input the rendered rendering target into the off-screen buffer of the system.
需要注意的是,如果所述3D canvas网页元素所在的网页包括多个3D canvas网页元素,则所述将所述渲染目标输入到系统的离屏缓冲区,可采用如下方式:通过FBO(Frame Buffer Object)技术,将多个所述渲染目标合成到所述离屏缓冲区;这种情况下,不同的所述渲染目标对应不同的所述3D canvas网页元素,离屏缓冲区包括将多个3D canvas网页元素的渲染效果融合在一起的合成渲染效果数据。It should be noted that if the webpage where the 3D canvas webpage element is located includes multiple 3D canvas webpage elements, the input of the rendering target to the offscreen buffer of the system may be as follows: FBO (Frame Buffer) The technique of synthesizing a plurality of the rendering targets into the off-screen buffer; in this case, different rendering targets correspond to different 3D canvas webpage elements, and the off-screen buffer includes multiple 3Ds The rendering effect of the canvas page element's rendering effect is blended together.
上述第1、2和3步骤在本实施例中的具体实现如下所述:对于3D canvas网页元素的canvas与相应webgl context,GCanvas内部会创建相应的两个类“GCanvas”与“GCanvasContext”与之对应;根据上下文信息,利用FBO技术,会将相应的图形绘制到FBO指定的纹理(texture)上,最终由系统的EGL的swap buffer机制渲染到屏幕。The specific implementations of the above steps 1, 2 and 3 in this embodiment are as follows: for the canvas of the 3D canvas webpage element and the corresponding webgl context, the corresponding two classes "GCanvas" and "GCanvasContext" are created inside the GCanvas. Corresponding; according to the context information, using FBO technology, the corresponding graphics will be drawn to the texture specified by the FBO, and finally rendered to the screen by the system's EGL swap buffer mechanism.
通过上述第1、2和3步骤将3D canvas网页元素的渲染效果输入到系统的离屏缓冲区后,具体实施时,还需要将离屏缓冲区的数据复制到系统框架层的OpenGL渲染视窗(如:Android系统的GlSurfaceView)中,以便系统框架层对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述3D canvas网页元素所在网页的整体渲染效果。After the rendering effects of the 3D canvas webpage element are input into the off-screen buffer of the system through the steps 1, 2 and 3 above, in the specific implementation, the data of the off-screen buffer needs to be copied to the OpenGL rendering window of the system framework layer ( For example, in the GlSurfaceView of the Android system, the system framework layer synthesizes the OpenGL rendering window and the Webview window of the system to form an overall rendering effect of the webpage where the 3D canvas webpage element is located.
具体实施时,可通过系统的窗口管理机制,将所述OpenGL渲染视窗和所述Webview视窗混合。其中,所述Webview视窗中绘制了所述网页内的非3D canvas网页元素。In a specific implementation, the OpenGL rendering window and the Webview window may be mixed by a window management mechanism of the system. The non-3D canvas webpage element in the webpage is drawn in the webview window.
在本实施例中,通过HybridViewController类(继承自ViewController),将WebView与GCanvasView(继承自GLSurfaceView)加入到原元素的ViewGroup中,部分源码如下:In this embodiment, through the HybridViewController class (inherited from ViewController), WebView and GCanvasView (inherited from GLSurfaceView) are added to the ViewGroup of the original element, and some of the source code is as follows:
Figure PCTCN2017100536-appb-000005
Figure PCTCN2017100536-appb-000005
Figure PCTCN2017100536-appb-000006
Figure PCTCN2017100536-appb-000006
综上所述,传统方法使用WebView对3D canvas网页元素进行渲染,而本申请提供的方法首先将3D canvas网页元素的动画内容渲染在系统的OpenGL渲染视窗中,然后,再将OpenGL渲染视窗和WebView视窗融合,形成网页的整体渲染效果。In summary, the traditional method uses WebView to render 3D canvas webpage elements, and the method provided by the present application first renders the animation content of the 3D canvas webpage element in the OpenGL rendering window of the system, and then opens the OpenGL rendering window and the WebView. Window fusion, the overall rendering effect of the web page.
请参考图2,其为本申请的3D canvas网页元素的渲染方法实施例的结构示意图。在本实施例中,实现本申请的3D canvas网页元素的渲染方法有四层结构,分别为:JavaScript托管模块层、桥接模块层、操作系统适配模块层、引擎模块层。下面对这些层次分别作简要说明。Please refer to FIG. 2 , which is a schematic structural diagram of an embodiment of a method for rendering a 3D canvas webpage element of the present application. In this embodiment, the rendering method of the 3D canvas webpage element of the present application has a four-layer structure, namely: a JavaScript hosting module layer, a bridge module layer, an operating system adaptation module layer, and an engine module layer. These levels are briefly described below.
1)JavaScript托管模块层:主要用于托管HTML5 3D canvas的API(WebGL绘图指令)和针对这些API实现本方案,本层的功能包括但不限于:canvas元素替换、渲染指令拼接与传递、交互指令响应、回调函数的响应、canvas元素大小与位置的计算、多个canvas的层管理等。1) JavaScript escrow module layer: mainly used to host HTML5 3D canvas API (WebGL drawing instruction) and implement this scheme for these APIs. The functions of this layer include but are not limited to: canvas element replacement, rendering instruction splicing and passing, interactive instruction Response, response of the callback function, calculation of the size and position of the canvas element, layer management of multiple canvases, etc.
2)桥接模块层:主要用于JavaScript与操作系统层(即:上述系统框架层)代码(android:Java/iOS:OC)进行交互,有两种可以实现JavaScript与底层代码交互的方案,分别为:JS bridge、JS引擎。2) Bridge module layer: mainly used for JavaScript and operating system layer (ie: the above system frame layer) code (android: Java / iOS: OC) to interact, there are two ways to achieve JavaScript and the underlying code interaction, respectively : JS bridge, JS engine.
3)操作系统适配模块层:主要用于实现自定义的渲染视窗(即:上述OpenGL渲染视窗),该自定义的渲染视窗用于展现HTML5 3D canvas的渲染输出结果;以及,管理多个视窗用(自定义的渲染视窗与其他HTML5元素的渲染视窗),以合成最终的渲染结果。如果在上一层(桥接模块层)中使用了JS bridge的方案,那么针对所选取的JS bridge,还需要实现JS bridge的适配插件用以接收由JS bridge传递给系统层的交互或渲染指令,并且按照需要进行处理或者转发。 3) operating system adaptation module layer: mainly used to implement a custom rendering window (ie: the above OpenGL rendering window), the custom rendering window is used to display the rendering output of the HTML5 3D canvas; and, manage multiple windows Use (custom rendering windows and rendering windows for other HTML5 elements) to synthesize the final rendering results. If the JS bridge scheme is used in the upper layer (bridge module layer), then for the selected JS bridge, the JS bridge adapter plugin is also needed to receive the interaction or rendering instructions passed by the JS bridge to the system layer. And process or forward as needed.
4)引擎模块层:即上述系统本地层,主要用以创建、管理、销毁canvas实体(entity)与canvas 3d的上下文实体(context entity),根据接收到的渲染指令,调用相应的OpenGL ES API。在此层中还负责管理针对不同的canvas渲染到多个渲染层(render layer)的渲染目标(render target)中,最后将多个渲染目标通过OpenGL中的FBO技术合成到离屏渲染缓冲区。4) Engine module layer: The system local layer is mainly used to create, manage, and destroy the canvas entity (entity) and the canvas 3d context entity. The corresponding OpenGL ES API is called according to the received rendering instruction. In this layer, it is also responsible for managing rendering targets that are rendered to multiple render layers for different canvases. Finally, multiple rendering targets are synthesized into off-screen rendering buffers by FBO technology in OpenGL.
请参考图3,其为本申请的3D canvas网页元素的渲染方法实施例的具体流程图。图3所示的流程图对应上述方案的具体处理过程,结合图3能够更直观的理解上述方案的处理过程。下面结合图2对图3所示的具体流程图作简要说明。Please refer to FIG. 3 , which is a specific flowchart of an embodiment of a method for rendering a 3D canvas webpage element of the present application. The flowchart shown in FIG. 3 corresponds to the specific processing procedure of the foregoing solution, and the processing procedure of the foregoing scheme can be more intuitively understood in conjunction with FIG. 3. The specific flow chart shown in FIG. 3 will be briefly described below with reference to FIG.
1)JavaScript托管模块层1) JavaScript hosting module layer
查找HTML5页面中是否有可供替换的3D canvas元素,如有且能成功替换,则新建一个自定义的DOM元素将之插入原DOM树,并将原canvas元素删除,后续所有对于原canvas元素的调用、操作都将被新插入的DOM元素托管。在接收到3D canvas的调用后,将该API调用转化为内部实现的一套命令,并通过定时器进行传入系统适配层。Find whether there is a 3D canvas element to replace in the HTML5 page. If it can be successfully replaced, create a new custom DOM element and insert it into the original DOM tree, and delete the original canvas element. All subsequent to the original canvas element. Calls and operations will be hosted by the newly inserted DOM element. After receiving the call to the 3D canvas, the API call is converted into a set of internally implemented commands and passed to the system adaptation layer via a timer.
2)桥接模块层2) Bridge module layer
负责将JavaScript托管模块层生成的命令传给系统适配层。Responsible for passing commands generated by the JavaScript escrow module layer to the system adaptation layer.
3)操作系统适配模块层3) Operating system adaptation module layer
接收到命令后,拼装用于渲染3D canvas的视图与其他HTML5元素的视图,并将命令传给引擎模块层。After receiving the command, assemble the view for rendering the 3D canvas view with other HTML5 elements and pass the command to the engine module layer.
4)引擎模块层4) Engine module layer
接收到命令后,进行解析,获取相应的3D canvas上下文(如若没有则新建);合成器获取一个渲染目标(如果没有则新建)并且分配给3D canvas上下文;由3D canvas上下文根据解析的命令结果调用渲染器(renderer)对应的API,渲染器调用相应的OpenGL ES API并将结果渲染至渲染目标中;合成器将多个渲染目标通过FBO的技术进行合成并且输入到系统的离屏缓冲区。After receiving the command, parse it to get the corresponding 3D canvas context (if not new); the synthesizer gets a render target (created if not) and assigns it to the 3D canvas context; it is called by the 3D canvas context based on the parsed command result The renderer corresponds to the API, the renderer calls the corresponding OpenGL ES API and renders the result to the render target; the synthesizer combines multiple render targets through the FBO technique and inputs them into the system's off-screen buffer.
此时,本申请提供的3D canvas网页元素的渲染方法的主要工作均完成,操作系统将获得渲染控制权,并将渲染结果展示到屏幕上。 At this time, the main work of the rendering method of the 3D canvas webpage element provided by the present application is completed, and the operating system will obtain rendering control and display the rendering result to the screen.
在上述的实施例中,提供了一种3D canvas网页元素的渲染方法,与之相对应的,本申请还提供一种3D canvas网页元素的渲染装置。该装置是与上述方法的实施例相对应。In the above embodiment, a rendering method of a 3D canvas webpage element is provided. Correspondingly, the present application further provides a rendering apparatus for a 3D canvas webpage element. The device corresponds to an embodiment of the above method.
请参看图4,其为本申请的3D canvas网页元素的渲染装置实施例的示意图。由于装置实施例基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。下述描述的装置实施例仅仅是示意性的。Please refer to FIG. 4 , which is a schematic diagram of an embodiment of a rendering apparatus for a 3D canvas webpage element of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
本实施例的一种3D canvas网页元素的渲染装置,包括:WebGL指令截获单元101,用于截获对3D canvas网页元素的WebGL绘图指令;WebGL指令传送单元103,用于将所述WebGL绘图指令携带的指令信息传送到系统框架层;OpenGL指令生成单元105,用于根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;OpenGL指令绘制单元107,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。The rendering device of the 3D canvas webpage element of the embodiment includes: a WebGL instruction intercepting unit 101, configured to intercept a WebGL drawing instruction for the 3D canvas webpage element; and a WebGL instruction transmitting unit 103, configured to carry the WebGL drawing instruction The instruction information is transmitted to the system framework layer; the OpenGL instruction generating unit 105 is configured to generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and an OpenGL instruction drawing unit 107, configured to use the OpenGL drawing instruction Draws into the OpenGL rendering window of the system to form the rendering result of the 3D canvas web page element.
可选的,所述WebGL指令截获单元101,具体用于通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。Optionally, the WebGL instruction intercepting unit 101 is specifically configured to intercept the WebGL drawing instruction by using a replacement DOM object of the 3D canvas webpage element.
可选的,所述WebGL指令传送单元103包括:Optionally, the WebGL instruction transfer unit 103 includes:
指令信息提取子单元,用于从所述WebGL绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from the WebGL drawing instruction;
渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the WebGL drawing instruction according to the first preset instruction conversion rule and the instruction information;
渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
可选的,所述OpenGL指令生成单元105包括:Optionally, the OpenGL instruction generating unit 105 includes:
指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层;An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
OpenGL指令生成子单元,用于在所述系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。The OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the local layer of the system.
请参考图5,其为本申请的电子设备实施例的示意图。由于设备实施例基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。下述描述的设备实施例仅仅是示意性的。Please refer to FIG. 5 , which is a schematic diagram of an embodiment of an electronic device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
本实施例的一种电子设备,该电子设备包括:显示器101;处理器102;以及存储器103,用于存储实现3D canvas网页元素的渲染方法的程序,该设备通 电并通过所述处理器运行该3D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对3D canvas网页元素的WebGL绘图指令;将所述WebGL绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。An electronic device of the embodiment, the electronic device includes: a display 101; a processor 102; and a memory 103, configured to store a program for implementing a rendering method of a 3D canvas webpage element, the device is After executing the program of the rendering method of the 3D canvas webpage element by the processor, performing the following steps: intercepting a WebGL drawing instruction for the 3D canvas webpage element; and transmitting the instruction information carried by the WebGL drawing instruction to the system framework And generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and drawing the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
与上述的方法相对应,本申请还提供一种2D canvas网页元素的渲染方法。下面首先对现有技术下的2D canvas网页元素的渲染方法及存在的问题作简要说明。Corresponding to the above method, the present application also provides a rendering method of a 2D canvas webpage element. The following is a brief description of the rendering method and existing problems of the 2D canvas webpage elements in the prior art.
现有技术下,HTML5 2D canvas在移动App中,依靠系统Webview来完成渲染绘制,性能上依赖于系统Webview。然而,HTML5的canvas元素在移动端的性能并不好,特别是在一些游戏、动画等高交互的页面上,canvas的性能问题更为明显,画面会出现卡顿、响应慢的现象。其中,由于Android手机的Android系统版本众多,各家手机厂商支持不一,定制化严重,HTML5 canvas性能瓶颈在Android手机上尤为突出。综上所述,现有技术存在2D canvas网页元素渲染性能低的问题。In the prior art, the HTML5 2D canvas relies on the system Webview to complete the rendering and drawing in the mobile app, and the performance depends on the system Webview. However, the performance of the HTML5 canvas element on the mobile side is not good, especially in some high-interaction pages such as games and animations. The performance of the canvas is more obvious, and the picture will appear stuck and slow. Among them, due to the numerous Android system versions of Android phones, various mobile phone manufacturers have different support and serious customization. The performance bottleneck of HTML5 canvas is particularly prominent on Android phones. In summary, the prior art has a problem that the rendering performance of the 2D canvas webpage element is low.
请参考图6,其为本申请提供的一种2D canvas网页元素的渲染方法实施例的流程图,本实施例与第一实施例内容相同的部分不再赘述,请参见实施例一中的相应部分。本申请提供的一种2D canvas网页元素的渲染方法包括:Please refer to FIG. 6 , which is a flowchart of a method for rendering a 2D canvas webpage element provided by the present application. The same parts of the first embodiment are not described again. Please refer to the corresponding example in the first embodiment. section. A rendering method of a 2D canvas webpage element provided by the present application includes:
步骤S101:截获对2D canvas网页元素的绘图指令。Step S101: Intercepting a drawing instruction to the 2D canvas webpage element.
本步骤与上述实施例一的步骤S101相对应,两者不同之处在于:上述实施例一的处理对象为3D canvas网页元素,而本方法的处理对象为2D canvas网页元素;相应的,上述实施例一截获WebGL绘图指令,而本方法截获对2D canvas的绘图指令。This step corresponds to the step S101 of the first embodiment, and the difference is that the processing object of the first embodiment is a 3D canvas webpage element, and the processing object of the method is a 2D canvas webpage element; correspondingly, the above implementation Example 1 intercepts the WebGL drawing instruction, and the method intercepts the drawing instruction for the 2D canvas.
本申请提供的2D canvas网页元素的渲染方法与上述3D canvas网页元素的渲染方法的核心思想及处理步骤完全一致,因此,本实施例不再对各个步骤做具体说明,相应部分请参见实施例一中的相关描述,此处不再赘述。下述描述的方法实施例仅仅是示意性的。The rendering method of the 2D canvas webpage element provided by the present application is completely consistent with the core idea and processing steps of the above-mentioned 3D canvas webpage element rendering method. Therefore, the specific steps are not specifically described in this embodiment. For the corresponding part, refer to the first embodiment. The related descriptions are not repeated here. The method embodiments described below are merely illustrative.
作为一种优选的方案,本步骤可采用如下方式:通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。 As a preferred solution, the step may be performed by capturing a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
步骤S103:将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层。Step S103: Transfer instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer.
作为一种优选的方案,本步骤可包括如下具体步骤:1)从所述2D canvas网页元素的绘图指令中提取所述指令信息;2)根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;3)将所述渲染命令从传送到所述系统框架层。As a preferred solution, the step may include the following steps: 1) extracting the instruction information from a drawing instruction of the 2D canvas webpage element; 2) converting the rule and the instruction information according to the first preset instruction, Generating a rendering command corresponding to the drawing instruction of the 2D canvas webpage element; 3) transferring the rendering command from the system framework layer.
步骤S105:根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令。Step S105: Generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information.
作为一种优选的方案,本步骤可包括如下具体步骤:1)将所述指令信息从所述系统框架层传送到系统本地层;2)在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。As a preferred solution, the step may include the following specific steps: 1) transmitting the instruction information from the system framework layer to a system local layer; 2) in the system local layer, according to the instruction information The OpenGL drawing instruction is generated.
步骤S107:将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。Step S107: Drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
作为一种优选的方案,本步骤可包括如下具体步骤:1)获取所述2D canvas网页元素对应的上下文信息及渲染目标;2)根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;3)将所述渲染目标输入到系统的离屏缓冲区。As a preferred solution, the step may include the following steps: 1) acquiring context information corresponding to the 2D canvas webpage element and a rendering target; 2) rendering the rendering according to the context information and the OpenGL drawing instruction. The target is rendered graphically; 3) the rendering target is input to the off-screen buffer of the system.
此外,本申请提供的方法还包括:对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述2D canvas网页元素所在网页的渲染结果。In addition, the method provided by the present application further includes synthesizing the OpenGL rendering window and the Webview window of the system to form a rendering result of the webpage where the 2D canvas webpage element is located.
请参考图7,其为本申请的2D canvas网页元素的渲染方法实施例的结构示意图。在本实施例中,实现本申请的2D canvas网页元素的渲染方法有四层结构,分别为:JavaScript托管模块层、桥接模块层、操作系统适配模块层、引擎模块层。下面对这些层次分别作简要说明。Please refer to FIG. 7 , which is a schematic structural diagram of an embodiment of a method for rendering a 2D canvas webpage element of the present application. In this embodiment, the rendering method for implementing the 2D canvas webpage element of the present application has a four-layer structure: a JavaScript hosting module layer, a bridge module layer, an operating system adaptation module layer, and an engine module layer. These levels are briefly described below.
1)JavaScript托管模块层:主要用于托管HTML5 2D canvas的API(绘图指令)和针对这些API实现本方案,本层的功能包括但不限于:canvas元素替换、渲染指令拼接与传递、交互指令响应、回调函数的响应、canvas元素大小与位置的计算、多个canvas的层管理等。1) JavaScript escrow module layer: mainly used to host HTML5 2D canvas API (drawing instructions) and implement the program for these APIs. The functions of this layer include but are not limited to: canvas element replacement, rendering instruction splicing and delivery, interactive command response , the response of the callback function, the calculation of the size and position of the canvas element, and the layer management of multiple canvases.
2)桥接模块层:主要用于JavaScript与操作系统层(即:上述系统框架层)代码(android:Java/iOS:OC)进行交互,有两种可以实现JavaScript与底层代码交互的方案,分别为:JS bridge、JS引擎。 2) Bridge module layer: mainly used for JavaScript and operating system layer (ie: the above system frame layer) code (android: Java / iOS: OC) to interact, there are two ways to achieve JavaScript and the underlying code interaction, respectively : JS bridge, JS engine.
3)操作系统适配模块层:主要用于实现自定义的渲染视窗(即:上述OpenGL渲染视窗),该自定义的渲染视窗用于展现HTML5 2D canvas的渲染输出结果;以及,管理多个视窗用(自定义的渲染视窗与其他HTML5元素的渲染视窗),以合成最终的渲染结果。如果在上一层(桥接模块层)中使用了JS bridge的方案,那么针对所选取的JS bridge,还需要实现JS bridge的适配插件用以接收由JS bridge传递给系统层的交互或渲染指令,并且按照需要进行处理或者转发。3) operating system adaptation module layer: mainly used to implement a custom rendering window (ie: the above OpenGL rendering window), the custom rendering window is used to display the rendering output of the HTML5 2D canvas; and, manage multiple windows Use (custom rendering windows and rendering windows for other HTML5 elements) to synthesize the final rendering results. If the JS bridge scheme is used in the upper layer (bridge module layer), then for the selected JS bridge, the JS bridge adapter plugin is also needed to receive the interaction or rendering instructions passed by the JS bridge to the system layer. And process or forward as needed.
4)引擎模块层:即上述系统本地层,主要用以创建、管理、销毁canvas实体(entity)与canvas 2d的上下文实体(context entity),根据接收到的渲染指令,调用相应的OpenGL ES API。在此层中还负责管理针对不同的canvas渲染到多个渲染层(render layer)的渲染目标(render target)中,最后将多个渲染目标通过OpenGL中的FBO技术合成到离屏渲染缓冲区。4) Engine module layer: The system local layer is mainly used to create, manage, and destroy the canvas entity (entity) and the canvas 2d context entity. The corresponding OpenGL ES API is called according to the received rendering instruction. In this layer, it is also responsible for managing rendering targets that are rendered to multiple render layers for different canvases. Finally, multiple rendering targets are synthesized into off-screen rendering buffers by FBO technology in OpenGL.
请参考图8,其为本申请的2D canvas网页元素的渲染方法实施例的具体流程图。图8所示的流程图对应上述方案的具体处理过程,结合图8能够更直观的理解上述方案的处理过程。下面结合图7对图8所示的具体流程图作简要说明。Please refer to FIG. 8 , which is a specific flowchart of an embodiment of a method for rendering a 2D canvas webpage element of the present application. The flowchart shown in FIG. 8 corresponds to the specific processing procedure of the above solution, and the processing procedure of the above scheme can be more intuitively understood in conjunction with FIG. 8. The specific flowchart shown in FIG. 8 will be briefly described below with reference to FIG.
1)JavaScript托管模块层1) JavaScript hosting module layer
查找HTML5页面中是否有可供替换的2D canvas元素,如有且能成功替换,则新建一个自定义的DOM元素将之插入原DOM树,并将原canvas元素删除,后续所有对于原canvas元素的调用、操作都将被新插入的DOM元素托管。在接收到2D canvas的调用后,将该API调用转化为内部实现的一套命令,并通过定时器进行传入系统适配层。Find out if there is a 2D canvas element to replace in the HTML5 page. If it can be successfully replaced, create a new custom DOM element and insert it into the original DOM tree, and delete the original canvas element. All subsequent to the original canvas element. Calls and operations will be hosted by the newly inserted DOM element. After receiving the 2D canvas call, the API call is converted into an internally implemented set of commands and passed to the system adaptation layer via a timer.
2)桥接模块层2) Bridge module layer
负责将JavaScript托管模块层生成的命令传给系统适配层。Responsible for passing commands generated by the JavaScript escrow module layer to the system adaptation layer.
3)操作系统适配模块层3) Operating system adaptation module layer
接收到命令后,拼装用于渲染2D canvas的视图与其他HTML5元素的视图,并将命令传给引擎模块层。After receiving the command, assemble the view for rendering the 2D canvas view with other HTML5 elements and pass the command to the engine module layer.
4)引擎模块层4) Engine module layer
接收到命令后,进行解析,获取相应的2D canvas上下文(如若没有则新建);合成器获取一个渲染目标(如果没有则新建)并且分配给2D canvas上下文;由2D canvas上下文根据解析的命令结果调用渲染器(renderer)对应的API,渲染 器调用相应的OpenGL ES API并将结果渲染至渲染目标中;合成器将多个渲染目标通过FBO的技术进行合成并且输入到系统的离屏缓冲区。After receiving the command, parse and obtain the corresponding 2D canvas context (if not new); the synthesizer acquires a render target (if not created) and assigns it to the 2D canvas context; the 2D canvas context is called according to the parsed command result Renderer corresponding to the renderer The corresponding OpenGL ES API is called and the result is rendered into the render target; the synthesizer combines multiple render targets through the FBO technique and inputs them into the system's off-screen buffer.
此时,本申请提供的2D canvas网页元素的渲染方法的主要工作均完成,操作系统将获得渲染控制权,并将渲染结果展示到屏幕上。At this time, the main work of the rendering method of the 2D canvas webpage element provided by the present application is completed, and the operating system will obtain rendering control and display the rendering result to the screen.
在上述的实施例中,提供了一种2D canvas网页元素的渲染方法,与之相对应的,本申请还提供一种2D canvas网页元素的渲染装置。该装置是与上述方法的实施例相对应。In the above embodiment, a rendering method of a 2D canvas webpage element is provided. Correspondingly, the present application further provides a rendering apparatus for a 2D canvas webpage element. The device corresponds to an embodiment of the above method.
请参看图9,其为本申请的2D canvas网页元素的渲染装置实施例的示意图。由于装置实施例基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。下述描述的装置实施例仅仅是示意性的。Please refer to FIG. 9 , which is a schematic diagram of an embodiment of a rendering apparatus for a 2D canvas webpage element of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
本实施例的一种2D canvas网页元素的渲染装置,包括:指令截获单元101,用于截获对2D canvas网页元素的绘图指令;指令传送单元103,用于将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;OpenGL指令生成单元105,用于根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;OpenGL指令绘制单元107,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。The apparatus for rendering a 2D canvas webpage element of the embodiment includes: an instruction intercepting unit 101, configured to intercept a drawing instruction for a 2D canvas webpage element; an instruction transmitting unit 103, configured to draw a drawing instruction of the 2D canvas webpage element The command information carried is transmitted to the system framework layer; the OpenGL instruction generating unit 105 is configured to generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; and an OpenGL instruction drawing unit 107, configured to The OpenGL drawing instruction is drawn to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
可选的,所述指令截获单元101,具体用于通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。Optionally, the instruction intercepting unit 101 is configured to intercept a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element.
可选的,所述指令传送单元103包括:Optionally, the instruction transmitting unit 103 includes:
指令信息提取子单元,用于从所述2D canvas网页元素的绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from a drawing instruction of the 2D canvas webpage element;
渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the drawing instruction of the 2D canvas webpage element according to the first preset instruction conversion rule and the instruction information;
渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
可选的,所述OpenGL指令生成单元105包括:Optionally, the OpenGL instruction generating unit 105 includes:
指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层;An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
OpenGL指令生成子单元,用于在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。 An OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the system local layer.
请参考图10,其为本申请的电子设备实施例的示意图。由于设备实施例基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。下述描述的设备实施例仅仅是示意性的。Please refer to FIG. 10 , which is a schematic diagram of an embodiment of an electronic device of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The device embodiments described below are merely illustrative.
本实施例的一种电子设备,该电子设备包括:显示器1101;处理器1102;以及存储器1103,用于存储实现2D canvas网页元素的渲染方法的程序,该设备通电并通过所述处理器运行该2D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对2D canvas网页元素的绘图指令;将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。An electronic device of the embodiment, the electronic device includes: a display 1101; a processor 1102; and a memory 1103, configured to store a program for implementing a rendering method of a 2D canvas webpage element, the device is powered on and runs by the processor After the program of the rendering method of the 2D canvas webpage element, the following steps are performed: intercepting the drawing instruction of the 2D canvas webpage element; transmitting the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer; according to the instruction And generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element; drawing the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
本申请提供的2D canvas网页元素的渲染方法、装置及电子设备,通过在移动App层面上截获对2D canvas网页元素的绘图指令,将2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层,再根据所述指令信息生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;并将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。采用本申请提供的方法,能够避免通过系统Webview对2D canvas网页元素进行渲染绘制,从而达到提高渲染性能的效果。The method, device and electronic device for rendering a 2D canvas webpage element provided by the present application transmit the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer by intercepting the drawing instruction of the 2D canvas webpage element on the mobile App level. And generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; and drawing the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element. By adopting the method provided by the present application, the rendering of the 2D canvas webpage element through the Webview of the system can be avoided, thereby improving the rendering performance.
本申请虽然以较佳实施例公开如上,但其并不是用来限定本申请,任何本领域技术人员在不脱离本申请的精神和范围内,都可以做出可能的变动和修改,因此本申请的保护范围应当以本申请权利要求所界定的范围为准。The present application is disclosed in the above preferred embodiments, but it is not intended to limit the present application, and any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present application. The scope of protection should be based on the scope defined by the claims of the present application.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。The memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory. Memory is an example of a computer readable medium.
1、计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其 他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。1. Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), Other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, CD-ROM (CD-ROM) ), a digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape storage or other magnetic storage device or any other non-transportable medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
2、本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。 2. Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.

Claims (31)

  1. 一种3D canvas网页元素的渲染方法,其特征在于,包括:A method for rendering a 3D canvas webpage element, comprising:
    截获对3D canvas网页元素的WebGL绘图指令;Intercepting WebGL drawing instructions for 3D canvas webpage elements;
    将所述WebGL绘图指令携带的指令信息传送到系统框架层;Transmitting instruction information carried by the WebGL drawing instruction to a system framework layer;
    根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;Generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information;
    将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。The OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  2. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述截获对3D canvas网页元素的WebGL绘图指令,采用如下方式:The method for rendering a 3D canvas webpage element according to claim 1, wherein the intercepting the WebGL drawing instruction for the 3D canvas webpage element is as follows:
    通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。The WebGL drawing instruction is intercepted by the replacement DOM object of the 3D canvas webpage element.
  3. 根据权利要求2所述的3D canvas网页元素的渲染方法,其特征在于,还包括:The method for rendering a 3D canvas webpage element according to claim 2, further comprising:
    将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象。The DOM object of the 3D canvas webpage element is replaced with the replacement DOM object.
  4. 根据权利要求3所述的3D canvas网页元素的渲染方法,其特征在于,在所述将所述3D canvas网页元素的DOM对象替换为所述替换DOM对象之前,还包括:The method for rendering a 3D canvas webpage element according to claim 3, further comprising: before the replacing the DOM object of the 3D canvas webpage element with the replacement DOM object,
    判断所述操作系统是否允许执行DOM对象替换的操作;若是,则进入下一步骤;若否,则使用Webview视窗绘制所述3D canvas网页元素。Determining whether the operating system allows to perform the operation of DOM object replacement; if yes, proceeding to the next step; if not, using the Webview window to draw the 3D canvas webpage element.
  5. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,包括:The method for rendering a 3D canvas webpage element according to claim 1, wherein the transmitting the instruction information carried by the WebGL drawing instruction to the system framework layer comprises:
    从所述WebGL绘图指令中提取所述指令信息;Extracting the instruction information from the WebGL drawing instruction;
    根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;Generating, according to the first preset instruction conversion rule and the instruction information, a rendering command corresponding to the WebGL drawing instruction;
    将所述渲染命令从传送到所述系统框架层。The rendering command is passed from the system framework layer.
  6. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,采用如下方式: The method for rendering a 3D canvas webpage element according to claim 1, wherein the instruction information carried by the WebGL drawing instruction is transmitted to a system framework layer in the following manner:
    通过JS bridge或者JavaScript引擎,将所述指令信息传送到所述系统框架层。The instruction information is transmitted to the system framework layer via a JS bridge or a JavaScript engine.
  7. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述将所述WebGL绘图指令携带的指令信息传送到系统框架层,采用如下方式:The method for rendering a 3D canvas webpage element according to claim 1, wherein the instruction information carried by the WebGL drawing instruction is transmitted to a system framework layer in the following manner:
    根据预设的时间间隔,将所述指令信息传送到所述系统框架层。The instruction information is transmitted to the system framework layer according to a preset time interval.
  8. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述生成与所述WebGL绘图指令对应的OpenGL绘图指令,包括:The method for rendering a 3D canvas webpage element according to claim 1, wherein the generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction comprises:
    将所述指令信息从所述系统框架层传送到系统本地层;Transmitting the instruction information from the system framework layer to a system local layer;
    在所述系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。In the system local layer, the OpenGL drawing instruction is generated according to the instruction information.
  9. 根据权利要求8所述的3D canvas网页元素的渲染方法,其特征在于,所述将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,包括:The method for rendering a 3D canvas webpage element according to claim 8, wherein the drawing the OpenGL drawing instruction to an OpenGL rendering window of the system comprises:
    获取所述3D canvas网页元素对应的上下文信息及渲染目标;Obtaining context information and a rendering target corresponding to the 3D canvas webpage element;
    根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;Performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction;
    将所述渲染目标输入到系统的离屏缓冲区。The rendering target is input to an offscreen buffer of the system.
  10. 根据权利要求9所述的3D canvas网页元素的渲染方法,其特征在于,所述将所述渲染目标输入到系统的离屏缓冲区,采用如下方式:The method for rendering a 3D canvas webpage element according to claim 9, wherein the inputting the rendering target to an off-screen buffer of the system is as follows:
    通过FBO技术,将多个所述渲染目标合成到所述离屏缓冲区;不同的所述渲染目标对应不同的所述3D canvas网页元素。A plurality of the rendering targets are synthesized into the off-screen buffer by FBO technology; different rendering targets correspond to different 3D canvas webpage elements.
  11. 根据权利要求9所述的3D canvas网页元素的渲染方法,其特征在于,在所述获取所述3D canvas元素对应的上下文信息及所述渲染目标之前,还包括:The method for rendering a 3D canvas webpage element according to claim 9, wherein before the acquiring the context information corresponding to the 3D canvas element and the rendering target, the method further includes:
    判断所述上下文信息及所述渲染目标是否存在;若否,则创建所述上下文信息及所述渲染目标,以及对所述上下文信息和所述渲染目标进行绑定。Determining whether the context information and the rendering target are present; if not, creating the context information and the rendering target, and binding the context information and the rendering target.
  12. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,还包括:The method for rendering a 3D canvas webpage element according to claim 1, further comprising:
    对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述3D canvas网页元素所在网页的渲染结果。 The OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 3D canvas webpage element is located.
  13. 根据权利要求12所述的3D canvas网页元素的渲染方法,其特征在于,所述对所述OpenGL渲染视窗和系统的Webview视窗进行合成,采用如下方式:The method for rendering a 3D canvas webpage element according to claim 12, wherein the synthesizing the OpenGL rendering window and the webview window of the system are as follows:
    通过系统的窗口管理机制,将所述OpenGL渲染视窗和所述Webview视窗混合。The OpenGL rendering window and the Webview window are mixed by a window management mechanism of the system.
  14. 根据权利要求12所述的3D canvas网页元素的渲染方法,其特征在于,所述Webview视窗中绘制了所述网页内的非3D canvas网页元素。The method for rendering a 3D canvas webpage element according to claim 12, wherein the non-3D canvas webpage element in the webpage is drawn in the webview window.
  15. 根据权利要求1所述的3D canvas网页元素的渲染方法,其特征在于,所述系统包括Andriod系统或iOS系统。The method for rendering a 3D canvas webpage element according to claim 1, wherein the system comprises an Andriod system or an iOS system.
  16. 一种3D canvas网页元素的渲染装置,其特征在于,包括:A rendering device for a 3D canvas webpage element, comprising:
    WebGL指令截获单元,用于截获对3D canvas网页元素的WebGL绘图指令;a WebGL instruction intercepting unit for intercepting a WebGL drawing instruction for a 3D canvas webpage element;
    WebGL指令传送单元,用于将所述WebGL绘图指令携带的指令信息传送到系统框架层;a WebGL instruction transfer unit, configured to transfer instruction information carried by the WebGL drawing instruction to a system framework layer;
    OpenGL指令生成单元,用于根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;An OpenGL instruction generating unit, configured to generate an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information;
    OpenGL指令绘制单元,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction into an OpenGL rendering window of the system to form a rendering result of the 3D canvas webpage element.
  17. 根据权利要求16所述的3D canvas网页元素的渲染装置,其特征在于,所述WebGL指令截获单元,具体用于通过所述3D canvas网页元素的替换DOM对象,截获所述WebGL绘图指令。The apparatus for rendering a 3D canvas webpage element according to claim 16, wherein the WebGL instruction intercepting unit is specifically configured to intercept the WebGL drawing instruction by using a replacement DOM object of the 3D canvas webpage element.
  18. 根据权利要求16所述的3D canvas网页元素的渲染装置,其特征在于,所述WebGL指令传送单元包括:The apparatus for rendering a 3D canvas webpage element according to claim 16, wherein the WebGL instruction transfer unit comprises:
    指令信息提取子单元,用于从所述WebGL绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from the WebGL drawing instruction;
    渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述WebGL绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the WebGL drawing instruction according to the first preset instruction conversion rule and the instruction information;
    渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  19. 根据权利要求16所述的3D canvas网页元素的渲染装置,其特征在于,所述OpenGL指令生成单元包括:The apparatus for rendering a 3D canvas webpage element according to claim 16, wherein the OpenGL instruction generating unit comprises:
    指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层; An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
    OpenGL指令生成子单元,用于在所述系统本地层中,根据所述指令信息生成所述OpenGL绘图指令。The OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the local layer of the system.
  20. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    显示器;monitor;
    处理器;以及Processor;
    存储器,用于存储实现3D canvas网页元素的渲染方法的程序,该设备通电并通过所述处理器运行该3D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对3D canvas网页元素的WebGL绘图指令;将所述WebGL绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述WebGL绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述3D canvas网页元素的渲染结果。a program for storing a rendering method for implementing a 3D canvas webpage element. After the device is powered on and runs the program of the rendering method of the 3D canvas webpage element by the processor, the following steps are performed: intercepting the 3D canvas webpage element a WebGL drawing instruction; transmitting instruction information carried by the WebGL drawing instruction to a system framework layer; generating an OpenGL drawing instruction corresponding to the WebGL drawing instruction according to the instruction information; and drawing the OpenGL drawing instruction to a system OpenGL Rendering a window to form a rendering result of the 3D canvas webpage element.
  21. 一种2D canvas网页元素的渲染方法,其特征在于,包括:A method for rendering a 2D canvas webpage element, comprising:
    截获对2D canvas网页元素的绘图指令;Intercepting drawing instructions for 2D canvas webpage elements;
    将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;Transmitting instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer;
    根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;Generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information;
    将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。The OpenGL drawing instruction is drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  22. 根据权利要求21所述的2D canvas网页元素的渲染方法,其特征在于,所述截获对2D canvas网页元素的WebGL绘图指令,采用如下方式:The method for rendering a 2D canvas webpage element according to claim 21, wherein the intercepting the WebGL drawing instruction for the 2D canvas webpage element is as follows:
    通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。Drawing instructions of the 2D canvas webpage element are intercepted by the replacement DOM object of the 2D canvas webpage element.
  23. 根据权利要求21所述的2D canvas网页元素的渲染方法,其特征在于,所述将所述对2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层,包括:The method for rendering a 2D canvas webpage element according to claim 21, wherein the transmitting the instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer comprises:
    从所述2D canvas网页元素的绘图指令中提取所述指令信息;Extracting the instruction information from a drawing instruction of the 2D canvas webpage element;
    根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;Generating, according to the first preset instruction conversion rule and the instruction information, a rendering command corresponding to the drawing instruction of the 2D canvas webpage element;
    将所述渲染命令从传送到所述系统框架层。 The rendering command is passed from the system framework layer.
  24. 根据权利要求21所述的2D canvas网页元素的渲染方法,其特征在于,所述生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令,包括:The method for rendering a 2D canvas webpage element according to claim 21, wherein the generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element comprises:
    将所述指令信息从所述系统框架层传送到系统本地层;Transmitting the instruction information from the system framework layer to a system local layer;
    在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。In the system local layer, the OpenGL drawing instruction is generated according to the instruction information.
  25. 根据权利要求24所述的2D canvas网页元素的渲染方法,其特征在于,所述将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,包括:The method for rendering a 2D canvas webpage element according to claim 24, wherein the drawing the OpenGL drawing instruction to an OpenGL rendering window of the system comprises:
    获取所述2D canvas网页元素对应的上下文信息及渲染目标;Obtaining context information and a rendering target corresponding to the 2D canvas webpage element;
    根据所述上下文信息和所述OpenGL绘图指令,对所述渲染目标进行图形渲染;Performing graphics rendering on the rendering target according to the context information and the OpenGL drawing instruction;
    将所述渲染目标输入到系统的离屏缓冲区。The rendering target is input to an offscreen buffer of the system.
  26. 根据权利要求21所述的2D canvas网页元素的渲染方法,其特征在于,还包括:The method for rendering a 2D canvas webpage element according to claim 21, further comprising:
    对所述OpenGL渲染视窗和系统的Webview视窗进行合成,形成所述2D canvas网页元素所在网页的渲染结果。The OpenGL rendering window and the Webview window of the system are combined to form a rendering result of the webpage where the 2D canvas webpage element is located.
  27. 一种2D canvas网页元素的渲染装置,其特征在于,包括:A rendering device for a 2D canvas webpage element, comprising:
    指令截获单元,用于截获对2D canvas网页元素的绘图指令;An instruction intercepting unit, configured to intercept a drawing instruction for a 2D canvas webpage element;
    指令传送单元,用于将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;An instruction transmitting unit, configured to transmit instruction information carried by the drawing instruction of the 2D canvas webpage element to a system framework layer;
    OpenGL指令生成单元,用于根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;An OpenGL instruction generating unit, configured to generate an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information;
    OpenGL指令绘制单元,用于将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。An OpenGL instruction drawing unit is configured to draw the OpenGL drawing instruction to an OpenGL rendering window of the system to form a rendering result of the 2D canvas webpage element.
  28. 根据权利要求27所述的2D canvas网页元素的渲染装置,其特征在于,所述指令截获单元,具体用于通过所述2D canvas网页元素的替换DOM对象,截获所述2D canvas网页元素的绘图指令。The apparatus for rendering a 2D canvas webpage element according to claim 27, wherein the instruction intercepting unit is configured to intercept a drawing instruction of the 2D canvas webpage element by using a replacement DOM object of the 2D canvas webpage element. .
  29. 根据权利要求27所述的2D canvas网页元素的渲染装置,其特征在于,所述指令传送单元包括: The apparatus for rendering a 2D canvas webpage element according to claim 27, wherein the instruction transmitting unit comprises:
    指令信息提取子单元,用于从所述2D canvas网页元素的绘图指令中提取所述指令信息;An instruction information extraction subunit, configured to extract the instruction information from a drawing instruction of the 2D canvas webpage element;
    渲染命令生成子单元,用于根据第一预设指令转换规则和所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的渲染命令;a rendering command generating subunit, configured to generate a rendering command corresponding to the drawing instruction of the 2D canvas webpage element according to the first preset instruction conversion rule and the instruction information;
    渲染命令传送子单元,用于将所述渲染命令从传送到所述系统框架层。A rendering command transfer subunit is configured to transfer the rendering command from the system framework layer.
  30. 根据权利要求27所述的2D canvas网页元素的渲染装置,其特征在于,所述OpenGL指令生成单元包括:The rendering device of the 2D canvas webpage element according to claim 27, wherein the OpenGL instruction generating unit comprises:
    指令信息传送子单元,用于将所述指令信息从所述系统框架层传送到系统本地层;An instruction information transmitting subunit, configured to transfer the instruction information from the system framework layer to a system local layer;
    OpenGL指令生成子单元,用于在所述系统本地层中,根据将所述指令信息生成所述OpenGL绘图指令。An OpenGL instruction generation subunit is configured to generate the OpenGL drawing instruction according to the instruction information in the system local layer.
  31. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    显示器;monitor;
    处理器;以及Processor;
    存储器,用于存储实现2D canvas网页元素的渲染方法的程序,该设备通电并通过所述处理器运行该2D canvas网页元素的渲染方法的程序后,执行下述步骤:截获对2D canvas网页元素的绘图指令;将所述2D canvas网页元素的绘图指令携带的指令信息传送到系统框架层;根据所述指令信息,生成与所述2D canvas网页元素的绘图指令对应的OpenGL绘图指令;将所述OpenGL绘图指令绘制到系统的OpenGL渲染视窗,形成所述2D canvas网页元素的渲染结果。 a program for storing a rendering method for implementing a 2D canvas webpage element. After the device is powered on and runs the program of the rendering method of the 2D canvas webpage element by the processor, the following steps are performed: intercepting the 2D canvas webpage element a drawing instruction; transmitting instruction information carried by the drawing instruction of the 2D canvas webpage element to the system framework layer; and generating an OpenGL drawing instruction corresponding to the drawing instruction of the 2D canvas webpage element according to the instruction information; The drawing instructions are drawn to the OpenGL rendering window of the system to form a rendering result of the 2D canvas web page element.
PCT/CN2017/100536 2016-09-14 2017-09-05 3d canvas web page element rendering method and apparatus, and electronic device WO2018050003A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610827353.8 2016-09-14
CN201610827353.8A CN107832108B (en) 2016-09-14 2016-09-14 Rendering method and device of 3D canvas webpage elements and electronic equipment

Publications (1)

Publication Number Publication Date
WO2018050003A1 true WO2018050003A1 (en) 2018-03-22

Family

ID=61619759

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/100536 WO2018050003A1 (en) 2016-09-14 2017-09-05 3d canvas web page element rendering method and apparatus, and electronic device

Country Status (3)

Country Link
CN (2) CN113282360A (en)
TW (1) TW201812613A (en)
WO (1) WO2018050003A1 (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109544653A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of WebGL independent process rendering method and electronic equipment based on education operating system
CN109636885A (en) * 2018-11-28 2019-04-16 广东智合创享营销策划有限公司 A kind of sequence frame animation method and system for the H5 page
CN110322532A (en) * 2018-03-27 2019-10-11 优酷网络技术(北京)有限公司 The generation method and device of dynamic image
EP3623938A1 (en) * 2018-09-12 2020-03-18 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method and apparatus, and non-transitory computer-readable storage medium
EP3627318A1 (en) * 2018-09-12 2020-03-25 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method and apparatus, terminal, and non-transitory computer-readable storage medium
CN111581564A (en) * 2020-05-10 2020-08-25 青岛希望鸟科技有限公司 Webpage synchronous communication method realized by applying Canvas
CN112269575A (en) * 2020-11-18 2021-01-26 安徽四创电子股份有限公司 Method for rendering dynamic two-dimensional scene by canvas
CN112540815A (en) * 2020-11-23 2021-03-23 深圳晶泰科技有限公司 Multi-Web 3D scene off-screen rendering method
CN112947916A (en) * 2021-02-05 2021-06-11 北京百度网讯科技有限公司 Method, device, equipment and storage medium for realizing online canvas
CN115474074A (en) * 2022-08-29 2022-12-13 咪咕文化科技有限公司 Video background replacing method and device, computing equipment and storage medium
CN115937380A (en) * 2021-08-24 2023-04-07 荣耀终端有限公司 Method and device for rendering graph and storage medium
CN116700694A (en) * 2023-08-07 2023-09-05 深圳凡泰极客科技有限责任公司 Applet engine

Families Citing this family (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI682291B (en) * 2018-05-23 2020-01-11 中華電信股份有限公司 Webpage dynamic generating method, webpage generation apparatus and computer program product
CN108959392B (en) 2018-05-31 2020-11-10 创新先进技术有限公司 Method, device and equipment for displaying rich text on 3D model
CN110609677A (en) * 2018-06-15 2019-12-24 搜游网络科技(北京)有限公司 WebGL-based graph drawing method, device and system
CN110609682B (en) * 2018-06-15 2023-09-19 北京蓝亚盒子科技有限公司 Graphics drawing method, device and system based on WebGL
CN109271155A (en) * 2018-09-11 2019-01-25 Oppo广东移动通信有限公司 The capacity calling method and Related product of gaming platform
CN110929201B (en) * 2018-09-20 2022-06-28 中国科学院信息工程研究所 Complex network topology editing and visualization system based on Web
CN109343774B (en) * 2018-10-29 2021-04-20 广东明星创意动画有限公司 Rapid file preprocessing rendering system
CN109614563B (en) * 2018-12-05 2021-06-08 北京达佳互联信息技术有限公司 Method, device and equipment for displaying webpage and storage medium
CN109658250B (en) * 2018-12-29 2021-11-12 深圳源中瑞科技有限公司 Stock transaction K-line processing method based on webpage and storage medium
CN111506841B (en) * 2019-01-30 2023-06-09 阿里巴巴集团控股有限公司 Webpage display method, device, equipment and readable storage medium
CN110083231B (en) * 2019-03-12 2022-04-08 杭州电子科技大学 WebGL panoramic display method for android VR integrated head display
CN111796812B (en) * 2019-04-04 2022-11-04 厦门雅基软件有限公司 Image rendering method and device, electronic equipment and computer readable storage medium
CN110347463B (en) * 2019-06-25 2022-04-08 荣耀终端有限公司 Image processing method, related device and computer storage medium
CN110413914A (en) * 2019-07-25 2019-11-05 中南民族大学 Rendering method, device, equipment and storage medium based on WebGL
CN112351222B (en) * 2019-08-09 2022-05-24 北京字节跳动网络技术有限公司 Image special effect processing method and device, electronic equipment and computer readable storage medium
CN110727481A (en) * 2019-09-06 2020-01-24 平安国际智慧城市科技股份有限公司 Picture editing method and device, computer equipment and storage medium
CN111275782B (en) * 2020-01-17 2023-09-08 广州图匠数据科技有限公司 Graph drawing method and device, terminal equipment and storage medium
CN111354063B (en) * 2020-03-10 2023-09-08 深信服科技股份有限公司 Three-dimensional element rendering method, desktop cloud server and desktop cloud system
CN111562962B (en) * 2020-04-29 2023-07-04 百度在线网络技术(北京)有限公司 Picture rendering method and device, electronic equipment and storage medium
CN112380296A (en) * 2020-11-23 2021-02-19 北京明略软件系统有限公司 ER (ER) graph generation method, system, electronic equipment and storage medium
WO2022104786A1 (en) * 2020-11-23 2022-05-27 深圳晶泰科技有限公司 Multi-web 3d scenario off-screen rendering method
CN112947969B (en) * 2021-03-10 2022-12-16 支付宝(杭州)信息技术有限公司 Page off-screen rendering method, device, equipment and readable medium
CN113570733A (en) * 2021-08-05 2021-10-29 稿定(厦门)科技有限公司 WebGL-based graphic rendering method, device and system
CN113694523A (en) * 2021-08-30 2021-11-26 上海哔哩哔哩科技有限公司 H5 game display method and device based on mobile terminal APP and computer equipment
CN115525852A (en) * 2021-10-28 2022-12-27 北京字节跳动网络技术有限公司 Webpage rendering method, device, equipment and storage medium
CN114222149A (en) * 2021-11-17 2022-03-22 武汉斗鱼鱼乐网络科技有限公司 Plug flow method, device, medium and computer equipment
CN116402937A (en) * 2023-03-30 2023-07-07 中国舰船研究设计中心 Web-based 3D visual simplified development method for complex data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102087598A (en) * 2011-02-22 2011-06-08 深圳市同洲电子股份有限公司 Method, device and browsing device for displaying 3D interface
CN102254292A (en) * 2010-05-20 2011-11-23 盛乐信息技术(上海)有限公司 Remote 3D instruction rendering system and method
CN103336816A (en) * 2013-06-28 2013-10-02 广州市动景计算机科技有限公司 Canvas element rendering method and device realized on Android system based on GPU (Graphic Processing Unit)
CN103713891A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Method and device for graphic rendering on mobile device
US20150286739A1 (en) * 2012-11-06 2015-10-08 Layabox Inc. Html5-protocol-based webpage presentation method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591651B (en) * 2011-12-26 2015-02-11 Tcl集团股份有限公司 Webpage 3D (three-dimensional) rendering and controlling method and device
CN104978357B (en) * 2014-04-10 2018-08-24 阿里巴巴集团控股有限公司 A kind of data visualization shows method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102254292A (en) * 2010-05-20 2011-11-23 盛乐信息技术(上海)有限公司 Remote 3D instruction rendering system and method
CN102087598A (en) * 2011-02-22 2011-06-08 深圳市同洲电子股份有限公司 Method, device and browsing device for displaying 3D interface
CN103713891A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Method and device for graphic rendering on mobile device
US20150286739A1 (en) * 2012-11-06 2015-10-08 Layabox Inc. Html5-protocol-based webpage presentation method and device
CN103336816A (en) * 2013-06-28 2013-10-02 广州市动景计算机科技有限公司 Canvas element rendering method and device realized on Android system based on GPU (Graphic Processing Unit)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110322532A (en) * 2018-03-27 2019-10-11 优酷网络技术(北京)有限公司 The generation method and device of dynamic image
EP3623938B1 (en) * 2018-09-12 2021-06-16 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method and apparatus, and non-transitory computer-readable storage medium
EP3623938A1 (en) * 2018-09-12 2020-03-18 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method and apparatus, and non-transitory computer-readable storage medium
EP3627318A1 (en) * 2018-09-12 2020-03-25 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method and apparatus, terminal, and non-transitory computer-readable storage medium
US10866818B2 (en) 2018-09-12 2020-12-15 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method, terminal device, and non-transitory computer-readable storage medium
US10991151B2 (en) 2018-09-12 2021-04-27 Guangdong Oppo Mobile Telecommunications Corp., Ltd. Game rendering method, terminal, and non-transitory computer-readable storage medium
CN109544653A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of WebGL independent process rendering method and electronic equipment based on education operating system
CN109544653B (en) * 2018-10-26 2023-05-16 深圳点猫科技有限公司 WebGL independent process rendering method based on education operating system and electronic equipment
CN109636885A (en) * 2018-11-28 2019-04-16 广东智合创享营销策划有限公司 A kind of sequence frame animation method and system for the H5 page
CN109636885B (en) * 2018-11-28 2023-07-04 广东智合创享营销策划有限公司 Sequential frame animation production method and system for H5 page
CN111581564A (en) * 2020-05-10 2020-08-25 青岛希望鸟科技有限公司 Webpage synchronous communication method realized by applying Canvas
CN111581564B (en) * 2020-05-10 2023-12-12 青岛希望鸟科技有限公司 Webpage synchronous communication method implemented by Canvas
CN112269575A (en) * 2020-11-18 2021-01-26 安徽四创电子股份有限公司 Method for rendering dynamic two-dimensional scene by canvas
CN112540815B (en) * 2020-11-23 2023-05-05 深圳晶泰科技有限公司 Multi-Web 3D scene off-screen rendering method
CN112540815A (en) * 2020-11-23 2021-03-23 深圳晶泰科技有限公司 Multi-Web 3D scene off-screen rendering method
CN112947916A (en) * 2021-02-05 2021-06-11 北京百度网讯科技有限公司 Method, device, equipment and storage medium for realizing online canvas
CN112947916B (en) * 2021-02-05 2023-09-19 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for implementing online canvas
CN115937380A (en) * 2021-08-24 2023-04-07 荣耀终端有限公司 Method and device for rendering graph and storage medium
CN115474074A (en) * 2022-08-29 2022-12-13 咪咕文化科技有限公司 Video background replacing method and device, computing equipment and storage medium
CN116700694A (en) * 2023-08-07 2023-09-05 深圳凡泰极客科技有限责任公司 Applet engine
CN116700694B (en) * 2023-08-07 2024-01-26 深圳凡泰极客科技有限责任公司 Applet engine

Also Published As

Publication number Publication date
CN107832108A (en) 2018-03-23
TW201812613A (en) 2018-04-01
CN107832108B (en) 2021-05-07
CN113282360A (en) 2021-08-20

Similar Documents

Publication Publication Date Title
WO2018050003A1 (en) 3d canvas web page element rendering method and apparatus, and electronic device
US10026147B1 (en) Graphics scenegraph rendering for web applications using native code modules
US10545749B2 (en) System for cloud computing using web components
US11902377B2 (en) Methods, systems, and computer program products for implementing cross-platform mixed-reality applications with a scripting framework
US20210303108A1 (en) System and method for on-screen graphical user interface encapsulation and reproduction
US10013157B2 (en) Composing web-based interactive 3D scenes using high order visual editor commands
US9122657B2 (en) Webpage display system leveraging OSGI
US10207190B2 (en) Technologies for native game experience in web rendering engine
US9928637B1 (en) Managing rendering targets for graphics processing units
KR20160120343A (en) Cross-platform rendering engine
CN108304239B (en) Rapid interface interaction method and device for remote operation
CN111966354A (en) Page display method and device and computer readable storage medium
US20190080017A1 (en) Method, system, and device that invokes a web engine
WO2019228013A1 (en) Method, apparatus and device for displaying rich text on 3d model
KR20220080007A (en) Augmented reality-based display method, device and storage medium
CN114741081B (en) Cross-operation environment display output sharing method based on heterogeneous cache access
WO2022033131A1 (en) Animation rendering method based on json data format
US8854368B1 (en) Point sprite rendering in a cross platform environment
KR20130017337A (en) Hybrid app development platform architecture and test method of the same, and computer-readable recording medium with program for the same
CN111324381B (en) Development system, development method, development apparatus, computer device, and storage medium
US11758016B2 (en) Hosted application as web widget toolkit
US10347043B2 (en) Core animation portals
CN113419806B (en) Image processing method, device, computer equipment and storage medium
CN115391692A (en) Video processing method and device
CN114371838A (en) Method, device and equipment for rendering small program canvas and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17850205

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17850205

Country of ref document: EP

Kind code of ref document: A1