CN109658476A - A kind of LineStipple method of GPU - Google Patents
A kind of LineStipple method of GPU Download PDFInfo
- Publication number
- CN109658476A CN109658476A CN201811521410.5A CN201811521410A CN109658476A CN 109658476 A CN109658476 A CN 109658476A CN 201811521410 A CN201811521410 A CN 201811521410A CN 109658476 A CN109658476 A CN 109658476A
- Authority
- CN
- China
- Prior art keywords
- linestipple
- straight line
- line
- current
- linear scanning
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The invention belongs to computer graphics techniques fields, provide the LineStipple method of GPU a kind of, comprising: 1) line position associated flag;2) LineStipple is established;3) position LineStipple is calculated;4) the value processing of LineStipple;5) post-processing is completed in the current linear scanning of different type line chart member.The present invention solves the connection problem including LineStipple between tape and the combination line chart member adjacent lines of wire loop, and the correspondence problem in the direction of LineStipple and linear scanning direction, correctly realize the strokes and dots function for independent line chart member and combination line chart member.
Description
Technical field
The invention belongs to computer graphics techniques fields, are related to the LineStipple method of GPU a kind of.
Background technique
In graphics processor chip (lower abbreviation GPU) design, point, line, triangle are three kinds of element figures, every kind of pel
There is respective details function.One critically important details of straight line is exactly LineStipple (strokes and dots) function, because of GPU core
Piece is to handle as unit of element figure in line of rasterization, therefore the strokes and dots function of independent line chart member is relatively easy, still
The linking processing of LineStipple and the side of LineStipple between tape and wire loop combination line chart member, adjacent lines
To it is corresponding with linear scanning direction be all the technical issues that need to address.
Summary of the invention
It is an object of the present invention to provide the LineStipple methods of GPU a kind of.
The technical solution of the invention is as follows:
A kind of LineStipple method of GPU, comprising the following steps:
1) line position associated flag:
Line chart member is assembled into independent line, whether there is or not associated spies according to independent line chart member and combination line chart member and tandem
Property, pel is marked;When pel is independent line, current straight line and tandem onrelevant are marked;When pel is tape
Or when wire loop, mark current straight line relevant with tandem;
2) LineStipple is established:
Start scanned straight lines, linestipple parameter is obtained according to glLineStipple function first, according to what is obtained
Parameter establishes complete LineStipple;
3) position LineStipple is calculated:
3.1) starting position of every straight line is calculated:
The starting point of line chart member is calculated according to the whether relevant mark of current straight line and tandem;If current straight line with
Tandem onrelevant, the starting position of label L ineStipple are starting point;
3.2) position of each member is calculated according to the scanning direction of every straight line:
The scanning direction of current straight line is calculated first, if straight line is forward scan, then according to the initial position of calculating, when
Positive direction step-by-step value of each of preceding straight line piece member from LineStipple;If straight line is reverse scan, then according to calculating
Initial position adds linear scanning length, opposite direction step-by-step value of each of current straight line piece member from LineStipple;
4) the value processing of LineStipple:
If each of the current straight line corresponding LineStipple value of member is 0, this piece member is set in vain;If piece member is right
The LineStipple value answered is 1, then this piece member retains;
5) post-processing is completed in the current linear scanning of different type line chart member:
If independent line chart member, terminates after the completion of current linear scanning;If combining line chart member, current linear scanning is completed
The new position of LineStipple is that current location adds linear scanning length afterwards, for the 3.1 of lower straight line) step use, until
Terminate after the completion of the last item linear scanning.
Linestipple parameter includes mode and repetition factor.
The step of starting position of label L ineStipple is starting point specifically:
If current straight line is relevant with tandem, current straight line is exactly in the starting position of LineStipple
The new position LineStipple calculated after the completion of previous linear scanning.
If the straight line of line chart member is combined, then starting position is exactly starting point.
Beneficial effects of the present invention:
The present invention solves the linking including LineStipple between tape and the combination line chart member adjacent lines of wire loop and asks
The correspondence problem in the direction and linear scanning direction of topic and LineStipple, correctly realize for independent line chart member and
Combine the strokes and dots function of line chart member.
Detailed description of the invention
Fig. 1 is algorithm flow chart of the invention.
Specific embodiment
In the following with reference to the drawings and specific embodiments, technical solution of the present invention is clearly and completely stated.Obviously,
The embodiment stated is only a part of the embodiment of the present invention, instead of all the embodiments, based on the embodiments of the present invention,
Those skilled in the art are not making creative work premise every other embodiment obtained, belong to guarantor of the invention
Protect range.
It is an object of the present invention to provide the LineStipple methods of GPU a kind of.
The technical solution of the invention is as follows:
A kind of LineStipple method of GPU, comprising the following steps:
1) line position associated flag:
Line chart member is assembled into independent line, whether there is or not associated spies according to independent line chart member and combination line chart member and tandem
Property, pel is marked.When pel is independent line, current straight line and tandem onrelevant are marked;When pel is tape
Or when wire loop, mark current straight line relevant with tandem.
2) LineStipple is established:
Start scanned straight lines, first according to glLineStipple function obtain linestipple parameter (including mode and
Repetition factor), complete LineStipple is established according to the parameter obtained.
3) position LineStipple is calculated:
3.1) starting position of every straight line is calculated:
The starting point of line chart member is calculated according to the whether relevant mark of current straight line and tandem.If current straight line with
Tandem onrelevant, the starting position of label L ineStipple are starting point;If current straight line is related with tandem
Connection, then current straight line calculates after the completion of the starting position of LineStipple is exactly previous linear scanning
The new position LineStipple;If the straight line of line chart member is combined, then starting position is exactly starting point.
3.2) position of each member is calculated according to the scanning direction of every straight line:
The scanning direction of current straight line is calculated first, if straight line is forward scan, then according to the initial position of calculating, when
Positive direction step-by-step value of each of preceding straight line piece member from LineStipple;If straight line is reverse scan, then according to calculating
Initial position adds linear scanning length, opposite direction step-by-step value of each of current straight line piece member from LineStipple.
4) the value processing of LineStipple:
If each of the current straight line corresponding LineStipple value of member is 0, this piece member is set in vain;If piece member is right
The LineStipple value answered is 1, then this piece member retains.
5) post-processing is completed in the current linear scanning of different type line chart member:
If independent line chart member, terminates after the completion of current linear scanning;If combining line chart member, current linear scanning is completed
The new position of LineStipple is that current location adds linear scanning length afterwards, for the 3.1 of lower straight line) step use.
Embodiment:
The invention will be described in further detail with reference to the accompanying drawing, please refers to Fig. 1.
A kind of LineStipple method of GPU, comprising the following steps:
Step 1, label line position associated flag, are assembled into independent line for line chart member, according to independent line chart member and group zygonema
Pel and tandem are marked pel whether there is or not associated characteristic.When pel is independent line, mark current straight line with before
Straight line onrelevant afterwards;When pel is tape or wire loop, mark current straight line relevant with tandem.
Step 2 establishes LineStipple, starts scanned straight lines, is obtained first according to glLineStipple function
Linestipple parameter (including mode and repetition factor) establishes complete LineStipple according to the parameter obtained.
Step 3, the starting position for calculating every straight line are calculated according to current straight line and the whether relevant mark of tandem
The starting point of line chart member.If current straight line and tandem onrelevant, the starting position of label L ineStipple is starting
Point;If current straight line is relevant with tandem, current straight line is exactly previous item in the starting position of LineStipple
The new position LineStipple calculated after the completion of linear scanning;If the straight line of line chart member is combined, then starting position
It is exactly starting point.
Step 4, the position that each member is calculated according to the scanning direction of every straight line, calculate the scanning of current straight line first
Direction, if straight line is forward scan, then according to the initial position of calculating, each of current straight line piece member is from LineStipple
Positive direction step-by-step value;If straight line is reverse scan, then linear scanning length is added according to the initial position of calculating, it is current straight
Opposite direction step-by-step value of each of line piece member from LineStipple.
Step 5, the processing of the value of LineStipple, if each of current straight line corresponding LineStipple value of member
It is 0, then this piece member is set in vain;If the corresponding LineStipple value of piece member is 1, this piece member retains.
Post-processing is completed in step 6, the current linear scanning of different type line chart member, if individually line chart member, current straight line are swept
Terminate after the completion of retouching;If combining line chart member, the new position of LineStipple adds after the completion of current linear scanning for current location
Linear scanning length is used for the step 3 of lower straight line.
Claims (4)
1. the LineStipple method of GPU a kind of, it is characterised in that: the following steps are included:
1) line position associated flag:
Line chart member is assembled into independent line, according to independent line chart member and combination line chart member and tandem whether there is or not associated characteristic,
Pel is marked;When pel is independent line, current straight line and tandem onrelevant are marked;When pel be tape or
When wire loop, mark current straight line relevant with tandem;
2) LineStipple is established:
Start scanned straight lines, linestipple parameter is obtained according to glLineStipple function first, according to the parameter obtained
Establish complete LineStipple;
3) position LineStipple is calculated:
3.1) starting position of every straight line is calculated:
The starting point of line chart member is calculated according to the whether relevant mark of current straight line and tandem;If current straight line and front and back
Straight line onrelevant, the starting position of label L ineStipple are starting point;
3.2) position of each member is calculated according to the scanning direction of every straight line:
The scanning direction of current straight line is calculated first, if straight line is forward scan, then according to the initial position of calculating, it is current straight
Positive direction step-by-step value of each of line piece member from LineStipple;If straight line is reverse scan, then according to the starting of calculating
Position adds linear scanning length, opposite direction step-by-step value of each of current straight line piece member from LineStipple;
4) the value processing of LineStipple:
If each of the current straight line corresponding LineStipple value of member is 0, this piece member is set in vain;If piece member is corresponding
LineStipple value is 1, then this piece member retains;
5) post-processing is completed in the current linear scanning of different type line chart member:
If independent line chart member, terminates after the completion of current linear scanning;If line chart member is combined, after the completion of current linear scanning
The new position of LineStipple is that current location adds linear scanning length, for the 3.1 of lower straight line) step use, until most
Terminate after the completion of latter linear scanning.
2. a kind of LineStipple method of GPU as described in claim 1, it is characterised in that: linestipple parameter packet
Include mode and repetition factor.
3. a kind of LineStipple method of GPU as described in claim 1, it is characterised in that: label L ineStipple's
The step of starting position is starting point specifically:
If current straight line is relevant with tandem, current straight line is exactly previous in the starting position of LineStipple
The new position LineStipple calculated after the completion of linear scanning.
4. a kind of LineStipple method of GPU as described in claim 1, it is characterised in that: label L ineStipple's
The step of starting position is starting point specifically:
If the straight line of line chart member is combined, then starting position is exactly starting point.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811521410.5A CN109658476A (en) | 2018-12-12 | 2018-12-12 | A kind of LineStipple method of GPU |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811521410.5A CN109658476A (en) | 2018-12-12 | 2018-12-12 | A kind of LineStipple method of GPU |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109658476A true CN109658476A (en) | 2019-04-19 |
Family
ID=66114248
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811521410.5A Pending CN109658476A (en) | 2018-12-12 | 2018-12-12 | A kind of LineStipple method of GPU |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109658476A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7221368B1 (en) * | 2003-12-18 | 2007-05-22 | Nvidia Corporation | Stippled lines using direct distance evaluation |
US20110080416A1 (en) * | 2009-10-07 | 2011-04-07 | Duluk Jr Jerome F | Methods to Facilitate Primitive Batching |
US20110242118A1 (en) * | 2010-04-05 | 2011-10-06 | Bolz Jeffrey A | State Objects for Specifying Dynamic State |
CN105493150A (en) * | 2013-08-28 | 2016-04-13 | 高通股份有限公司 | Target independent stenciling in graphics processing |
US9501847B1 (en) * | 2009-10-15 | 2016-11-22 | Nvidia Corporation | Parallel line stipple computation |
US20170154402A1 (en) * | 2015-11-30 | 2017-06-01 | Stephen Viggers | Methods and Systems for Monitoring the Subset of GPU Components Used by an Application in Safety Critical Environments |
US9911205B1 (en) * | 2014-03-14 | 2018-03-06 | Google Llc | Visual continuity for arbitrary length stipple patterns |
-
2018
- 2018-12-12 CN CN201811521410.5A patent/CN109658476A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7221368B1 (en) * | 2003-12-18 | 2007-05-22 | Nvidia Corporation | Stippled lines using direct distance evaluation |
US20110080416A1 (en) * | 2009-10-07 | 2011-04-07 | Duluk Jr Jerome F | Methods to Facilitate Primitive Batching |
US9501847B1 (en) * | 2009-10-15 | 2016-11-22 | Nvidia Corporation | Parallel line stipple computation |
US20110242118A1 (en) * | 2010-04-05 | 2011-10-06 | Bolz Jeffrey A | State Objects for Specifying Dynamic State |
CN105493150A (en) * | 2013-08-28 | 2016-04-13 | 高通股份有限公司 | Target independent stenciling in graphics processing |
US9911205B1 (en) * | 2014-03-14 | 2018-03-06 | Google Llc | Visual continuity for arbitrary length stipple patterns |
US20170154402A1 (en) * | 2015-11-30 | 2017-06-01 | Stephen Viggers | Methods and Systems for Monitoring the Subset of GPU Components Used by an Application in Safety Critical Environments |
Non-Patent Citations (4)
Title |
---|
张少锋 等: ""机载显示系统对嵌入式图形处理器的应用需求"", 《第二十届计算机工程与工艺年会暨第六届微处理器技术论坛论文集》 * |
张少锋 等: ""机载显示系统对嵌入式图形处理器的应用需求"", 《第二十届计算机工程与工艺年会暨第六届微处理器技术论坛论文集》, 11 August 2016 (2016-08-11), pages 356 - 361 * |
邢晓斌: ""GPU中几何图元光栅化模型的搭建和仿真"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
邢晓斌: ""GPU中几何图元光栅化模型的搭建和仿真"", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 03, 15 March 2017 (2017-03-15), pages 138 - 4736 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112785674B (en) | Texture map generation method, rendering device, equipment and storage medium | |
CN112634343B (en) | Training method of image depth estimation model and processing method of image depth information | |
CN101950427A (en) | Vector line segment contouring method applicable to mobile terminal | |
US9070034B2 (en) | Method and system for correcting QR code image | |
CN109598021B (en) | Information display method, device, equipment and storage medium | |
CN105761048A (en) | Electronic seal affixing method and system with cross-page seal function | |
CN113626903B (en) | Road curve setting method and device, electronic equipment and storage medium | |
CN115082592A (en) | A kind of curve generation method, system, computer equipment, and storage medium | |
CN103577496B (en) | A kind of display methods and device of Email | |
CN113657396A (en) | Training method, translation display method, device, electronic equipment and storage medium | |
CN109658476A (en) | A kind of LineStipple method of GPU | |
CN105447010B (en) | text rendering method and system | |
CN107292938B (en) | Method and device for generating virtual smooth curve | |
CN109697743A (en) | A kind of TLM micro-structure towards GPU hardware LineStipple algorithm | |
CN102542558B (en) | A kind of method and system of test pattern angle point | |
CN117688897A (en) | Differential signal line parameter modification method, device, integrated circuit, equipment and medium | |
CN113844034B (en) | Three-dimensional model punching processing method, printing method, related equipment and storage medium | |
CN106447753B (en) | method and system for simplifying rendering of object model | |
CN101211382A (en) | Method for automatically correcting circuit diagram frame | |
CN103489212A (en) | Two-dimensional shape corresponding method based on user inspiration | |
CN111443864B (en) | iOS-based curve drawing method | |
CN101923724B (en) | A page cropping method | |
CN115662267A (en) | Map simplification method, device, storage medium and equipment | |
US20220084286A1 (en) | Optimized mesh representations | |
CN111476862B (en) | Dynamic broken line generation method for optical fiber primitive |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190419 |