2016-03-10 13 views
1

我有一個圖像。我想在表面視圖上使用相同的尺寸渲染圖像。在rajawali的表面視圖中呈現精確尺寸的圖像作爲原始圖像android

但是,在表面視圖上渲染時,圖像大小會發生變化。

我在初始化的拉賈瓦利平面下:

Plane back; 
SimpleMaterial background = new SimpleMaterial(); 
back = new Plane(1,1,1,1); 
back.setMaterial(background); 
back.addTexture(mTextureManager.addTexture(bg)); // bg is the bitmap image 
addChild(back); 

我看了下面的鏈接,但我不明白了。

Relation between plane size and image dimensions

任何人都可以指定哪些應該是這架飛機的參數,使圖像的大小保持相同的原始圖像。

+0

我有同樣的問題 –

回答

0

從您發佈的問題鏈接獲得了線索。 我改變了RajawaliRenderer.java類,而不是相機類型對象的mCamera,只是將其替換爲Camera2D類。

用法:

Bitmap texture = BitmapFactory.decodeResource(this.mContext.getResources(), ResourceId); 
     planeMat.addTexture(this.mTextureManager.addTexture(texture)); 
     Plane plane = new Plane(1.0f, 1.0f, 1, 1); 
     plane.setRotZ(-90.0f); 
     //plane.setScale(2.8f); 
     plane.setMaterial(planeMat); 
     addChild(plane);