How to change a prim's texture

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to change a prim's texture

matan504
Hi,
 
I'm working on realXtend platform (ModreX) and OpenSim-0.6.7, coding in IronPython 2.0.3.
I've got an image that i'de like to put as a texture of a prim.
 
the code that i used is:
 
#       the code that comes before what I've pasted next fetches an image attachment from an e-mail using:
#       image = part.get_payload(decode = True)
 
#       now the code that tries to make it a texture:
        asset.FullID = str(uuid.uuid1())
        asset.Name = "DynamicImage" + str(Util.RandomClass.Next(1, 10000))
        asset.Type = 0
        asset.Description = "Mail image"
        asset.Local = False
        asset.Temporary = False
 
#       image is an 'str' type, but is actually an image. converting to byteArray type
        byteArray = Array[Byte](tuple(Byte(ord(c)) for c in image))
        asset.Data = byteArray
 
        self.MyWorld.CS.World.AssetService.Store(asset)
        j2kdecoder.syncdecode(asset.FullID, asset.Data)
        self.MyWorld.CS.World.AssetService.Store(asset)
 
#       now the decoded image is stored. trying to present texture
        id = str(asset.FullID)
 
#       this next command doesn't work for me. i get white texture on all faces instead of my image
        LSLObject.llSetTexture(self, id, -1)
 
or if you'de like to see the code in pastebin: http://pastebin.org/52980
 
 
This doesn't work for me, as i get some white texture in the end.
I don't know what am I doing wrong..  :-(
 
Thank you,
  Matan

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: How to change a prim's texture

Toni Alatalo
matan keret kirjoitti:
> I've got an image that i'de like to put as a texture of a prim.

There's an OpenSim specific LSL scripting command called
osSetDynamicTexture or something like that, I think people use that to
get e.g. images from web and having them as autorefreshing textures (on
the server).. Perhaps the implementation of that function serves as an
example of texture creation.

>   Matan

Cheers,
~Toni

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: How to change a prim's texture

matan504
I'm pretty new to OpenSim and Modrex, so I appologize if my questions sound a bit silly.

I found that osSetDynamicTexture is pretty abstract. It uses a "dynamicTexture updater" and keeps going deeper and deeper to no end. Moreover it sets a url as a texture (or suppose to do that in the end) and I need a regular image.
That's why i tried to use llSetTexture. I understood from the API that i need to add the image to an asset, store it and then use llSetTexture, but this doesn't work and I can't seem to find the reason.
Do I need to add it to the inventory as well?
Do I do something wrong with the image itself (wrong decoding perhaps)?

Thank you in advance,
  Matan

On Thu, Nov 12, 2009 at 2:32 PM, Toni Alatalo <[hidden email]> wrote:
matan keret kirjoitti:
> I've got an image that i'de like to put as a texture of a prim.

There's an OpenSim specific LSL scripting command called
osSetDynamicTexture or something like that, I think people use that to
get e.g. images from web and having them as autorefreshing textures (on
the server).. Perhaps the implementation of that function serves as an
example of texture creation.

>   Matan

Cheers,
~Toni

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users


_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: How to change a prim's texture

Toni Alatalo
matan keret kirjoitti:
> I found that osSetDynamicTexture is pretty abstract. It uses a
> "dynamicTexture updater" and keeps going deeper and deeper to no end.
> Moreover it sets a url as a texture (or suppose to do that in the end)
> and I need a regular image.

No a URL can't be a texture in vanilla opensim, it is an image in the
end. And there can't be "no end", the implementation is there at the end
of the chain, otherwise it wouldn't do anything. In visual studio at
least it's quite easy to rightclick -> go to definition.

In ModRex the texture can be/have a URL too (mediaurl), that the client
fetches and uses as a texture, but that's not related to this.

> That's why i tried to use llSetTexture. I understood from the API that
> i need to add the image to an asset, store it and then use
> llSetTexture, but this doesn't work and I can't seem to find the reason.
> Do I need to add it to the inventory as well?
> Do I do something wrong with the image itself (wrong decoding perhaps)?

It would be helpful for others to see the source, if you can
permission/legalwise put it on-line somewhere and post a link here. You
showed it yesterday on irc and I didn't see anything wrong with it, but
I know quite little about Opensim asset system internals (only added the
rexSetMediaURL scripting method 1,5years ago which had to create assets
etc. but don't recall much and things have perhaps changed since too).

AFAIK it doesn't have to be in any inventory to show.

>   Matan

~Toni

> On Thu, Nov 12, 2009 at 2:32 PM, Toni Alatalo <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     matan keret kirjoitti:
>     > I've got an image that i'de like to put as a texture of a prim.
>
>     There's an OpenSim specific LSL scripting command called
>     osSetDynamicTexture or something like that, I think people use that to
>     get e.g. images from web and having them as autorefreshing
>     textures (on
>     the server).. Perhaps the implementation of that function serves as an
>     example of texture creation.
>
>     >   Matan
>
>     Cheers,
>     ~Toni
>
>     _______________________________________________
>     Opensim-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.berlios.de/mailman/listinfo/opensim-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>  

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users