【发布时间】:2016-05-02 00:29:05
【问题描述】:
我必须在 JavaFX 8 中可视化运动线。我正在使用 eclipse、最新的 Java 更新(8 更新 72)和 Windows 10 64 位。我的家用电脑运行 AMD HD 5870,我的笔记本电脑和工作中的电脑都有 Nvidia 的 graficcard(GT760m 和 GTX 670)。在我的程序中,有一个三角形网格和运动线(两个坐标相同的三角形网格,大约有 300 个坐标)。
这是我的问题:三角形网格有颜色。运动线具有相同的颜色。在 Nvidia 电脑上,运动线的颜色实际上与三角形网格的颜色相同。 AMD 电脑以黑色显示运动线。
三角网格的代码如下:
PhongMaterial material;
MeshView meshView;
TriangleMesh mesh;
material = new PhongMaterial(color);
float[] points = { (float) pointN.getX(), (float) pointN.getY(), (float) pointN.getZ(),
(float) pointEL.getX(), (float) pointEL.getY(), (float) pointEL.getZ(),
(float) pointER.getX(), (float) pointER.getY(), (float) pointER.getZ() };
int[] faces = { 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 2, 0 };
mesh = new TriangleMesh();
mesh.getPoints().setAll(points);
mesh.getTexCoords().addAll(0, 0);
mesh.getFaces().setAll(faces);
meshView = new MeshView(mesh);
meshView.setDrawMode(DrawMode.LINE);
meshView.setMaterial(material);
meshView.setCullFace(CullFace.BACK);
这是针对运动线的:
PhongMaterial material = new PhongMaterial(color);
float[] pointss = { points.get(i).x, points.get(i).y, -points.get(i).z,
points.get(i).x, points.get(i).y, -points.get(i).z,
points.get(i+1).x, points.get(i+1).y, -points.get(i+1).z
};
int[] faces = { 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 2, 0 };
TriangleMesh mesh = new TriangleMesh();
mesh.getPoints().setAll(pointss);
mesh.getTexCoords().addAll(0, 0);
mesh.getFaces().setAll(faces);
MeshView meshView = new MeshView(mesh);
meshView.setDrawMode(DrawMode.LINE);
meshView.setMaterial(material);
meshView.setCullFace(CullFace.BACK);
在我看来,它是相同的代码结构。操作系统、驱动程序、Java 和 Eclipse 在所有系统上都是最新的。
有没有人想办法解决这个颜色问题?
【问题讨论】:
标签: eclipse javafx nvidia amd wireframe