Jump to content

Texture sizing with llSetPrimMediaParams()


Charlotte Copeland
 Share

You are about to reply to a thread that has been inactive for 3549 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hiya,

I'm developing a script to pull images from a variety of online albums (flickr, tumblr, what have you).  I've got 90% of it working, but am simply at a loss to figure out how to deal with the fact that the images I'm pulling will be a variety of sizes, some large, some small...  And how to deal with this using the various options available (PRIM_MEDIA_AUTO_SCALE, PRIM_MEDIA_HEIGHT_PIXELS, PRIM_MEDIA_WIDTH_PIXELS)...

I don't want scroll bars, and I don't mind if some images are "distorted" because the height/width ratio is off...  Basically I want to tell it "don't worry, just fill the prim face with this image, thanks".

I've been testing with a width 452, height 444 image on a square prim face, and no matter what I do I either get horizontal scrollbar or an empty space at the vertical bottom.

I've tried AUTO_SCALE = TRUE, AUTO_SCALE = FALSE, various methods of calculating the next highest power of 2 to the width and height, using the width and height exactly in the options, so far no luck.

Help!

Link to comment
Share on other sites

I have no clear understanding.  Explanations I've tried to use don't hold up.  What I think works is to set the pixel height and width to something smaller than the image dimensions while setting ...AUTO_SCALE to TRUE.  Which isn't really what you want.  It seems that when not scaling down to fit the image is placed into a 1024x1024 space on it's way to the prim.

The 'useful snippets' item at this link suggests another approach that might give better results by scaling via the prim parameters rather than the media parameters. http://wiki.secondlife.com/wiki/LlSetLinkMedia

It looks like there's some power of two thing going on but I can't say what it is.

I'll include one test result photo.  I have no idea why at 512x512 the AUTO_SCALE TRUE & FALSE results are the same.

Top row is set to 640x640 pixels, Middle is 512x512, Bottom is 320x320.

Left (green) is ...AUTO_SCALE = TRUE, Right (red) is ...AUTO_SCALE = FALSE

Image on display is 640x480

Third Photo.PNG

Link to comment
Share on other sites

Thanks!  I think I have something working now.

 

llSetPrimMediaParams(1, [  PRIM_MEDIA_CURRENT_URL, image_url,  PRIM_MEDIA_HOME_URL, image_url,  PRIM_MEDIA_AUTO_PLAY, TRUE,  PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE,  PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_NONE,  PRIM_MEDIA_AUTO_SCALE, FALSE,  PRIM_MEDIA_WIDTH_PIXELS, image_width,  PRIM_MEDIA_HEIGHT_PIXELS, image_height  ]);

 Followed by a call to the function to fiddle with the prim texture params seems to do it!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3549 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...