평면 위에 두 개의 텍스처를 어떻게 랩핑합니까? 나는 그것을 해냈다 고 생각하지만, 질감은 내가 원하는 모든 조각을 채우고있다.평면 위에 두 개의 질감을 감 쌉니?
어떤 도움을 ~ Aedon
을 감사InputStream is = context.getResources().openRawResource(R.drawable.woodtexture1);
InputStream is2 = context.getResources().openRawResource(R.drawable.bandtest);
Bitmap bitmap = null;
Bitmap b2 = null;
try {
//BitmapFactory is an Android graphics utility for images
bitmap = BitmapFactory.decodeStream(is);
b2 = BitmapFactory.decodeStream(is2);
} finally {
//Always clear and close
try {
is.close();
is2.close();
is = null;
is = null;
} catch (IOException e) {}
}
//Generate one texture pointer...
gl.glGenTextures(1, textures, 0);
//...and bind it to our array
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
//Create Nearest Filtered Texture
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
//Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
//Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
//Generate one texture pointer...
gl.glGenTextures(1, textures, 0);
//...and bind it to our array
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
//Create Nearest Filtered Texture
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
//Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_ONE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_ONE);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, b2, 0);
시도한 코드 중 일부가 도움이 될 수 있으며 문제가 무엇인지 확인할 수 있습니다. – stealthcopter