Hi Rick,
sorry to bother you another time but i just seeing some examples found
in google about texture maps transparencies and i think i am doing the same.
My code is a little big (is part of a more big program) so i put some
important lines.
(I have one IDLgrModel and put a polygon with a texture_map and a simple
IDLgrImage.)
-First i create two IDLgrImage ('oXImage' and 'ximage'. 'oXImage' will
be a texture map and 'ximage' will be a simple image put on a IDLgrModel):
Note: The first data i put into image DATA is not an alpha image. I
create later this.
;Imagen corte X
img_x_data = data_vol[0,*,*]
img_x_data = REFORM(img_x_data, sizes[1], sizes[2])
oXImage = OBJ_NEW('IDLgrImage', img_x_data, $
XCOORD_CONV=xconv, YCOORD_CONV=yconv, ZCOORD_CONV=zconv, $
PALETTE=sEstado.oPalPolygon, BLEND_FUNCTION=[3,4])
sEstado.oXSlideImage = oXImage
sEstado.oHolderTemp->Add, oXImage
ximage = OBJ_NEW('IDLgrImage', img_x_data, $
XCOORD_CONV=xconv, YCOORD_CONV=yconv, ZCOORD_CONV=zconv, $
PALETTE=sEstado.oPalPolygon, BLEND_FUNCTION=[3,4])
sEstado.oTopModelVol->Add, ximage
sEstado.ximage=ximage
-Then i create one IDLgrPolygon and assing oXImage as a texture_map:
oXSlide = OBJ_NEW('IDLgrPolygon', COLOR=[255,255,255], $
[[0,0,0],[0,y,0],[0,y,z],[0,0,z],[0,0,0]], $
THICK=2, STYLE=2, $
XCOORD_CONV=xconv, YCOORD_CONV=yconv, ZCOORD_CONV=zconv, $
TEXTURE_MAP=oXImage, TEXTURE_COORD=[[0,0], [1,0], [1,1],[0,1], [0,0]])
sEstado.oVolumeModelVol->Add, oXSlide
sEstado.oXSlide = oXSlide
-Final when i move the polygon i caught some data, convert to alpha
image and assign to both texture_map image and simple image:
...
c[*,*,0] = red(img_x_data[*,*])
c[*,*,1] = green(img_x_data[*,*])
c[*,*,2] = blue(img_x_data[*,*])
c[*,*,3] = 100
sEstado.ximage->SetProperty, DATA=c, INTERLEAVE=2, $
XCOORD_CONV=xconv, YCOORD_CONV=yconv, ZCOORD_CONV=zconv
sEstado.oXSlideImage->SetProperty, DATA=c, INTERLEAVE=2, $
XCOORD_CONV=xconv, YCOORD_CONV=yconv, ZCOORD_CONV=zconv
The result is: the simple image put on the IDLgrModel is transparent but
the texture map not.
I think it is the same as all examples.
Well, if you arrive here a lot of thanks for your patient and time :)
--------
Antonio.
|