Re: Updating a texure map in object graphics [message #40204] |
Tue, 27 July 2004 16:17 |
Clay Blankenship
Messages: 4 Registered: September 2003
|
Junior Member |
|
|
In article <ce6l4q$j2v$1@gnus01.u.washington.edu>, "Rick Towler"
<rtowler@u.washington.edu> wrote:
> Hi Clay,
>
> You can easily change the texmap by changing the DATA property of the
> IDLgrImage object that is your texture map.
>
> for example:
>
> ; get new texture map data
> read_jpg, 'somedata.jpg', texture
> texmap -> SetProperty, DATA=texture
>
> Then redraw your view to see the change.
>
>
> So in your case you'll have some event routine which will prompt the
> user for a new image file, read it, change the DATA property of the
> texmap object, then draw the view.
>
> I am not looking at my code right now but my guess is that I don't stick
> the reference to the texmap object into the "info" structure. You will
> need access to the texmap reference to change its properties. Stick it
> in the info structure by adding "texmap:texmap, $" in the structure
> definition and then access it in your event procedure as:
>
> info.texmap -> SetProperty, DATA=texture
>
>
> good luck!
>
> -Rick
>
Thanks. SetProperty is the magic word I was looking for. I just took
an IDL class on widgets and object graphics and was trying to put it
to good use. I was going to write a program from scratch and then
found your excellent demo which does most of the dirty work already.
Thanks again for making it available.
Clay
|
|
|
Re: Updating a texure map in object graphics [message #40208 is a reply to message #40204] |
Tue, 27 July 2004 15:31  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Hi Clay,
You can easily change the texmap by changing the DATA property of the
IDLgrImage object that is your texture map.
for example:
; get new texture map data
read_jpg, 'somedata.jpg', texture
texmap -> SetProperty, DATA=texture
Then redraw your view to see the change.
So in your case you'll have some event routine which will prompt the
user for a new image file, read it, change the DATA property of the
texmap object, then draw the view.
I am not looking at my code right now but my guess is that I don't stick
the reference to the texmap object into the "info" structure. You will
need access to the texmap reference to change its properties. Stick it
in the info structure by adding "texmap:texmap, $" in the structure
definition and then access it in your event procedure as:
info.texmap -> SetProperty, DATA=texture
good luck!
-Rick
Clay Blankenship wrote:
> Can someone briefly tell me how to update a texture map on an object? I
> am trying to modify Rick Towler's rotating sphere program, posted earlier
> on this group (search for "Object Grahpics Roting Sphere" to view the
> thread):
>
> http://www.acoustics.washington.edu/~towler/programs/camera_ _define.zip
>
>
> Here's the initial setup of the globe with an image overlaying it:
>
> ;load the texture map
> read_jpeg,'earth.jpg' ,texture, /true, /order
> help,texture
> texmap = obj_new('idlgrimage', texture)
> container -> add, texmap
>
> ;create the "globe" -
> globe = obj_new('orb', radius=1, pos=[0,0,0], color=[255,255,255], $
> density=3.0, texture_map=texmap, /tex_coords)
> container -> add, globe
>
> How can I change the image after it has been created? I am loading in
> new geophysical datasets that I want to use to replace the current map.
> I tried destroying and recreating both the texmap and globe objects, but
> nothing changes.
>
> Thanks,
> Clay
|
|
|