Hi,
Do any of you out there have experience with the apha-channel of the
IDLgrImage
object?
I am writing on a routine, where I would like to be able to see some
geometrical figures
within other figures, i.e. a sphere within an cube. I do this by warping
an image object
(containing an alpha channel) around an polygon object.
But it seems that the BLEND_FUNCTION keyword to the image object has no
effect
at all on the transparency of the cube, say.
Furthermore the alpha value should be a number between 0 and 1. But I
can only get
it to work with numbers between 0 and 255.
Is this a bug? Or have I missed something?
Below there is a simple routine where the cube is partly transparent.
The blue sphere is
partly inside the cube. The BLEND_FUNCTION is set to [3,4] meaning that
(according to the IDL documentation) you can see through the cube to the
extent of the alpha
values. But changing the BLEND_FUNCTION doesn't have any effect!
I use IDL5.2 (win95).
Thanks,
Michael Viskum
------------------------------------------------------------ --
PRO transparency
owindow=obj_new('IDLgrWindow',dimensions=[400,400])
oview=obj_new('IDLgrView',
VIEWPLANE_RECT=[-2,-2,4,4],ZCLIP=[4,-4],EYE=5)
omodel=obj_new('IDLgrModel')
oLightDir = OBJ_NEW('IDLgrLight', loc=[2,2,2], type=1)
oLightAmb = OBJ_NEW('IDLgrLight', type=0, intensity=1)
cube=[[0.5,-0.5,0.5],[0.5,-0.5,-0.5],[-0.5,-0.5,-0.5],[-0.5, -0.5,0.5], $
[0.5,0.5,0.5],[0.5,0.5,-0.5],[-0.5,0.5,-0.5],[-0.5,0.5,0.5]]
mesh=[4,0,1,2,3, 4,0,1,5,4, 4,0,4,7,3, 4,1,2,6,5, 4,4,5,6,7, 4,2,3,7,6 ]
image=BYTARR(4,256,256)
image[0,*,*]=REPLICATE(255,256,256) ; red channel
image[1,*,*]=REPLICATE(0,256,256) ; green channel
image[2,*,*]=REPLICATE(0,256,256) ; blue channel
image[3,*,*]=REPLICATE(200,256,256) ; alpha channel
oimage=OBJ_NEW('IDLgrIMAGE',image, INTERLEAVE=0, BLEND_FUNCTION=[3,4])
opolygon=OBJ_NEW('IDLgrPolygon', cube, STYLE=2, COLOR=[255,255,255],$
POLYGONS=mesh, TEXTURE_MAP=oimage)
osphere=OBJ_NEW('orb', RADIUS=0.3, COLOR=[0,0,255])
osphere->translate,0.7,0,0
omodel->add,olightdir
omodel->add,olightamb
omodel->add,opolygon
omodel->rotate,[0,1,0],40
omodel->rotate,[1,0,0],-30
omodel->rotate,[0,0,1],10
oview->add,osphere
oview->add,omodel
owindow->draw,oview
END
____________________________________________________________ ____________
Michael Viskum, Ph.D.
UNI�C, Scientific Computing
Olof Palmes Alle 38
DK-8200 Aarhus N, Denmark
Phone (+45) 8937 6614 - Fax (+45) 8937 6677
Michael.Viskum@uni-c.dk
http://www.uni-c.dk
____________________________________________________________ _____________
|