comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDLgrPolygon -TEXTURE_MAP question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDLgrPolygon -TEXTURE_MAP question [message #43842] Thu, 28 April 2005 06:12
Ulan is currently offline  Ulan
Messages: 8
Registered: April 2005
Junior Member
Thanks Antonio for the suggestion. But I found the real reason for my
black texture - it couldn't be simpler -BYTSCLing of original images!
Re: IDLgrPolygon -TEXTURE_MAP question [message #43843 is a reply to message #43842] Thu, 28 April 2005 04:48 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
turdukulov@gmail.com wrote:
> OK, after applying golden rule - RFM (Read the F..ing Manual) and
> looking at the forum, finally I have decided to post my question.
> To start with- I am a beginner generally in programming and
> particularly in IDL. I could not find solution to following
> visualization problem.
> I have set of spheres (oOrb). Those spheres are icons representing
> regions extracted from images. Each sphere has x,y, time coordinates
> and radius proportional to one of the attribute of the region (e.g.
> size). There are also tubes connecting those spheres and showing
> relationship between regions (continuation, split, merge etc.). I used
> IDLgrModel and visualized it in XOBJVIEW. So far it works.
> Now, I wanted to add time slider and images to XOBJVIEW that will show
> up when user moves the slider. I have done it through IDLgrPolygon
> object with texture map property being a grayscale image (see code
> below, Input: 3D image (x,y, time)):
>
>
> for i=0, ntimes-1 do begin
> oImage=OBJ_NEW('IDLgrImage', image[*,*,i])
>
> oPoly=obj_new("IDLgrPolygon", number_x, number_y, i ,$
> STYLE=2,Texture_Map = oImage,$
> Texture_Coord = [[0,0],[0,1], [1,1], [1,0]], HIDE=1)
>
> oModel->Add, oPoly, POSITION=i
> Endfor
>
> And in the event_handler I change the property HIDE=1 into HIDE=0
> for that slider position.(through POSITION keyword).
>
> Now my question: The resulted image looks black, without any texture. I
> have tried to add the COLOR keyword [255,255,255], but it didn't
> help. Seems I am missing something simple here, but I am just
> lost...That's why I have decided to ask the group. Any help would be
> appreciated,
>
> Thanks,
> Ulan
>

Hello,

I think the trick is buried in the ORB object's handling of texture
coords... otherwise you seem to be just fine with your code. I *really*
don't understand ORB at all, but I wish that it became an "offical" part
of IDL along with a lot of simple shapes like cylinders, ellipsoids, etc.

The following works if you specify the TEX_COORDS keyword at the
instantiation of the ORB object.

Cheers,
Ben

****START HERE****
pro textmap

dim = [50,75]
number_x = [0,0,dim[0]-1,dim[0]-1]
number_y = [0, dim[1]-1, dim[1]-1, 0]
omodel = obj_new('idlgrmodel')

nTimes = 5
image = rebin(bytscl(hanning(dim[0],dim[1])), dim[0], dim[1], nTimes)

for i=0, ntimes-1 do begin
oImage=OBJ_NEW('IDLgrImage', image[*,*,i])

orb = obj_new('orb', POS = [0,0, i*2], /TEX_COORDS)
orb->GetProperty, pObj = opoly

oPoly->SetProperty, $
COLOR = [255,255,255], $
Texture_Map = oImage

oModel->Add, orb
Endfor

xobjview, omodel, /block

obj_destroy, omodel
End

****END HERE****
Re: IDLgrPolygon -TEXTURE_MAP question [message #43844 is a reply to message #43843] Thu, 28 April 2005 03:28 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
turdukulov@gmail.com wrote:
> OK, after applying golden rule - RFM (Read the F..ing Manual) and
> looking at the forum, finally I have decided to post my question.
> To start with- I am a beginner generally in programming and
> particularly in IDL. I could not find solution to following
> visualization problem.
Hi, I'm am another IDL beginner.

> I have set of spheres (oOrb). Those spheres are icons representing
> regions extracted from images. Each sphere has x,y, time coordinates
> and radius proportional to one of the attribute of the region (e.g.
> size). There are also tubes connecting those spheres and showing
> relationship between regions (continuation, split, merge etc.). I used
> IDLgrModel and visualized it in XOBJVIEW. So far it works.
> Now, I wanted to add time slider and images to XOBJVIEW that will show
> up when user moves the slider. I have done it through IDLgrPolygon
> object with texture map property being a grayscale image (see code
> below, Input: 3D image (x,y, time)):
>
>
> for i=0, ntimes-1 do begin
> oImage=OBJ_NEW('IDLgrImage', image[*,*,i])
>
> oPoly=obj_new("IDLgrPolygon", number_x, number_y, i ,$
> STYLE=2,Texture_Map = oImage,$
> Texture_Coord = [[0,0],[0,1], [1,1], [1,0]], HIDE=1)
>
> oModel->Add, oPoly, POSITION=i
> Endfor
>
> And in the event_handler I change the property HIDE=1 into HIDE=0
> for that slider position.(through POSITION keyword).
>
> Now my question: The resulted image looks black, without any texture. I
> have tried to add the COLOR keyword [255,255,255], but it didn't
> help. Seems I am missing something simple here, but I am just
> lost...That's why I have decided to ask the group. Any help would be
> appreciated,
>
> Thanks,
> Ulan
>

I had got the same problem some time ago. The problem is that for every
texture pixel you must specify at wich point of your polygon must be put
(more or less).

Here are an example with more complex data than the example of IDL doc:
http://groups-beta.google.com/group/comp.lang.idl-pvwave/bro wse_thread/thread/c76a98bf0b68fc32/09c00f8bdb28b974?q=textur e+map+problem&rnum=6&hl=en#09c00f8bdb28b974

Bye.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Torus creating code in IDL
Next Topic: Re: Basic Math: I _hope_ this is a stupid question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:57:00 PDT 2025

Total time taken to generate the page: 0.00670 seconds