<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 44: Lines not solid when using OpenGL on Windows</title><link>https://sourceforge.net/p/mathgl/bugs/44/</link><description>Recent changes to 44: Lines not solid when using OpenGL on Windows</description><atom:link href="https://sourceforge.net/p/mathgl/bugs/44/feed.rss" rel="self"/><language>en</language><lastBuildDate>Tue, 01 Dec 2020 16:18:42 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/mathgl/bugs/44/feed.rss" rel="self" type="application/rss+xml"/><item><title>Lines not solid when using OpenGL on Windows</title><link>https://sourceforge.net/p/mathgl/bugs/44/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;There's a bug in V2.4.4 when using OpenGL drawing in cases where the "long" data type compiles as 32-bit (mainly on Windows, but probably also on 32-bit Linux). This function in opengl.cpp fails in case pos!=0 and style=0xffff:&lt;/p&gt;
&lt;p&gt;void set_pen(unsigned style, mreal width, mreal pos)&lt;br/&gt;
{&lt;br/&gt;
    if(style==0)    return;&lt;br/&gt;
    unsigned long pdef = style&lt;em&gt;0x100010001;&lt;br/&gt;
    pdef &amp;gt;&amp;gt;= long(32&lt;/em&gt;pos)%32;   // NOTE try to bypass OpenGL limitations&lt;br/&gt;
    style = pdef &amp;amp; 0xffff;&lt;br/&gt;
    width *= 20;&lt;br/&gt;
    if(style!=0xffff)&lt;br/&gt;
...&lt;/p&gt;
&lt;p&gt;In case "style" is 0xffff, the line should be solid. However, this operation overflows if "long" is 32-bit:&lt;br/&gt;
unsigned long pdef = style*0x100010001;&lt;/p&gt;
&lt;p&gt;After that the following operations (right-shift plus AND operation) result in something !=0xffff if "pos" is big enough.&lt;br/&gt;
Plots and axes are drawn with non-solid lines that way.&lt;/p&gt;
&lt;p&gt;I replaced "unsigned long" by "unsigned long long" (64-bit also on Windows) to fix it.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ghostmaker</dc:creator><pubDate>Tue, 01 Dec 2020 16:18:42 -0000</pubDate><guid>https://sourceforge.net7faccc7b8cd6caf536797eabfebbcf60666ff3ea</guid></item></channel></rss>