Summary of the invention
In order to solve at present entirely because the inner principle complexity of liquid crystal automobile instrument, design difficulty are high, to the high high problem of full liquid crystal Vehicle Instrument Design cost causing of hardware requirement, and then provide a kind of full liquid crystal automobile instrument graphics frame design method based on OpenGL ES.
Based on the full liquid crystal automobile instrument graphics frame design method of OpenGL ES, the method realizes by following steps,
Step 1, set up ACTOR structure;
The data field of ACTOR structure is comprised of the following:
[TypeFlag], represents that this is to liking graphic element or container, the corresponding assembly directly showing on screen of graphic element, and container is used for holding other spirte elements and sub-container;
[next], the pointer of next ACTOR structure is pointed in storage;
[ShowFlag], whether presentation graphic element is finally presented on screen;
[VertexCoord], the apex coordinate of presentation graphic element;
[TextureCoord], the texture coordinate of presentation graphic element binded texture;
[TextureIndex], the index value of presentation graphic element binded texture in whole texture arrays;
[ChildTextureTotal], the sum of the texture neutron texture of presentation graphic element binding;
[ChildTextureIndex], the index value of presentation graphic element binded texture neutron texture;
[PTextureImage], the pointer in data texturing district is pointed in expression;
[Layer], the figure level number that presentation graphic element shows on screen;
[CoordTransMatrix], the matrix of denotation coordination conversion;
[LinkTable], when [TypeFlag] in ACTOR structure indicated object is container, represents to point to the pointer of CONTAINER_LINK structure, for realizing the tree structure of ACTOR;
Step 2, set up TIMELINE structure;
The data field of TIMELINE structure is comprised of the following:
[TimerTick], represents that this animation refreshes the clock ticktack number of frame needs;
[TimerFrameCount], represents the frame number that this animation has shown;
[FrameNumber], represents the frame sum in animation time axle;
[RepeatFlag], represent this animation be single-shot or circulation;
[TransforArgs], represents whole parameters that a complete animation needs;
[ActorAddr], in deposit the pointer that points to pictorial element or container, represent the action object of animation;
[timer_handler], is a function pointer, points to the function of movement of animation;
[next], the pointer of next TIMELINE structure is pointed in storage;
[last], the pointer of a upper TIMELINE structure is pointed in storage;
Step 3, set up CONTAINER_LINK structure;
The data field of CONTAINER_LINK structure is comprised of the following:
[ActorAddr], points to a graphic element or a container;
[next], the pointer of next CONTAINER_LINK structure is pointed in storage;
Step 4, foundation realize the Key Functions that ACTOR structure is operated, and this function is used for: initialization ACTOR chained list; Parameters in ACTOR structure is set; Set up new ACTOR node and added chained list; The ACTOR node of the ACTOR node of graphic element type or Container Type is connected to by [LinkTable] on the ACTOR node of Container Type;
Step 5, foundation realize the Key Functions that TIMELINE structure is operated, and this function is used for: initialization TIMELINE chained list; Parameters in TIMELINE structure is set; Set up new TIMELINE node and added chained list; The TIMELINE node of single-shot animation is deleted from chained list;
Step 6, foundation realize the function of movement collection of handling ACTOR conversion; This function concentration function is used for:
Spirte element in recursive search ACTOR container neutron graphic element or sub-container is also converted; Be used for realizing image action;
Step 7, foundation realize the function that ACTOR structure and TIMELINE structure and function of movement are associated;
This function is used for: [ActorAddr] of TIMELINE structure pointed to an ACTOR node of action, and [timer_handler] in TIMELINE structure pointed to the function of realizing action;
Step 8, set up to realize and search the action of ready time shaft and by the function of its execution;
This function is used for, traversal TIMELINE chained list, and comparison present clock drips and TIMELINE data field [TimerTick], and the match is successful carries out the function of movement that TIMELINE data field [timer_handler] points to; Mate the unsuccessful next TIMELINE node of analyzing; After the whole frames in TIMELINE node refresh, if this time shaft circulates, start a new cycle; If this time shaft is single-shot, this TIMELINE node is deleted from TIMELINE chained list;
Step 9, foundation realize the function of screen-refresh;
This function is used for, traversal ACTOR chained list, and the graphic element that each being labeled as " can be shown " is drawn on screen successively, and mutually covers according to the hierarchical relationship of each figure layer;
Step 10, set up timing mechanism; Adopt timer as the heartbeat all the time of whole framework, each drip all the time in, in execution step eight, mention search ready time shaft action and by the function of the screen-refresh of mentioning in the function of its execution and step 9.
The invention has the beneficial effects as follows: the invention provides the various functions such as figure demonstration, time shaft animation tissue and layer management, advantage of the present invention has:
1, the designed frame system of the present invention reduces design cost and the size of code on this framework, is convenient to maintenance and the edition upgrading of code.
2, the graphics frame system that the present invention describes only provides the mechanism of drawing, moving that realizes, and additional any strategy on this, make that inner principle is simple, design easily, developer can realize various Expected Results flexibly on the basis of framework, and can on this frame system basis, design the implementation method that is applied to the each display module of automobile instrument.
3, the graphics frame system bottom that the present invention describes only depends on OpenGL ES shape library, and this shape library has been transplanted in each operating system, therefore this frame system can be transplanted making after small modification between different operating system, the reusability and the portability that have improved this frame system, improved 10% on year-on-year basis.
4, OpenGL ES takes full advantage of hardware-accelerated in realization, operational efficiency is high, improved on year-on-year basis 15%, therefore the graphics frame system that the present invention describes can operate on embedded platform efficiently, requirement to hardware is lower, save hardware cost, reduced on year-on-year basis 10%, met the requirement of full liquid crystal automobile instrument.
The structure organization of the graphics frame system that the method for designing of graphics frame system of the present invention obtains is reasonable, and API is clearly easy-to-use.
Embodiment
Embodiment one: below in conjunction with Fig. 1 to Fig. 4, present embodiment is described, the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in present embodiment, the method realizes by following steps,
Step 1, set up ACTOR structure;
The data field of ACTOR structure is comprised of the following:
[TypeFlag], represents that this is to liking graphic element or container, the corresponding assembly directly showing on screen of graphic element, and container is used for holding other spirte elements and sub-container;
[next], the pointer of next ACTOR structure is pointed in storage;
[ShowFlag], whether presentation graphic element is finally presented on screen;
[VertexCoord], the apex coordinate of presentation graphic element;
[TextureCoord], the texture coordinate of presentation graphic element binded texture;
[TextureIndex], the index value of presentation graphic element binded texture in whole texture arrays;
[ChildTextureTotal], the sum of the texture neutron texture of presentation graphic element binding;
[ChildTextureIndex], the index value of presentation graphic element binded texture neutron texture;
[PTextureImage], the pointer in data texturing district is pointed in expression;
[Layer], the figure level number that presentation graphic element shows on screen;
[CoordTransMatrix], the matrix of denotation coordination conversion;
[LinkTable], when [TypeFlag] in ACTOR structure indicated object is container, represents to point to the pointer of CONTAINER_LINK structure, for realizing the tree structure of ACTOR;
Step 2, set up TIMELINE structure;
The data field of TIMELINE structure is comprised of the following:
[TimerTick], represents that this animation refreshes the clock ticktack number of frame needs;
[TimerFrameCount], represents the frame number that this animation has shown;
[FrameNumber], represents the frame sum in animation time axle;
[RepeatFlag], represent this animation be single-shot or circulation;
[TransforArgs], represents whole parameters that a complete animation needs;
[ActorAddr], in deposit the pointer that points to pictorial element or container, represent the action object of animation;
[timer_handler], is a function pointer, points to the function of movement of animation;
[next], the pointer of next TIMELINE structure is pointed in storage;
[last], the pointer of a upper TIMELINE structure is pointed in storage;
Step 3, set up CONTAINER_LINK structure;
The data field of CONTAINER_LINK structure is comprised of the following:
[ActorAddr], points to a graphic element or a container;
[next], the pointer of next CONTAINER_LINK structure is pointed in storage;
Step 4, foundation realize the Key Functions that ACTOR structure is operated, and this function is used for: initialization ACTOR chained list; Parameters in ACTOR structure is set; Set up new ACTOR node and added chained list; The ACTOR node of the ACTOR node of graphic element type or Container Type is connected to by [LinkTable] on the ACTOR node of Container Type;
Step 5, foundation realize the Key Functions that TIMELINE structure is operated, and this function is used for: initialization TIMELINE chained list; Parameters in TIMELINE structure is set; Set up new TIMELINE node and added chained list; The TIMELINE node of single-shot animation is deleted from chained list;
Step 6, foundation realize the function of movement collection of handling ACTOR conversion; This function concentration function is used for:
Spirte element in recursive search ACTOR container neutron graphic element or sub-container is also converted; Be used for realizing image action;
Step 7, foundation realize the function that ACTOR structure and TIMELINE structure and function of movement are associated;
This function is used for: [ActorAddr] of TIMELINE structure pointed to an ACTOR node of action, and [timer_handler] in TIMELINE structure pointed to the function of realizing action;
Step 8, set up to realize and search the action of ready time shaft and by the function of its execution;
This function is used for, traversal TIMELINE chained list, and comparison present clock drips and TIMELINE data field [TimerTick], and the match is successful carries out the function of movement that TIMELINE data field [timer_handler] points to; Mate the unsuccessful next TIMELINE node of analyzing; After the whole frames in TIMELINE node refresh, if this time shaft circulates, start a new cycle; If this time shaft is single-shot, this TIMELINE node is deleted from TIMELINE chained list;
Step 9, foundation realize the function of screen-refresh;
This function is used for, traversal ACTOR chained list, and the graphic element that each being labeled as " can be shown " is drawn on screen successively, and mutually covers according to the hierarchical relationship of each figure layer;
Step 10, set up timing mechanism; Adopt timer as the heartbeat all the time of whole framework, each drip all the time in, in execution step eight, mention search ready time shaft action and by the function of the screen-refresh of mentioning in the function of its execution and step 9.
In present embodiment, the specific implementation of timer depends on the timing built-in function that operating system provides in system;
Container Type ACTOR contains the ACTOR of the graphic element type of carrying other by [LinkTable] pointer; Therefore only have when [TypeFlag] in ACTOR structure one is during for container, [LinkTable] pointer in this structure sensing just meaningful.
Embodiment two: present embodiment is described below in conjunction with Fig. 2, present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the ACTOR node that foundation described in step 4 is new is also added the process in chained list to be: be the information such as newly-established ACTOR Node configuration apex coordinate, texture index, texture coordinate, figure layer, and this node type is set to graphic element, show label is labeled as to " can show "; After major cycle and timer bring into operation, by picture corresponding to the corresponding position display of screen.
Embodiment three: present embodiment is described below in conjunction with Fig. 2, Fig. 5 and Fig. 6, present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the process on the ACTOR node that the ACTOR node of the ACTOR node of graphic element type or Container Type is connected to Container Type by [LinkTable] described in step 4 is:
The ACTOR node that comprises some graphic element types in ACTOR chained list and the ACTOR node of a Container Type, the ACTOR node of this Container Type is connected to the ACTOR node of other all graphic element types by [LinkTable] pointer;
Add a TIMELINE node, and the application of this time shaft animation is set to ACTOR container node above-mentioned; After major cycle and timer bring into operation, will in the corresponding position display of screen, there is the corresponding picture group of do action effect, this group has comprised all graphic elements that are added in container.
Embodiment four: present embodiment is described below in conjunction with Fig. 3, present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the TIMELINE node that foundation described in step 5 is new is also added the method for chained list to be: for new TIMELINE Node configuration drips all the time, the information such as time shaft frame sum, link that a kind of animation moves and be that it sets corresponding animation parameters, repetition flag is set to circular flow, the graphic element that afterwards action object of this time shaft is set as setting up in step 1, after major cycle and timer bring into operation, the corresponding picture of do action effect will be there is in the corresponding position display of screen.
In the present embodiment, on the basis of the time shaft node of setting up, in time shaft chained list, add new TIMELINE node, each data field of TIMELINE node is set, when for its link action and action object, function of movement is linked on self-designed new function of movement, in the function of movement collection that this function does not provide at framework, and action object is set as to the some graphic elements in ACTOR container.After major cycle and timer bring into operation, all graphic elements in ACTOR container will have a common action; In addition, certain graphic element in ACTOR container has a new manner of execution on coacting basis, and the function of movement that this action is set by oneself is determined; The cover up rule that each graphic element presents on screen is determined by their corresponding figure layer data territory size.
In principal function, should comprise in turn the content of following aspect: the initialization of hardware display environment, be written into required texture picture, the initialization of ACTOR chained list, set up all ACTOR graphic elements and container and set corresponding relation of inclusion, the initialization of TIMELINE chained list, set up all TIMELINE time shaft nodes required movement object and function of movement, opening timing mechanism, enter major cycle, wherein function of movement is not limited to the function in picture frame collection of functions.
Each drip all the time in, should carry out in turn the content of following aspect: by traversal TIMELINE chained list, search for and process allly in all function of movement that should move, drafting ACTOR chained list being labeled as the graphic element node that can show and refreshing screen.
Embodiment five: present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the image action described in step 6 comprises: image translation, image rotation, a certain border of mobile graphics element, mobile graphics element texture.
Embodiment six: present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the image action described in step 6 comprises: at the uniform velocity change and two kinds of manner of execution of one order inertia variation.
Embodiment seven: present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the image action described in step 6 comprises flicker and the two kinds of manner of execution of being fade-in fade-out.
Embodiment eight: present embodiment is further qualified the full liquid crystal automobile instrument graphics frame design method based on OpenGL ES described in embodiment one, in present embodiment, the positioning precision of the timer described in step 10 is Millisecond.
Graphics system in automotive displays terminal can realize by OpenGl shape library.OpenGL is one and defined a specification across programming language, cross-platform application programming interfaces (API), and it is for generating two dimension, 3-D view.This interface is comprised of nearly 350 different function calls, is used for drawing complicated three-dimensional scence from simple figure bit.
OpenGL ES (OpenGL for Embedded Systems) is the subset of OpenGL figure API, for embedded devices such as mobile phone, PDA and game hosts, designs.Therefore also can be transplanted to easily Vehicle Electronic Control platform.Rely on OpenGL ES shape library the exploitation that makes full liquid crystal instrument is become to quick and stablize.