So I've decided to put here an even simpler example to make things crystal clear:
// create your text field and set its content.
var t:TextField = new TextField();
t.text = "Hello world!";
// create a BitmapData of your wished width and height
var bitmap:BitmapData = new BitmapData(100,100);
// Fill bmp with the content of your TextField.
//It's as if you took a picture of t.
bitmap.draw(t);
// Create a material with the resulting BitmapData and you can use it on any DisplayObject3D!
var material:BitmapMaterial = new BitmapMaterial(bitmap);
material.smooth = true;
material.doubleSided = true;
var p:Plane = new Plane(material,100,100);
scene.addChild(p);
First observation is that it seems impossible to directly embed a UIComponent within papervision *sigh*. Whatever the UIComponent (Button, TextField, etc), it has to be put somehow in a texture and applied on a DisplayObject3D such as a Plane.
Or at least, I have no knowledge of another way to do it. Does anybody know better? My worry is that it may slow down the frame rate to display text in a texture rather than directly as what it really is: good old plain text.

7 comments:
hello
merci pour le petit code c est mieux que rien
Aha! Seems there is a solution. I'm going to try that, thanks to John!
Hi barbara,
I've been trying to figure this out forever! THANK YOU for the insight. It's good to see you're in the ycombinator gang. Looking forward to other great posts.
This could help too:
Text in Papervision3D - Clearing things up | zupko.info
Thank you very much for the code....but the text its pixelated....
Again..thank you very much
How I can get that text "hello World" from a file xml? and not directly form the .as file...thank you in advance
Fantastic thxsomuch! Exactly my dilemma too. I concur, it seems no way to directly use 2D elements in PV3D without "3D-ing" them.
Post a Comment