我正在尝试在我的常规相机顶部设置一个正交相机以用作平视显示器。我似乎无法显示任何文本,这是我的代码:
function createHUD()
{
var width = window.innerWidth;
var height = window.innerHeight;
cameraOrtho = new THREE.OrthographicCamera(-width/2, width/2, height/2, -height/2, -10, 10);
cameraOrtho.position.z = 10;
sceneHUD = new THREE.Scene();
var textGeometry = new THREE.TextGeometry("hello world", {size: 20});
var textMaterial = new THREE.MeshBasicMaterial({color: 0xff0000});
var textMesh = new THREE.Mesh(textGeometry, textMaterial);
sceneHUD.add(textMesh);
}
function render()
{
renderer.render(scene, camera);
renderer.render(sceneHUD, cameraOrtho);
}
function init()
{
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x0088FF, 1);
renderer.autoClear = false;
document.body.appendChild(renderer.domElement);
createHUD();
camera.position.z += 5;
camera.position.y += 1;
...