Re: Texture Map problems when using IDLgrPolygon [message #80407 is a reply to message #80406] |
Mon, 04 June 2012 17:55   |
Karl[1]
Messages: 79 Registered: October 2005
|
Member |
|
|
On Monday, June 4, 2012 3:45:20 PM UTC-6, David Fanning wrote:
> mikrin writes:
>
>> I tried to make the texture coordinates without success, but maybe you
>> can see what I'm doing wrong by looking at my short makePolyVerts
>> routine.
>
> I think the explanation of the Texture Coordinates in
> the documentation can lead you astray. See this article,
> for example:
>
> http://www.idlcoyote.com/ographics_tips/imgtex.html
>
> Cheers,
>
> David
>
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
makePolyVerts looks reasonable.
David's referenced article talks about mapping a texture onto a subset of a surface, which is sort of the opposite of what you are trying to do. Still good reading.
I think that the number one problem here is that I don't see a POLYGONS keyword specified in your creation of the IDLgrPolygon object. You are just supplying a 2D array of 2D points, but IDLgrPolygon just interprets it as a list of 2D points and does not infer any connectivity information from the shape of the array (unless I'm missing something).
As it stands, I'm sort of surprised that anything resembling the intended output came out.
I think that you'll have to generate a polygon list. In this case, it is pretty easy because you have a regular 2D array of the points. The first polygon would be described as:
4 0 1 1355 1354
I can't think of any utilities or anything else sitting around that would make it easier. But you'll have to generate a sequence like this for every quad in your grid, by following the above pattern.
If that does not help, make sure that you are using the textureImg image for your texture. Look at it with xobjview or something to make sure that it looks right - it should be a square image with your data in the lower left, filling only part of the image.
If still fail, try converting the image from a pallete image to a rgb (3-channel) image and use that as the texture. Sometimes palette textures can be problematic.
Karl
|
|
|