Jump to content

Dynamic Texture fillText


Korvo
 Share

Recommended Posts

I am trying to create lines of text on a background that is not square.  Think airplane pulling advertising banner.  

 

When do something like:        

 

   var ground = BABYLON.Mesh.CreateGround("ground1", 70, 10, 2, scene);

instead of

   var ground = BABYLON.Mesh.CreateGround("ground1", 70, 70, 2, scene);

 

my text gets smooshed.

var groundTexture = new BABYLON.DynamicTexture("dynamic texture", 2048, scene, true);var dynamicMaterial = new BABYLON.StandardMaterial('mat', scene);dynamicMaterial.diffuseTexture = groundTexture;dynamicMaterial.specularColor = new BABYLON.Color3(0, 0, 0);dynamicMaterial.backFaceCulling = false;var ground = BABYLON.Mesh.CreateGround("ground1", 70, 70, 2, scene);ground.material = dynamicMaterial;ground.position = new BABYLON.Vector3(0, 1, -20);var clearColor = "#ffffff";var font = "bold 35px Courier New";var invertY = true;var text = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";var color = "black"var x = 10;var y = 35;var context = groundTexture._context;var size = groundTexture.getSize();context.font = font;context.fillStyle = color;context.fillText(text, x, i*35);groundTexture.update(invertY);   

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...