[BUG?] SetObjectMaterial Color -
Drebin - 05.04.2012
I created this wall (0.3e object):
pawn Код:
myobject = CreateObject(19371, 2035.97, 1341.60, 10.31, 0.00, 0.00, 0.00);
And wrap the texture of one of the 0.3d easter eggs around it (white egg with coloured stripes):
pawn Код:
SetObjectMaterial(myobject, 0, 19341, "egg_texts", "easter_egg01", 0xFFFF00FF);
I entered the colour for yellow, but the texture becomes purple. If I put the colour of the purple, the texture gets yellow. If I put blue, green or aqua blue, the object becomes transparent. Only if I put red the texture axtually gets painted red.
I tried that with 3 different textures which all have different default colours, and it's always the same.
Is this a problem with the textures themself, or is it a bug?
Re: [BUG?] SetObjectMaterial Color -
BloodMaster - 05.04.2012
Try to put alpha on AA or 10
AW: [BUG?] SetObjectMaterial Color -
Drebin - 05.04.2012
Nope, I just got it :P
(damnit, always after I made a topic about it

)
You have to use A
BGR format, the opacity first, and then the colours (Blue Green Red).
I got confused since you use
RGBA colours in client messages and labels, and I used this kind of colour
With ABGR format all colours work properly.
Re: [BUG?] SetObjectMaterial Color -
Vince - 05.04.2012
Makes no sense if it is inverted. So it's probably a bug anyway.
Re: [BUG?] SetObjectMaterial Color -
Babul - 05.04.2012
offtopic, but somehow relating:
sometimes the most odd formats are the common ones, like your cellphones' camera image chip: i bet that its snapping pictures in this format:
with 10 bits (or more) per channel (RAW), and converts it to RGB with 8 bits (PNG) each
10b10g10g10r becomes 8r8g8b... what a waste heheh
AW: Re: [BUG?] SetObjectMaterial Color -
Drebin - 05.04.2012
Quote:
Originally Posted by Vince
Makes no sense if it is inverted. So it's probably a bug anyway.
|
No, the problem was that I used the wrong colour format, so eg. the value for red in my colour code was green in the colour code I hat to use, which lead to a mixing of the colours.
I used RGBA instead of ABGR.
Re: [BUG?] SetObjectMaterial Color -
Kar - 05.04.2012
this should work, tested and works fine so far Credits to ******, learned colours off him :P
pawn Код:
stock ShiftRGBAToABGR(&color)
{
new r, g, b, a;
r = (color >>> 24);
g = (color >>> 16 & 0xFF);
b = (color >>> 8 & 0xFF);
a = (color & 0xFF);
color = (a & 0xFF) | ((b & 0xFF) << 8) | ((g & 0xFF) << 16) | (r << 24);
return color;
}
Re: [BUG?] SetObjectMaterial Color -
leong124 - 06.04.2012
I think it should be changed to prevent confusion, especially for those who haven't read this topic.
Re: [BUG?] SetObjectMaterial Color -
MP2 - 06.04.2012
Yes I agree, it should be changed. We have used RGBA throughout the entire life of SA:MP, something different is just going to cause mass confusion. Just imagine how many topics are going to appear in scripting discussion about this.
AW: [BUG?] SetObjectMaterial Color -
Giovanni - 06.04.2012
It is written on the Wiki that the color format is ABGR, so why should you change it? I always look at the Wiki before I mess around with a function where I don't know how it exactly works.