xtk / X

The X Toolkit
http://www.goXTK.com
Other
795 stars 266 forks source link

New object : text object #97

Open Ricola3D opened 12 years ago

Ricola3D commented 12 years ago

Hey Haehn,

I'm here cause I'll probably have to add a new type of objet to my instance of XTK : a slide rendering a texture (with text on it) and that is not rotated by the vertex shader. Indeed for a medical use I need measures on my 3D meshes, so now I've the 3D picking I need to draw the mesures (2 points, 1 line between, 1 number).

I understand for it I'll have to :

And so i'm here to see if you have any advice of how to do it ? I know that to generate the texture I can use the 2D context of an hidden Canvas like they say here (http://webglfactory.blogspot.fr/2011/06/render-text-with-canvas-2d.html), but I've no idea of how to change the shader and rendering loop :(

Cheers,

Ricola3D

haehn commented 12 years ago

Hi, what about creating the text like a caption so only on the DOM side?

Ricola3D commented 12 years ago

Yep it's possible, it only does a few changes. But is it good for benchmarks to move an html element at every camera movement without using the CPU ?

And it mixes up the 'view' (HTML/CSS) and the 'controler/model' (3D). Is it very hard to add a boolean in shader's attributes so that if this is true, the view matrix is not applied to its vertices ? Or to change code so that the renderers rotate text objets the opposite of the view matrix ? I'm not afraid of coding now

2012/9/6 Daniel Haehn notifications@github.com

Hi, what about creating the text like a caption so only on the DOM side?

— Reply to this email directly or view it on GitHubhttps://github.com/xtk/X/issues/97#issuecomment-8331936.

haehn commented 12 years ago

That's fine then, give it a shot!! I do think that HTML rendered text looks better than the WebGL one. Performance should be fine.