我想在非WebGL浏览器上使用Canvas渲染器,在其他浏览器上使用WebGL。 我的代码适用于webGL渲染器,但使用canvas渲染器时,THREE.Line不会显示。
//Edges
var edgeMat = new THREE.LineBasicMaterial({
color: 0x000000,
opacity: 0.6
} );
for (var edgeId in graph.edgesl) {
var nodeInId = graph.edgesl[edgeId];
var nodeOutId = graph.edgesr[edgeId];
var edgeGeom = new THREE.Geometry();
edgeGeom.vertices.push(new THREE.Vertex(nodes[nodeInId].position));
edgeGeom.vertices.push(new THREE.Vertex(nodes[nodeOutId].position));
var drawingLine = new THREE.Line( edgeGeom , edgeMat );
//Store In, Out node ID
drawingLine.inNodeId = nodeInId;
drawingLine.outNodeId = nodeOutId;
nodes[nodeInId].edges.push(drawingLine);
nodes[nodeOutId].edges.push(drawingLine);
//Meshes additionally need also dynamic flag enabled (to keep internal typed arrays).
drawingLine.dynamic = true;
scene.addObject(drawingLine );
edges.push(drawingLine);
}
任何人对此都有任何想法?
谢谢!
答案 0 :(得分:3)
从r45 scene.addObject(drawingLine);
现在必须scene.add(drawingLine);
同样的问题: