Hi,
Adding a LineSegs in a scene that has a GeomPoints in it seems to switch the color format on the GeomPoints from RGBA to BGRA. I’m using Panda1.10.14, here’s some code to reproduce the issue, is this a bug or am I doing something wrong?
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "load_prc_file.h"
#include "geomPoints.h"
#include "lineSegs.h"
int main()
{
load_prc_file_data( "", "load-display pandagl\n\
win-origin -2 -2\n\
win-size 800 600\n\
fullscreen #f\n\
framebuffer-hardware #t\n\
framebuffer-software #f\n\
depth-bits 1\n\
color-bits 1 1 1\n\
alpha-bits 0\n\
stencil-bits 0\n\
multisamples 0\n\
notify-level warning\n\
default-directnotify-level warning" );
PandaFramework framework;
framework.open_framework();
framework.set_window_title( "Dis be where I test panda" );
PT(WindowFramework) window = framework.open_window();
window->setup_trackball();
window->enable_keyboard();
PT(GeomVertexData) vData;
vData = new GeomVertexData("data", GeomVertexFormat::get_v3c4(), Geom::UH_static);
PT(GeomNode) geomNode = new GeomNode("RGB points");
GeomVertexWriter vertexWriter(vData, "vertex");
GeomVertexWriter colorWriter(vData, "color");
vertexWriter.add_data3(0, 0, 0);
colorWriter.add_data4(1.f, 0.f, 0.f, 1.f);
vertexWriter.add_data3(1.f, 0, 0);
colorWriter.add_data4(0.f, 1.f, 0.f, 1.f);
vertexWriter.add_data3(2.f, 0, 0);
colorWriter.add_data4(0.f, 0.f, 1.f, 1.f);
PT(Geom) geom = new Geom(vData);
PT(GeomPoints) prim = new GeomPoints(Geom::UH_static);
prim->add_vertices(0,1,2);
geom->add_primitive(prim);
geomNode->add_geom(geom);
auto pointsNP = window->get_render().attach_new_node(geomNode);
//Adding the following LineSegs makes the order of the points from left to right Blue Green Red instead of Red Green Blue
LColor color(1, 1, 1, 1);
LineSegs lines;
lines.set_color(color);
lines.move_to(LPoint3(0, 0, 1));
lines.draw_to(LPoint3(1,0,1));
lines.draw_to(LPoint3(2,0,1));
PT(GeomNode) lineNode = lines.create();
window->get_render().attach_new_node(lineNode);
framework.main_loop();
framework.close_framework();
}
EDIT:
I was kind of in a rush when making the post, I forgot to post screenshot of the scene with/without the LineSegs.
The only difference in the code between these two screenshots is that the line window->get_render().attach_new_node(lineNode);
was commented in the first screenshot.