Tuesday, April 5, 2011

Changing facealpha property causes figure to self-destruct

Hi,

I'm running Matlab R2009b on Snow Leopard, and I am trying to create a transparent polygon. The following line works fine:

figure,fill([1 0 0 1],[-1e-9 -1e-9 1e-9 1e-9],'r')

But when I set the transparency,

alpha(.5);

the figure collapses in on itself. That is, any title, xlabel, and ylabel I have in the figure show up right in the middle and the polygon disappears.

I get the same results from

figure,fill([1 0 0 1],[-1e-9 -1e-9 1e-9 1e-9],'r','facealpha',.5)

and I get the same result when I manually set the facealpha to .5 in the figure editor.

But if the polygon is bigger it works fine:

figure,fill([1 0 0 1],[-1e-3 -1e-3 1e-3 1e-3],'r')
alpha(.5);

Also, I tried it on a PC and it worked fine.

I think it must be a problem with the rendering. My opengl version is:

Version = 2.1 NVIDIA-1.6.10
Vendor = NVIDIA Corporation
Renderer = NVIDIA GeForce 9400M OpenGL Engine
MaxTextureSize = 8192
Visual = 0x24 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
Software = false
# of Extensions = 121

What can I do to get it to display properly?

From stackoverflow
  • Try checking out the Mathworks Bug Reports. I've only got a copy of MATLAB on PC, so I can't reproduce the error, but this known bug has a workaround. I'm not sure if that's what you're dealing with, or if it's something else, but you can browse more bug reports here: Mathworks Bug Reports

    gnovice : Take note that you'll need a MathWorks account to get to the bug reports.

0 comments:

Post a Comment