Hi Victor,
"Victor" <vmiscellaneous@yahoo.com> wrote in message
news:1131412065.067552.155280@g49g2000cwa.googlegroups.com.. .
> I have 3 images (im1,im2,im3) which I need to display on XObjView (or
> any alternate object graphics viewer). When I tried to add more than 1
> image to the same graphics object as follows:
>> myModel = Obj_New('IDLgrModel')
>> myModel->Add, im1
>> myModel->Add, im2
>
> IDL complains:
> "IDLGRMODEL::ADD: Objects can only have one parent at a time:
> <ObjHeapVar9869(IDLGRCOLORBAR)>"
>
> Huh!
Huh, indeed! I don't see any reason this should happen from what you've said
above. (there are no colorbars mentioned up there)
I see that Antonio and Karl have covered the Position/Location issue, here's
another example that should work fine:
im1=Obj_New('IDLgrImage', BytScl(BIndGen(3, 10, 10)), Location=[-10,10])
im2=Obj_New('IDLgrImage', BytScl(RandomU(seed, 3, 10, 10)))
im3=Obj_New('IDLgrImage', 255B-BytScl(BIndGen(3, 10, 10)), Location=[10,10])
myModel = Obj_New('IDLgrModel')
myModel->Add, [im1, im2, im3]
XObjView, myModel
Now, this gives the images rendered nicely at first but has the odd
behaviour of IDLgrImages if you rotate the view. They don't rotate, they
stretch and squish. If you really want images that can rotate, you'll need
to make a polygon that contains each, something like this:
im1=Obj_New('IDLgrImage', BytScl(BIndGen(3, 10, 10)))
im2=Obj_New('IDLgrImage', BytScl(RandomU(seed, 3, 10, 10)))
im3=Obj_New('IDLgrImage', 255B-BytScl(BIndGen(3, 10, 10)))
poly1=Obj_New('IDLgrPolygon', [[-10,10],[0,10],[0,20],[-10,20]], $
Color=[255,255,255], Texture_Map=im1, $
Texture_Coord=[[0,0],[1,0],[1,1],[0,1]])
poly2=Obj_New('IDLgrPolygon', [[0,0],[10,0],[10,10],[0,10]], $
Color=[255,255,255], Texture_Map=im2, $
Texture_Coord=[[0,0],[1,0],[1,1],[0,1]])
poly3=Obj_New('IDLgrPolygon', [[10,10],[20,10],[20,20],[10,20]], $
Color=[255,255,255], Texture_Map=im3, $
Texture_Coord=[[0,0],[1,0],[1,1],[0,1]])
myModel = Obj_New('IDLgrModel')
myModel->Add, [poly1, poly2, poly3]
XObjView, myModel
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|