- Sort Posts
- 4 replies
- Last post
Re: Replacing 3d object with few lines of text.
Hey, I've done something like this before on iOS where you have dynamic tracking text.
The way I did it was to set up a UILabel in a view and then getting the image of it. Then use this UIImage to make a texture and texture a plane:
UILabel *label = [[UILabel alloc] init]; // configure the label with your font and text ... ... UIGraphicsBeginImageContext(label.frame.size); [label.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *labelImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
This was the simplest solution I could think of at the time as I just needed to do it once (I don't know how this would perform if you were changing the text every few seconds e.g. for a count-down timer).
Re: Replacing 3d object with few lines of text.
Hey, I've done something like this before on iOS where you have dynamic tracking text.
The way I did it was to set up a UILabel in a view and then getting the image of it. Then use this UIImage to make a texture and texture a plane:
UILabel *label = [[UILabel alloc] init]; // configure the label with your font and text ... ... UIGraphicsBeginImageContext(label.frame.size); [label.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *labelImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();This was the simplest solution I could think of at the time as I just needed to do it once (I don't know how this would perform if you were changing the text every few seconds e.g. for a count-down timer).
Hi omartayeb,
Thanks for the info..:)
But can you provide me a sample app if possible, so that i can try it first on my android and study the code?? i have no idea what you are saying..because im totally new to all these opengl, 3d animation and android programming..
Re: Replacing 3d object with few lines of text.
The example he gave is for iOS, but it's a good idea if you need static text. You could probably do something similar for Android.
You're going to need a basic understanding of Android programming and OpenGL ES to make any progress here, however. We won't be able to help much with the basics, I suggest starting by picking apart the rendering code in the samples and reading up on OpenGL enough to understand what's going on.
- Kim
If you're using Unity this should be easy, try using a text mesh:
http://unity3d.com/support/documentation/Components/class-TextMesh.html
If you're using the native SDK it's more complex. QCAR just hooks you up to OpenGL ES, a standard API for 3D rendering on mobile platforms. You'll need to find an OpenGL ES solution for rendering text. It isn't a trivial problem (text rendering isn't part of the API) but you should be able to find some solutions out on the web.
- Kim