Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text on geometry #77

Closed
jonboj opened this issue Jul 21, 2017 · 3 comments
Closed

Text on geometry #77

jonboj opened this issue Jul 21, 2017 · 3 comments

Comments

@jonboj
Copy link

jonboj commented Jul 21, 2017

I try get text on a geometry, looking into threeDart this is done by generation of Shapes for the te string with FontUtils.generateShapes.

https://github.com/threeDart/three.dart/blob/master/lib/extras/geometries/text_geometry.dart#L10


Next step is try to do some equivalent in ChronosGL. I consider a modification of FontUtils.generateShapes to in ChronosGL generate a MeshData.

Question does ChronoGL already provide text on geometry? Or suggestions to alternatives to the design above.

@rhulha
Copy link
Member

rhulha commented Jul 21, 2017

One easy way to get text on geometry is to use a HTML5 Canvas as a texture and write text on the Canvas using fillText: https://www.w3schools.com/graphics/canvas_text.asp

There should be an example on how to use a Canvas as a Texture in the ChronosGL examples.

@robertmuth
Copy link
Contributor

If you need three dimensional letters you can try to port a full blown external library as you describe or you could do this:

  1. extract a two dimensional description of the letter in form of one or more polygons, e.g. the letter would
    basically be two concentric circles.
  2. extrude the polygons
  3. add caps to each side
    There is already rudimentary support for 2) and 3) in ChronosGL, see
    https://github.com/ChronosTeam/ChronosGL/tree/master/lib/src/polygon
    I would be happy to add necessary functionality if needed.

@jonboj
Copy link
Author

jonboj commented Jul 22, 2017

Managed to get text on different geometries with a canvas as suggested above by rhulha. Close issue.

@jonboj jonboj closed this as completed Jul 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants