PiWi
PiWi

Reputation: 169

MATLAB R2016b rendering trouble: line color with shades where it should not

In MATLAB R2016b I have trouble with rendering.

1) When hardware acceleration is enabled (default, or setting opengl hardware) I get: hardware 'on' rendering => when lines are close one to each other lines are darker and ligher when isolated. I want constant color.

2) When acceleration is done with software (opengl software) I get: hardware 'off' rendering => lines are always at same dark level (what I want)

Note: with the process of putting the images on the site, what I want to show is less clear but I hope still visible and understandable...

Question: is there a way to enable GPU acceleration (opengl hardware) while also having a consistent rendering of line color along the whole line?

Upvotes: 1

Views: 68

Answers (1)

PiWi
PiWi

Reputation: 169

When hardware acceleration is 'on' [1], the GraphicsSmoothing property of figures is 'on' by default, and the AlignVertexCenters property of lines if 'off' by default. This gives the result of Figure 1 in the question.

Switching AlignVertexCenters to 'on' solves the issue (the same as when turning off hardware acceleration, as stated) and gives the Figure 2.

Now, to set this permanently, add this into startup.m (the file launched by MATLAB at each startup if found in userpath)

set(0, 'DefaultLineAlignVertexCenters', 'on')

For more information of startup.m see https://mathworks.com/help/matlab/ref/startup.html


[1] this is the default if an up to date graphics card is installed, and can be checked typing opengl info and verifying that HardwareSupportLevel=='full' for example.

Upvotes: 1

Related Questions