Thread Tools Display Modes
10-14-19, 11:31 AM   #1
toha
A Murloc Raider
Join Date: Oct 2019
Posts: 4
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

Last edited by toha : 10-14-19 at 11:34 AM.
  Reply With Quote
10-14-19, 12:07 PM   #2
Terenna
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 105
Please post all of your code
  Reply With Quote
10-14-19, 01:07 PM   #3
toha
A Murloc Raider
Join Date: Oct 2019
Posts: 4
Originally Posted by Terenna View Post
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
  Reply With Quote
10-14-19, 02:30 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
And where in your code are you coloring your textures?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-14-19, 03:00 PM   #5
toha
A Murloc Raider
Join Date: Oct 2019
Posts: 4
regard API SetColorTexture() is coloring. it does but sometimes wrong. that is why i made this post.
  Reply With Quote
10-14-19, 07:45 PM   #6
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Originally Posted by toha View Post
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).
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
10-15-19, 01:51 AM   #7
toha
A Murloc Raider
Join Date: Oct 2019
Posts: 4
Originally Posted by jeffy162 View Post
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

Last edited by toha : 10-15-19 at 01:56 AM.
  Reply With Quote
10-15-19, 08:29 AM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
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.
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » SetColorTexture strange behaviour

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off