List of usage examples for android.opengl GLES20 GL_REPEAT
int GL_REPEAT
To view the source code for android.opengl GLES20 GL_REPEAT.
Click Source Link
From source file:Main.java
public static void loadTexture(final Context context, int resId, GL10 gl, int[] textures) { Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), resId); gl.glGenTextures(1, textures, 0);/* ww w .j ava 2 s.co m*/ gl.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0); bmp.recycle(); }
From source file:Main.java
/** * Loads the texture with the given id./*from w w w .j a v a2s .c o m*/ * * @param context the application's context * @param resourceId the id of the texture * @return the texture handle */ public static int loadTexture(final Context context, final int resourceId) { final int[] textureHandle = new int[1]; if (!cachedTextureHandles.containsKey(resourceId)) { GLES20.glGenTextures(1, textureHandle, 0); if (textureHandle[0] != 0) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; // Pre scaling off final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); if (textureHandle[0] == 0) { throw new RuntimeException("Error loading texture."); } cachedTextureHandles.put(resourceId, textureHandle[0]); } } return cachedTextureHandles.get(resourceId); }