Problem beacon colors

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
10,550
Reaction score
4,374
Points
203
Location
Dallas, TX
I don't understand why. In D3D9 the beacon is red. In Normal graphics it is black
D3D9
8GrZYLu.jpg


normal
qk8SI1U.jpg

Code:
static VECTOR3 APbeaconcol[1] = { {   255,0,0}



};
    for ( i = 0; i < 1; i++) {
        APbeacon[i].shape = BEACONSHAPE_STAR;
        APbeacon[i].pos = APbeaconpos+i;
        APbeacon[i].col = APbeaconcol+i;
        APbeacon[i].size = 3;
        APbeacon[i].falloff =  0.4;
        APbeacon[i].period = 0.8;
        APbeacon[i].duration = 0.3;
        APbeacon[i].tofs = (6-i)*0.2;
        APbeacon[i].active = false;
        AddBeacon (APbeacon+i);
    }

        APbeacon[0].active = true;
 
Maybe the position is just about the edge? It could therefore be handled different in Z-buffer.
Try placing it a tiny bit "higher", maybe that's it.
 
Maybe the position is just about the edge? It could therefore be handled different in Z-buffer.
Try placing it a tiny bit "higher", maybe that's it.
Thanks. but why the difference in color between d3D9 and regular graphics?
 
Code:
static VECTOR3 APbeaconcol[1] = { { 255,0,0} };
Shouldn't it be like this:
Code:
static VECTOR3 APbeaconcol[1] = { { 1,0,0} };
[0;1] range instead of [0;255]?
 
...and I assumed that black is not a color ;)
 
Shouldn't it be like this:
Code:
static VECTOR3 APbeaconcol[1] = { { 1,0,0} };
[0;1] range instead of [0;255]?
Yes, it should!
DirectX 9 D3DXCOLOR constructor clips "invalid" values to [0.0 . 1.0] range. The DirectX 7 -used in Orbiters internal rendering- seems to handle that different (defaults to 0 I assume).
 
looking at the sdk:
Code:
• VECTOR3 ∗ col
pointer to beacon RGB colour
https://www.rapidtables.com/web/color/RGB_Color.html

shows red to be 255,0,0 what should red be?
You can not take any definition, you have to stick to the right one.
RGB can be triplets of 0 to 255 (integer), or triplets from 0.0 to 1.0 (floats) or triplets of 0 to 100 (percent).
Each system uses a different "range".
For programming Orbiter Beacon colors you have to take the 0.0 to 1.0 (floats).
So
[0.0, 0.0, 0.0] is black
[1.0, 0.0, 0.0] is red
[0.0, 1.0, 0.0] is green
[0.0, 0.0, 1.0] is blue
[1.0, 1.0, 1.0] is white
...etc. pp.
 
Last edited:
And Yes, I know that the Orbiter API used different color-definitions in different places; and not all are documented to full extend.
General rule of thumb:
If the individual components are integer: 0-255 (most probably)
If the individual components are floats: 0-1 (most probably)
If the complete color is an integer (DWORD) : Each byte represented by a 0-255 range (that's what 8 bit can represent); the 4th byte sometimes is used as either transparency or opacity.
 
Thanks. That fixed that. Now I need to figure why d3d9 acts differently than regular graphics:) Things like Sound not working and animations
 
Back
Top