我试过这样的,
<canvas id="renderCanvas"></canvas>
<script>
var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true);
var createScene = function () {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene);
sphere.position.y = 1;
var ground = BABYLON.Mesh.CreateGround("ground1", 12, 6, 2, scene);
return scene;
};
var scene = createScene();
engine.runRenderLoop(function () {
scene.render();
});
</script>
我想用javascript或html5等显示文字/部分内容...... 此外,当canvas声明了area。
时,我使用了variable_name.filltext()答案 0 :(得分:0)
试试这个
var ctx = canvas.getContext("2d");
ctx.fillText("Hello World",10,50);