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

Home » Public Forums » archive » IDLgrPolygon image map scaling
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: IDLgrPolygon image map scaling [message #42925 is a reply to message #42754] Mon, 28 February 2005 14:55 Go to previous messageGo to previous message
b_gom is currently offline  b_gom
Messages: 105
Registered: April 2003
Senior Member
Thanks Karl,

problem solved. I misinterpreted the power of two part.

Brad


Karl Schultz wrote:
> On Fri, 25 Feb 2005 11:00:32 -0800, b_gom wrote:
>
>> I'm having a bit of trouble with texture maps on a simple
rectangular
>> IDLgrPolygon. I am trying to place a bitmap inside the axes of a
custom
>> plot object. I create an IDLgrPolygon with the proper dimensions,
and
>> add it to the model with my plot. I'm using a texture map so that I
can
>> scale the plot dynamically, and so that it behaves itself in terms
of
>> plotting order. The trouble is that IDL doesn't scale the image
>> uniformly. See:
>> http://people.uleth.ca/~brad.gom/texture_map.png
>> The pattern should be a checkerboard of alternating pixels. Is
there
>> something I am missing? This effect occurs no matter what image
>> dimensions I use, dimensions of the polygon in data units, or
>> interpolation.
>
> This is *probably* caused by your texture image not having dimensions
that
> are a power of 2. OpenGL has a restriction where texture maps have
to
> have dimensions that are a power of 2. If you use a texture map that
does
> not meet this requirement, IDL resamples the image upwards to the
next
> power of 2 dimensions. This resampling step is probably introducing
the
> aliasing artifacts.
>
> The way around this is to place your texture data into a larger image
that
> has dimensions the next power of 2 higher than your texture data,
leaving
> unused areas in the image. Then use texture coordinates to use only
the
> defined parts of the image.
>
> For example, if your texture data is 500x750, make an image array
that is
> 512x1024 and use it to create your IDLgrImage. Fill the image array
so
> that your texture data fills up the [0:499, 0:749] subset of the
array.
> Use this image as the texture map and set the texture coords
corresponding
> to the rectangle to
>
> [ [0,0], [500./512, 0], [500./512, 750./1024], [0, 750./1024] ].
>
> Note that IDLgrSurface does this sort of thing for you automatically,
so I
> suppose that you could use the surface object instead.
>
> One of my tasks for the next release of IDL is to make the polygon
object
> do this sort of thing automatically as well. But for now, you'll
have to
> do something along the lines I've described here.
>
> Karl
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: idl_conatiner::get and position
Next Topic: Re: Help optimizing the nested for loops

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

Current Time: Sun Oct 12 00:39:54 PDT 2025

Total time taken to generate the page: 0.23999 seconds