I tried to create a dynamic texture on my project, but it doesnt seems to fit with the size of the ground. but when i tried something similar in plain PG it worked. what can be wrong?
code i used in my project:
var ground = BABYLON.MeshBuilder.CreateGround(“ground”, {width:4600, height:3200});
ground.position.x = 2300;
ground.position.z = 1600;
var textureResolution = 512;
var textureGround = new BABYLON.DynamicTexture(“dynamic texture”, textureResolution, scene);
var textureContext = textureGround.getContext();
var materialGround = new BABYLON.StandardMaterial("Mat", scene);
materialGround.diffuseTexture = textureGround;
ground.material = materialGround;
var img = new Image();
img.src = "/textures/floor.jpg";
img.onload = function() {
//Add image to dynamic texture
textureContext.drawImage(this, 0, 0);
textureGround.update();
//Add text to dynamic texture
var font = "bold 44px Arial";
textureGround.drawText("Grass", 75, 135, font, "green", null, true, true);
}