Problem beacon colors

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
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;
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
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.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
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?
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,878
Reaction score
2,870
Points
188
Website
github.com
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]?
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
...and I assumed that black is not a color ;)
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
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).
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
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:

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
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.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Thanks. That fixed that. Now I need to figure why d3d9 acts differently than regular graphics:) Things like Sound not working and animations
 
Top