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

Home » Public Forums » archive » Re: texture_coord
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: texture_coord [message #27743 is a reply to message #27742] Thu, 01 November 2001 09:53 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karl Schultz writes:

> It isn't that bad, but it is sort of hard to explain. Code helps - see the
> bottom of this post.

OK, thanks, Karl. That certainly wasn't what the
documentation implied, but what else is new. :-)

Here is the deal. To map an image onto the *entire*
surface, this code works. (Note that Scale_Vector
is a function found on my web page. You can scale
the array however you like. It must be scaled
into the range of 0 to 1.)

ss = Size(surfaceData, /Dimensions)
texcoords = FltArr(2, ss[0], ss[1])
texcoords[0,*,*] = Scale_Vector(Findgen(ss[0]) # $
Replicate(1,ss[1]), 0.0, 1.0)
texcoords[1,*,*] = Scale_Vector(Replicate(1,ss[1]) #
Findgen(ss[0]), 0.0, 1.0)

To place the image on a portion of the surface,
you have to modify the values appropriately. Here my
surface is an array of (200,100) in size and I wish
to place the image with the lower-left corner at (40,30)
and the upper-right corner at (129,59). Thus the image
will occupy a 90x30 "chunk" of my surface.

texcoords = FltArr(2, ss[0], ss[1])
texcoords[0,40:129,30:59] = Scale_Vector(Findgen(90) # $
Replicate(1,30), 0.0, 1.0)
texcoords[1,40:129,30:59] = Scale_Vector(Replicate(1,30) # $
Findgen(90), 0.0, 1.0)

In either case, the surface is created like this:

thisSurface = OBJ_NEW('IDLgrSurface', surfaceData, Style=2, $
Color=[255,255,255], Texture_Map=thisImage, $
Texture_Coord=texcoords

I'll write up an article about this later today.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: _Ref_Extra : BUG? (in Win2K 55b) corrected test file
Next Topic: Homogenity of an area

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

Current Time: Thu Oct 09 22:26:20 PDT 2025

Total time taken to generate the page: 0.48475 seconds