Drawing two orthogonal strings in 3d space in Android Canvas

Problems with Canvas, OpenGL, etc...

Drawing two orthogonal strings in 3d space in Android Canvas

Postby hasan » Mon Nov 26, 2012 9:05 am

I want to draw two strings in canvas.First string must be rotated around Y axis,for example 45 degrees.Second string must be start at the end of first string and also it must be orthogonal to first string.

This is my code:

Code: Select all
String text = "In the";
float textWidth = redPaint.measureText(text);

Matrix m0 = new Matrix();
Matrix m1 = new Matrix();
Matrix m2 = new Matrix();
mCamera = new Camera();
canvas.setMatrix(null);
canvas.save();

mCamera.rotateY(45);
mCamera.getMatrix(m0);
m0.preTranslate(-100, -100);
m0.postTranslate(100, 100);
canvas.setMatrix(m0);
canvas.drawText(text, 100, 100, redPaint);

mCamera = new Camera();
mCamera.rotateY(90);
mCamera.getMatrix(m1); 
m1.preTranslate(-textWidth - 100, -100);
m1.postTranslate(textWidth + 100, 100);

m2.setConcat(m1, m0);
canvas.setMatrix(m2);
canvas.drawText(text, 100 + textWidth, 100, greenPaint);

But in result,only first string(text with red font)is visible.

How can I do drawing two orthogonal strings in 3d space?
hasan
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Nov 26, 2012 9:01 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests