WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   SetColorTexture strange behaviour (https://www.wowinterface.com/forums/showthread.php?t=57601)

toha 10-14-19 11:31 AM

SetColorTexture strange behaviour
 
hi folks!

!please! why in this two examples one working well seconds goese wrong

two frames will have different colors like expected
Code:

frame_1.texture:SetColorTexture(0, 0.007, 0.257)       
frame_2.texture:SetColorTexture(0, 0.1, 0.007)

now they will have same color...
Code:

frame_1.texture:SetColorTexture(0, 0.007, 0.257)       
frame_2.texture:SetColorTexture(0, 0.141, 0.007)

i really cant understand sometime it work some not.
https://wow.gamepedia.com/API_Texture_SetColorTexture tell that RGB can be Number (0.0 to 1.0) but then why it work well in some cases some not. is it possible to set there 0.1111 without errors ?

duhh...

client BfA (28153) x64 Oct 16 2018

Terenna 10-14-19 12:07 PM

Please post all of your code

toha 10-14-19 01:07 PM

Quote:

Originally Posted by Terenna (Post 334247)
Please post all of your code

Code:

local EventFrame = CreateFrame("Frame")
local frame_1= CreateFrame("Frame", nil, UIParent)
local frame_2= CreateFrame("Frame", nil, UIParent)

function EventFrame:OnEvent(event, ...)
        print("HelloWorld:", event)
        self[event](self, ...)
end
EventFrame:SetScript("OnEvent", EventFrame.OnEvent)

function EventFrame:PLAYER_LOGIN()
        frame_1:SetFrameStrata("BACKGROUND")                                                -- 1
        frame_1:SetWidth(10)
        frame_1:SetHeight(10)
        frame_1.texture = frame_1:CreateTexture(nil,"BACKGROUND")
        frame_1.texture:SetAllPoints(frame_1)
        frame_1:SetPoint("TOPRIGHT",10,0)
        frame_1:Show()
        frame_2:SetFrameStrata("BACKGROUND")                                                -- 2
        frame_2:SetWidth(10)
        frame_2:SetHeight(10)
        frame_2.texture = frame_2:CreateTexture(nil,"BACKGROUND")
        frame_2.texture:SetAllPoints(frame_2)
        frame_2:SetPoint("TOPRIGHT",20,0)
        frame_2:Show()       
end


Seerah 10-14-19 02:30 PM

And where in your code are you coloring your textures?

toha 10-14-19 03:00 PM

regard API SetColorTexture() is coloring. it does but sometimes wrong. that is why i made this post.

jeffy162 10-14-19 07:45 PM

Quote:

Originally Posted by toha (Post 334253)
regard API SetColorTexture() is coloring. it does but sometimes wrong. that is why i made this post.

Yes, but, you apparently didn't post ALL of your code. You ask for help, then you post SOME of your code, but you can not get the help you ask for if you don't post ALL of your code. We have to see all of your code to give you the help that you are asking for. I am sorry for the tone of this statement, but, we're not mind readers. We have to see your code so, maybe, we can figure out where the problem is (not me, specifically, but we've got some pretty smart cookie's here ya know). :o

toha 10-15-19 01:51 AM

Quote:

Originally Posted by jeffy162 (Post 334257)
Yes, but, you apparently didn't post ALL of your code.

im surprised that you ask full code because my small question only about one small API function its like you ask full code for this

Code:

print(1)  -- 2
actually full code already above but okay, i hope you will help me if you will have full code in one forum message

Code:

local EventFrame = CreateFrame("Frame")
local frame_1 = CreateFrame("Frame", nil, UIParent)
local frame_2 = CreateFrame("Frame", nil, UIParent)

function EventFrame:OnEvent(event, ...)
        print("event:", event)
        self[event](self, ...)
end
EventFrame:SetScript("OnEvent", EventFrame.OnEvent)
EventFrame:RegisterEvent("PLAYER_LOGIN")

function EventFrame:PLAYER_LOGIN()
        frame_1:SetFrameStrata("BACKGROUND")                                               
        frame_1:SetWidth(100)
        frame_1:SetHeight(100)
        frame_1.texture = frame_1:CreateTexture(nil,"BACKGROUND")
        frame_1.texture:SetAllPoints(frame_1)
        frame_1:SetPoint("TOPLEFT",200,-100)
        frame_1:Show()
        frame_2:SetFrameStrata("BACKGROUND")                                               
        frame_2:SetWidth(100)
        frame_2:SetHeight(100)
        frame_2.texture = frame_2:CreateTexture(nil,"BACKGROUND")
        frame_2.texture:SetAllPoints(frame_2)
        frame_2:SetPoint("TOPLEFT",450,-100)
        frame_2:Show()
       
        frame_1.texture:SetColorTexture(0, 0.007, 0.257)       
        frame_2.texture:SetColorTexture(0, 0.141, 0.007)       
end


Xrystal 10-15-19 08:29 AM

Hmm are you saying that ..

If you changed these two lines from this :

frame_1.texture:SetColorTexture(0, 0.007, 0.257)
frame_2.texture:SetColorTexture(0, 0.100, 0.007)

to

frame_1.texture:SetColorTexture(0, 0.007, 0.257)
frame_2.texture:SetColorTexture(0, 0.141, 0.007)

that there is no visual difference ?

If so that is quite possible as there is only a slight change in the green coloring .. did you try a more drastic change to confirm that it changes if the difference between the numbers changed is more varied in its color equivalent ?

Using an online RGB picker the equivalent numbers in the 255 range are ..

0,0.007,0.257 = 0,0,0
0,0.141,0.007 = 0,0,0
0,0.100,0.007 = 0,0,0

Try the following number instead of 0.100 to see if there is a visual difference
0.294

It should show a dark green coloring value as it is slightly away from the black portion of the green color.

You would have a similar issue working close to the 1.0 value.. Say use 0.98 and 1.00 .. it looks like there should be a 0.02 color difference but converted to the 255 number range they result in 250 and 255 which are almost identical colors if the other numbers do not change at all between the two colors being changed.


All times are GMT -6. The time now is 02:23 AM.

vBulletin © 2019, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI