+ Reply to Thread
Results 1 to 10 of 10

  Click here to go to the first Rift Team post in this thread.   Thread: texture from file

  1. #1
    Telaran Mabs's Avatar
    Join Date
    Apr 2010
    Location
    France, Gex
    Posts
    63

    Default texture from file

    Hi ,
    anyone has a working example to show a texture loaded from a file?

    i fail at it, anything special to show a png file ?

    so far i have the following code, but nothing is shown
    Code:
    	tex = UI.CreateFrame("Texture", "tex", context)
    	tex:SetTexture("test","c:\\a.png")
    	tex:SetPoint("TOPLEFT", UIParent, "TOPLEFT",0,0)
    	tex:ResizeToTexture()

  2. #2
    RIFT Fan Site Operator
    Join Date
    Mar 2011
    Posts
    35

    Default

    png is not currently supported, and the arguments to SetTexture are the name of the addon folder, and the local path from there. So if your Addon is Called TestAddon, and you have a file Interface/Addons/TestAddon/test_image.jpg then you would call SetTexture("TestAddon","test_image.jpg")
    Creator of RiftDB.com

  3. #3
    Telaran Mabs's Avatar
    Join Date
    Apr 2010
    Location
    France, Gex
    Posts
    63

    Default

    Quote Originally Posted by sanktanglian View Post
    png is not currently supported, and the arguments to SetTexture are the name of the addon folder, and the local path from there. So if your Addon is Called TestAddon, and you have a file Interface/Addons/TestAddon/test_image.jpg then you would call SetTexture("TestAddon","test_image.jpg")
    thanks , works better with jpg

  4. #4
    Telaran Mabs's Avatar
    Join Date
    Apr 2010
    Location
    France, Gex
    Posts
    63

    Default

    Because as i don't have access to external text files to get the result of my parser, i would like my parser to generate image to show on the addon, but for this i will call every second setTexture on the same texture object,
    i would like to know if the previous texture will be unloaded? i don t want all the image to stay in memory
    Last edited by Mabs; 06-14-2011 at 12:42 PM.

  5. #5
    Sword of Telara Agathorn's Avatar
    Join Date
    Aug 2010
    Posts
    405

    Default

    Hmm. So JPGs work but PNGs don't? I was having the same issue, but I was only trying PNGs since I wanted alpha.

    If only JPGs will be supported moving forwarded, is there any mechanism for alpha? A separate alpha matte? An alpha color?
    - Safe Haven is recruiting casual progression players. Defiant faction, on the Faeblight server. Looking for more than just a guild? Safe Haven.

  6. #6
    RIFT Fan Site Operator Cairenn's Avatar
    Join Date
    Jun 2011
    Posts
    154

    Default

    DDS is also supported, irrc.
    Last edited by Cairenn; 06-14-2011 at 03:23 PM. Reason: I r gud sepller
    "My friends, love is better than anger. Hope is better than fear. Optimism is better than despair. So let us
    be loving, hopeful and optimistic. And we’ll change the world."
    Cairenn, Co-Founder
    and Administrator, RiftUI

  7.   Click here to go to the next Rift Team post in this thread.   #7
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Agathorn View Post
    Hmm. So JPGs work but PNGs don't? I was having the same issue, but I was only trying PNGs since I wanted alpha.

    If only JPGs will be supported moving forwarded, is there any mechanism for alpha? A separate alpha matte? An alpha color?
    We will be supporting PNGs, we just ran into some implementation issues for the first revision.

  8. #8
    Telaran Mabs's Avatar
    Join Date
    Apr 2010
    Location
    France, Gex
    Posts
    63

    Default

    is it possible to know the actual size of an image loaded?

    because so far the following code always print 0

    Code:
    texture:SetTexture("test","a.png")
    print(texture:GetTextureWidth())
    texture:ResizeToTexture();
    print(texture:GetTextureWidth())
    what the ResizeToTexture suppose to do ?

  9.   This is the last Rift Team post in this thread.   #9
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Mabs View Post
    is it possible to know the actual size of an image loaded?

    because so far the following code always print 0

    Code:
    texture:SetTexture("test","a.png")
    print(texture:GetTextureWidth())
    texture:ResizeToTexture();
    print(texture:GetTextureWidth())
    what the ResizeToTexture suppose to do ?
    :GetTextureWidth() and :GetTextureHeight() are meant to return what you want. I believe there's a bug right now where they return 0 on the frame when the texture is loaded.

  10. #10
    Telaran Mabs's Avatar
    Join Date
    Apr 2010
    Location
    France, Gex
    Posts
    63

    Default

    Quote Originally Posted by ZorbaTHut View Post
    :GetTextureWidth() and :GetTextureHeight() are meant to return what you want. I believe there's a bug right now where they return 0 on the frame when the texture is loaded.
    ok, i did a few more test, when i call GetTextureWidth/GetTextureHeight "when" the texture is visible on the screen, it infact return the size of the frame ( it returns the value i set with setWidth and SetHeigh) and not the image size

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts