2011-02-15 78 views
1

我已經編寫繪製三角形和矩形的代碼。使用OpenGL for Android繪製三角形的紋理問題

// Reset the Modelview Matrix 
gl.glLoadIdentity(); 
gl.glTranslatef(0.0f, -1.2f, -6.0f);  
tt.draw(gl); //rectangle class draw method   

gl.glTranslatef(0.0f, 2.5f, 0.0f);  
tr.draw(gl); //triangle class draw method 

我有矩形加載紋理

// Load the texture for the rectangle in onSurfaceCreated() 
tt.loadGLTexture(gl, this.context); 

我的問題是上三角形狀的紋理映射也 屏幕截圖是在下面的鏈接可用。 http://www.freeimagehosting.net/uploads/82fe919770.png

我該如何解決這個問題?

+0

截圖對我來說似乎是正確的,你想要什麼? – Calvin1602 2011-02-17 21:22:23

回答

1

這似乎是一個相當簡單的問題來解決,我不相信它是Android的具體...你是否定義你的對象的UV紋理座標?如果你不這樣做,OpenGL將不會正確顯示紋理。您可以在即時模式下使用glTexCoord3f函數,如果您使用C數組,也可以使用glTexCoordPointer。