Menu

#44 Lines not solid when using OpenGL on Windows

v1.0_(example)
open
nobody
None
1
2020-12-01
2020-12-01
ghostmaker
No

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:

void set_pen(unsigned style, mreal width, mreal pos)
{
if(style==0) return;
unsigned long pdef = style0x100010001;
pdef >>= long(32
pos)%32; // NOTE try to bypass OpenGL limitations
style = pdef & 0xffff;
width *= 20;
if(style!=0xffff)
...

In case "style" is 0xffff, the line should be solid. However, this operation overflows if "long" is 32-bit:
unsigned long pdef = style*0x100010001;

After that the following operations (right-shift plus AND operation) result in something !=0xffff if "pos" is big enough.
Plots and axes are drawn with non-solid lines that way.

I replaced "unsigned long" by "unsigned long long" (64-bit also on Windows) to fix it.

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB