[BUG?] SetObjectMaterial Color
#1

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?
Reply
#2

Try to put alpha on AA or 10
Reply
#3

Nope, I just got it :P
(damnit, always after I made a topic about it )

You have to use ABGR 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.
Reply
#4

Makes no sense if it is inverted. So it's probably a bug anyway.
Reply
#5

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:
Код:
BG
GR
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
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

I think it should be changed to prevent confusion, especially for those who haven't read this topic.
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)