Problembeacon colors

gattispilot

I don't understand why. In D3D9 the beacon is red. In Normal graphics it is black
D3D9

normal

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;
}

APbeacon[0].active = true;

kuddel

Donator
Donator
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

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
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]?

GLS

Well-known member
Orbiter Contributor
Thanks. but why the difference in color between d3D9 and regular graphics?
This would be related to how that "illegal" value is handled.

kuddel

Donator
Donator
...and I assumed that black is not a color

kuddel

Donator
Donator
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
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
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

Thanks. That fixed that. Now I need to figure why d3d9 acts differently than regular graphics Things like Sound not working and animations

C++ Question Moving beacon in play
Replies
0
Views
351
SDK Question Lighting the ground
Replies
17
Views
2K
Replies
1
Views
620
Replies
6
Views
2K
Replies
8
Views
2K