我希望你試圖產生一個谷歌地圖傾斜/旋轉效果,我已經成功完成谷歌地圖,因爲他們不認爲我們需要更新;-),我需要它爲我的應用程序,即使你正在使用你自己的瓷磚,它基本上是一樣的東西。
有幫助的一件事是意識到Camera Matrix的旋轉在左上角執行。
因此,您應該轉換到適當的位置(取決於旋轉軸和您的預期結果),然後返回,例如...在閱讀文檔之前,您獲得的效果與我的效果非常相似,出。
camera.save();
camera.rotateX(tilt); // tilt forward or backward
camera.rotateY(0);
camera.rotateZ(angle); // Rotate around Z access (similar to canvas.rotate)
camera.getMatrix(cameraMatrix);
// This moves the center of the view into the upper left corner (0,0)
// which is necessary because Matrix always uses 0,0, as it's transform point
// use the center of the canvas, or the bottom center dependent on your results
cameraMatrix.preTranslate(-centerX, -centerY);
// NOTE: Camera Rotations logically happen here when the canvas has the matrix applied
// This happens after the camera rotations are applied, moving the view back to
// where it belongs, allowing us to rotate around the center or any point we choose
// Move it back after the rotations are applied
cameraMatrix.postTranslate(centerX, centerY);
camera.restore();
canvas.concat(cameraMatrix);
其他的事情做的是特大型容器,所以你沒有空的空間(或者至少限制的話)你的後傾/旋轉操作,你可以做到這一點通過計算所需的超大中,你的顯示器的對角線適用於基本旋轉,+如果你正在使用它,則基於傾斜的百分比。
玩pre/postTranslate可以給你一些有趣的結果。
至於運動,我真的不知道爲什麼你這樣做,大概平移,但只要在畫布上是越來越充滿它不應該的問題
更新
這裏是位圖我如何超大畫布,我試圖使用LayoutParams來做到這一點,但沒有太多的運氣,所以測量是我的方式。
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (!isInEditMode())
super.onMeasure(View.MeasureSpec.makeMeasureSpec(scaledDimensionsW,
View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(scaledDimensionsH,
View.MeasureSpec.EXACTLY));
else
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
嗯我很擔心我會收到這個答案。所以也是第二個問題。任何提示樣本解決方案,應該可以幫助我更好地理解如何在OpenGL中顯示動態加載的位圖?我知道有很多教程,但每個節目只顯示如何顯示已經預載的位圖或一些矢量。謝謝 –
接受這個答案之後再過一年積極發展。似乎常見的「畫布」方式對於此任務來說不夠強大,並且使用OpenGL是唯一的解決方案。謝謝你的幫助 –