Java Code Examples for android.opengl.GLES20#GL_TEXTURE0

The following examples show how to use android.opengl.GLES20#GL_TEXTURE0 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLSurface.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * インスタンス生成のヘルパーメソッド(GL_TEXTURE_2D), デプスバッファ無し
 * テクスチャユニットはGL_TEXTURE0
 * @param isGLES3
 * @param width
 * @param height
 */
@SuppressLint("NewApi")
public static GLSurface newInstance(final boolean isGLES3,
	final int width, final int height) {

	if (isGLES3 && BuildCheck.isAndroid4_3()) {
		return new GLSurfaceES3(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE0, -1,
			width, height, false, DEFAULT_ADJUST_POWER2);
	} else {
		return new GLSurfaceES2(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE0, -1,
			width, height, false, DEFAULT_ADJUST_POWER2);
	}
}
 
Example 2
Source File: GLSurface.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * インスタンス生成のヘルパーメソッド(GL_TEXTURE_2D)
 * テクスチャユニットはGL_TEXTURE0
 * @param isGLES3
 * @param width dimension of offscreen(width)
 * @param height dimension of offscreen(height)
 * @param use_depth_buffer set true if you use depth buffer. the depth is fixed as 16bits
 */
@SuppressLint("NewApi")
public static GLSurface newInstance(final boolean isGLES3,
	final int width, final int height,
	final boolean use_depth_buffer) {

	if (isGLES3 && BuildCheck.isAndroid4_3()) {
		return new GLSurfaceES3(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE0, -1,
			width, height, use_depth_buffer, DEFAULT_ADJUST_POWER2);
	} else {
		return new GLSurfaceES2(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE0, -1,
			width, height, use_depth_buffer, DEFAULT_ADJUST_POWER2);
	}
}
 
Example 3
Source File: GLSurface.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * インスタンス生成のヘルパーメソッド(GL_TEXTURE_2D)
 * テクスチャユニットはGL_TEXTURE0
 * @param isGLES3
 * @param width
 * @param height
 * @param use_depth_buffer
 * @param adjust_power2
 */
@SuppressLint("NewApi")
public static GLSurface newInstance(final boolean isGLES3,
	final int width, final int height,
	final boolean use_depth_buffer, final boolean adjust_power2) {

	if (isGLES3 && BuildCheck.isAndroid4_3()) {
		return new GLSurfaceES3(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE0, -1,
			width, height, use_depth_buffer, adjust_power2);
	} else {
		return new GLSurfaceES2(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE0, -1,
			width, height, use_depth_buffer, adjust_power2);
	}
}
 
Example 4
Source File: GLState.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @param pGLActiveTexture from {@link GLES20#GL_TEXTURE0} to {@link GLES20#GL_TEXTURE31}.
 */
public void activeTexture(final int pGLActiveTexture) {
	final int activeTextureIndex = pGLActiveTexture - GLES20.GL_TEXTURE0;
	if (pGLActiveTexture != this.mCurrentActiveTextureIndex) {
		this.mCurrentActiveTextureIndex = activeTextureIndex;
		GLES20.glActiveTexture(pGLActiveTexture);
	}
}
 
Example 5
Source File: GLState.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
/**
 * @param pGLActiveTexture from {@link GLES20#GL_TEXTURE0} to {@link GLES20#GL_TEXTURE31}.
 */
public void activeTexture(final int pGLActiveTexture) {
	final int activeTextureIndex = pGLActiveTexture - GLES20.GL_TEXTURE0;
	if(pGLActiveTexture != this.mCurrentActiveTextureIndex) {
		this.mCurrentActiveTextureIndex = activeTextureIndex;
		GLES20.glActiveTexture(pGLActiveTexture);
	}
}
 
Example 6
Source File: GLProgram.java    From AndroidDemo with MIT License 4 votes vote down vote up
/**
 * prepared for later use
 */
public void setup(int position) {
    switch (mWinPosition) {
        case 1:
            _vertices = squareVertices1;
            _textureI = GLES20.GL_TEXTURE0;
            _textureII = GLES20.GL_TEXTURE1;
            _textureIII = GLES20.GL_TEXTURE2;
            _tIindex = 0;
            _tIIindex = 1;
            _tIIIindex = 2;
            break;
        case 2:
            _vertices = squareVertices2;
            _textureI = GLES20.GL_TEXTURE3;
            _textureII = GLES20.GL_TEXTURE4;
            _textureIII = GLES20.GL_TEXTURE5;
            _tIindex = 3;
            _tIIindex = 4;
            _tIIIindex = 5;
            break;
        case 3:
            _vertices = squareVertices3;
            _textureI = GLES20.GL_TEXTURE6;
            _textureII = GLES20.GL_TEXTURE7;
            _textureIII = GLES20.GL_TEXTURE8;
            _tIindex = 6;
            _tIIindex = 7;
            _tIIIindex = 8;
            break;
        case 4:
            _vertices = squareVertices4;
            _textureI = GLES20.GL_TEXTURE9;
            _textureII = GLES20.GL_TEXTURE10;
            _textureIII = GLES20.GL_TEXTURE11;
            _tIindex = 9;
            _tIIindex = 10;
            _tIIIindex = 11;
            break;
        case 0:
        default:
            _vertices = squareVertices;
            _textureI = GLES20.GL_TEXTURE0;
            _textureII = GLES20.GL_TEXTURE1;
            _textureIII = GLES20.GL_TEXTURE2;
            _tIindex = 0;
            _tIIindex = 1;
            _tIIIindex = 2;
            break;
    }
}
 
Example 7
Source File: GLState.java    From tilt-game-android with MIT License 4 votes vote down vote up
/**
 * @return {@link GLES20#GL_TEXTURE0} to {@link GLES20#GL_TEXTURE31}
 */
public int getActiveTexture() {
	return this.mCurrentActiveTextureIndex + GLES20.GL_TEXTURE0;
}
 
Example 8
Source File: GLState.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
/**
 * @return {@link GLES20#GL_TEXTURE0} to {@link GLES20#GL_TEXTURE31}
 */
public int getActiveTexture() {
	return this.mCurrentActiveTextureIndex + GLES20.GL_TEXTURE0;
}
 
Example 9
Source File: GLTexture.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * テクスチャユニットが常時GL_TEXTURE0なので複数のテクスチャを同時に使えない
 * @param width テクスチャサイズ
 * @param height テクスチャサイズ
 * @param filter_param	テクスチャの補間方法を指定 GL_LINEARとかGL_NEAREST
 */
public GLTexture(final int width, final int height, final int filter_param) {
	this(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE0, width, height, filter_param);
}