Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

This is my code:

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 the first string (drawn red) is visible.

How can I draw two orthogonal strings in 3D space?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.