To verify I didn’t have an error in my own code, I used the sample
MapViewWasmModule available in the samples. I just modified the view mode to
be FS_MAP_VIEW_MODE_ALTITUDE and the colors as:
const int size = 2;
FsColor colors[size] =
{
{ 0.471, 0.176, 0.004, 1.f },
{ 0.471, 0.176, 0.004, 1.f },
};
When attaching the gauge to a texture, it returns the lighter color
attached.
proper color for those values(verified via the google color picker, and
multiple other web-based color pickers). I was able to create it by generating
bitmap data in a for loop using the FsColor values above:
const unsigned int tex_buf_size = 1280 * 1280;
unsigned char tex_buf[tex_buf_size * 4];
unsigned int color_index = 1;
for (int i = 0; i < tex_buf_size; i++) {
int j = i * 4;
tex_buf[j] = colors[color_index].r * 255;
tex_buf[j + 1] = colors[color_index].g * 255;
tex_buf[j + 2] = colors[color_index].b * 255;
tex_buf[j + 3] = colors[color_index].a * 255;
}
temp_texture = fsRenderCreateTexture(ctx, 2, 1280, 1280, 0, tex_buf, "test");
In the PRE_DRAW section, I overlayed the NetBingView map texture above my own
generated texture to compare:
if (mapViewTextureId >= 0)
{
NVGpaint netBingViewPaint2 =
nvgImagePattern(vg, 0, 0, 1280, 1280, 0.0f, temp_texture, 1.f);
nvgBeginPath(vg);
nvgRect(vg, 0, 0, 1280, 1280);
nvgFillPaint(vg, netBingViewPaint2);
nvgFill(vg);
NVGpaint netBingViewPaint =
nvgImagePattern(vg, 0, 0, MAP_VIEW_RES_X,
MAP_VIEW_RES_Y, 0.0f, mapViewTextureId, 1.f);
nvgBeginPath(vg);
nvgRect(vg, 0, 0, MAP_VIEW_RES_X, MAP_VIEW_RES_Y);
nvgFillPaint(vg, netBingViewPaint);
nvgFill(vg);
}
This is what created the image posted above. After I determined that the
colors weren’t identical, I made a function that created a green texture at
0.0f, then cycled it up by 0.01f on each frame. I determined that the largest
disparity exists near 0.5f. This same disparity can be seen on the red and
blue colors as well. I believe there is a bit being dropped when converting
the float color values back to char values internal to the
fsMapViewSetAltitudeColorList function. …Or if I’m completely in left field,
I could use a bit of direction to help me discover my error.