LibGDX FreetypeFont in 3D - text

Is there a proper way to use GDX FreeTypeFont in 3D?
I'm not trying to rotate the text, but I do want the text to go behind 3D objects if the object's center is in front of the text.
Any ideas on how to do this?
Is there somehow a way to attach a Bitmap to a ModelInstance or something, so I can pass it into a ModelBatch?
Thanks

One way would be to use a Decal and DecalBatch (which are sorted in 3D space). Your can draw the BitmapFont to a Pixmap and then draw that on a decal. You can use the same approach to create a TextureRegion and attach it to a 3D ModelInstance, but I think the Decal way is a little easier.

Related

Making a drawing game using phaser

I am developing a game using Phaser where a user is rendered a triangular canvas. User can crop this canvas to any possible shape by drawing any crop pattern on the canvas. Besides this, i need to get this cropped canvas in suitable data format to be used as an image to render and also trace changes made on this canvas for undoing puspose.
Any help to get this through will be appreciated.
Thanks in advance.
Initial canvas
Canvas after crop
Cropped canvas used to create new canvas
So it's like folding a piece of paper and then cutting it so it looks like a snowflake? Interesting idea.
I think you could either use BitmapData to draw the initial cut out, then copy that bitmap 6 (or 12?) times and rotate and flip x-axis to construct the rest. Though maybe there will be seems, so like small lines, between the parts idk.
Another appproach would be to keep track of the initial cutlines like vectors. Then use math/trigonometry to calculate the result. No idea how to do this though, sorry.

Java 8/JavaFX: Drawing text in a rectangle

Is there a way to bind text to a JavaFX shape (for my purposes, I want to use rectangles) the same way you could using Graphics2D's drawString in previous versions of Java?
You may be able to just use Graphics2D still; I just don't know how to implement it.
Note: What isn't helpful is a way to place a Text object at the same x and y position as the shape on canvas. Rather, is there a way to actually write onto the Rectangle?

The color of the triangle mesh is affected after I call the function SetScalars

I read one triangle mesh file from the disk. The mesh itself contains color
information. I can render the mesh correctly. The color of rendered mesh
is from the color information of the mesh. To use the scalars, I call the
function SetScalars. The color of the rendered mesh is changed and now the
color is from scalars. However I hope to use the color of the mesh. I can
find the answer from the internet. Can anyone help me?
Regards
Jogging Song
Why not add the new array with AddArray() rather than SetScalars(). You can also use SelectColorArray() method found in the mapper. See this and this.

Paperjs write text

I'm trying to understand how Paperjs works and I would like to know if it's possible to write text vectors, if yes how?
I tried Raphael.js before this, and I was almost satisfied with it but it seems that Paperjs is more (cross)browser compliant for some reasons, right?
Some examples would be nice!
Thanks for your answers.
Yes, it is definitely possible to create texts in paper.js.
var awesometext = new paper.PointText();
awesometext.content='awesome';
paper is better than raphael because its canvas based. Canvas is better supported on mobiles/tabs and hence the advantage of paperjs. However, since canvas is just a bitmap implementation, zooming will make canvas renderings not so good compared to svg renderings like in raphael.
So, it depends on what your priorities are for your application..
Paperjs handles text-scaling well, but it uses canvas' native methods to render the characters, so you can't access the vector data once they're drawn. But I imagine you'd only want vector characters to manipulate their shape, for example, morphing one letter into another, or creating a font editor.
If you just want hi res text then paperjs can do that no problem... or you could just set a bigger font size.
If you want to render text as vectors in paperjs, have a look at https://nodebox.github.io/opentype.js/

Moving elements on a layout controlled programmatically

My goal is to create something like the arrow from car that indicates the speed of the car. My problem is that I do not know what is the best practice for moving the green arrow. I have an image arrow.png and I guess I need to manipulate with the place that the picture is shown and with the rotation of the image.
Can someone point to me some guidelines ?
My basic idea is to have a relative layout for the background and to have one image view that will change the position, but the part changing position is little unclear to me. And I do not think that is good idea to play with layout params and margins...
I would probably extend ImageView then override your onDraw method and use canvas.rotate() to rotate the arrow depending on your app state.

Resources