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 #27683] Sun, 04 November 2001 13:23 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
From: "Karl Schultz" <kschultz@researchsystems.com>
>>> Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
>>>> Your test image ('rose.jpg') is 227 x 149 pixels.
>>>> Texture-map image dimensions are supposed to be a
>>>> power of 2 (or so I was informed some time ago
>>>> when I complained to RSI about misalignment problems).
> IDL will scale it if you don't. But that scaling may not have been
> what you wanted, and may have caused the misalignment problems?

Yes. I realise now this has nothing to do with the interesting effects
encountered by David. But IDL's automatic re-sizing of images when it
needs to use them as a texture map is unsatisfactory, in my opinion. Below
is a test program to illustrate this. It creates & displays an image on its
own and then as a texture-map. If it is run with argument "num" set to any
number that is not a power of 2 the texture-mapped image is shifted up & to
the right.

Actually, I've found IDL's image-oriented mathematical operations
(interpolation, ROIs) often have pretty dodgy geometry when used with a
small number of pixels.

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research

pro mgh_test_image2, NUM=num

compile_opt IDL2

if n_elements(num) eq 0 then num = 16

if n_elements(option) eq 0 then option = 0

; Create a symmetrical 2D array

thedata = bytarr(num,num)
thedata[0:num-2,0:num-2] = bytscl(dist(num-1))
thedata[num-1,*] = thedata[num-2,*]
thedata[*,num-1] = thedata[*,num-2]

; Load the data into an IDLgrImage

theimage = obj_new('IDLgrImage', thedata, LOCATION=[0,0] $
, DIMENSIONS=[1,1])

; Display the image alone

xobjview, theimage

; Display the image mapped onto an IDLgrPolygon

xobjview, obj_new('IDLgrPolygon', [0,1,1,0], [0,0,1,1] $
, COLOR=[255,255,255], TEXTURE_MAP=theimage $
, TEXTURE_COORD=[[0,0],[1,0],[1,1],[0,1]])

end




--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
[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 21:58:23 PDT 2025

Total time taken to generate the page: 0.64382 seconds