bugGNU Octave - Bugs: bug #46739, glLineStipple

 
 

bug #46739: glLineStipple

Submitter:  Ben Abbott <bpabbott>
Submitted:  Mon 21 Dec 2015 06:32:17 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Kostas Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 07 Feb 2019 12:41:31 AM UTC, comment #2: 

Eventually, as you say, we will need to stop using glLineStipple.  For the time being, I improved the appearance of plotted lines by using two different stipple patterns: 1) for linewidths > 1.5 pixels, 2) for all smaller linewidths.  See https://hg.savannah.gnu.org/hgweb/octave/rev/4b4881ff0dc9.

Rik <rik5>
Group administrator
Tue 29 Dec 2015 03:05:54 PM UTC, comment #1: 

With gnuplot v5 it is now possible to specify the "dashtype"

http://www.bersch.net/gnuplot-doc/set-show.html#set-dashtype

The dot/dash lengths are normalized to the line width. A length of "2" is equal to the line width. The short example below approximates the behavior of Matlab.


# equivalent to ML '-'
set dashtype 1 solid
# equivalent to ML ':'
set dashtype 2 (2,6)
# equivalent to ML '-.'
set dashtype 3 (16,8,2,8)
# equivalent to ML '--'
set dashtype 4 (16,16)


Perhaps, it would be useful to extend the "linestyle" property to support such an (dash1, gap1, dash2, gap2, ...) syntax and to modify the OpenGL toolkits to support the syntax present in gnuplot v5.

I'm attaching a gnuplot demo script.

(file #35888)

Ben Abbott <bpabbott>
Group Member
Mon 21 Dec 2015 06:32:17 PM UTC, original submission:  

Hi

This is about the rendering of dashed and dash-dot lines. With the opengl plotting system being the default, maybe one could now think about the rendering quality of lines in plots and prints.

Here there are some -in my opinion- shortcomings of the current situation:

- The gaps in the dashed and dash-dot lines are too large (also compared to ML's plotting). In my personal octave build I actually replace the "0xF0F0" mask with "0xF8F8" for dashed and the "020F" mask for dash-dot lines with "0x27FF".

- The pattern doesn't scale with the linewidth. This makes very thick lines look strange when combined with some non solid line style.

- The lines have no caps, which makes especially dots look ugly (squares instead of circles).

- I have just realized that glLineStipple has been deprecated in recent versions of OpenGL.


Possible solutions:

Soon or later it will probably become necessary to go away from glLineStipple, so it might be useful to take a look at alternative and higher quality options already. For example the following work looks very interesting:
https://hal.inria.fr/hal-00907326/file/paper.pdf

and the code is also available inside a project called gl-agg:
https://github.com/rougier/gl-agg/blob/master/glagg/dash_atlas.py

The following article is also interesting to read:
http://mattdesl.svbtle.com/drawing-lines-is-hard

In any case one would also have to check what is supported by gl2ps.


Unfortunately, I don't see myself having the time to help with the coding of any new implementation soon but maybe you will find the above information useful.

Best regards
Kostas

Ben Abbott <bpabbott>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35888:  linetypes.gp added by bpabbott (793B - application/octet-stream)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Submitted the item)
  • -email is unavailable- added by bpabbott
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-24 rik5 Dependencies- bugs #53730 is dependent
    2015-12-29 bpabbott Attached File- Added linetypes.gp, #35888
    2015-12-21 bpabbott Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code