本文整理汇总了Java中android.opengl.GLES20.GL_TEXTURE_2D属性的典型用法代码示例。如果您正苦于以下问题:Java GLES20.GL_TEXTURE_2D属性的具体用法?Java GLES20.GL_TEXTURE_2D怎么用?Java GLES20.GL_TEXTURE_2D使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.opengl.GLES20
的用法示例。
在下文中一共展示了GLES20.GL_TEXTURE_2D属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitTextureExt
private void onInitTextureExt(boolean isForExternalTextureInput) {
mTextureTarget = GLES20.GL_TEXTURE_2D;
if (isForExternalTextureInput) {
mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
mFragmentShader = "#extension GL_OES_EGL_image_external : require\n" +
mFragmentShader.replace("uniform sampler2D inputImageTexture;",
"uniform samplerExternalOES inputImageTexture;");
int[] textures = new int[1];
GLES20.glGenTextures(1, textures, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_NEAREST);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S,
GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T,
GLES20.GL_CLAMP_TO_EDGE);
mSysRenderTexture = textures[0];
}
}
示例2: Texture2dProgram
/**
* Prepares the program in the current EGL context.
*/
public Texture2dProgram(ProgramType programType) {
mProgramType = programType;
switch (programType) {
case TEXTURE_2D:
mTextureTarget = GLES20.GL_TEXTURE_2D;
mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_2D);
break;
case TEXTURE_EXT:
mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT);
break;
case TEXTURE_EXT_BW:
mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT_BW);
break;
case TEXTURE_EXT_FILT:
mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
mProgramHandle = GlUtil.createProgram(VERTEX_SHADER, FRAGMENT_SHADER_EXT_FILT);
break;
default:
throw new RuntimeException("Unhandled type " + programType);
}
if (mProgramHandle == 0) {
throw new RuntimeException("Unable to create program");
}
Log.d(TAG, "Created program " + mProgramHandle + " (" + programType + ")");
// get locations of attributes and uniforms
maPositionLoc = GLES20.glGetAttribLocation(mProgramHandle, "aPosition");
GlUtil.checkLocation(maPositionLoc, "aPosition");
maTextureCoordLoc = GLES20.glGetAttribLocation(mProgramHandle, "aTextureCoord");
GlUtil.checkLocation(maTextureCoordLoc, "aTextureCoord");
muMVPMatrixLoc = GLES20.glGetUniformLocation(mProgramHandle, "uMVPMatrix");
GlUtil.checkLocation(muMVPMatrixLoc, "uMVPMatrix");
muTexMatrixLoc = GLES20.glGetUniformLocation(mProgramHandle, "uTexMatrix");
GlUtil.checkLocation(muTexMatrixLoc, "uTexMatrix");
muKernelLoc = GLES20.glGetUniformLocation(mProgramHandle, "uKernel");
if (muKernelLoc < 0) {
// no kernel in this one
muKernelLoc = -1;
muTexOffsetLoc = -1;
muColorAdjustLoc = -1;
} else {
// has kernel, must also have tex offset and color adj
muTexOffsetLoc = GLES20.glGetUniformLocation(mProgramHandle, "uTexOffset");
GlUtil.checkLocation(muTexOffsetLoc, "uTexOffset");
muColorAdjustLoc = GLES20.glGetUniformLocation(mProgramHandle, "uColorAdjust");
GlUtil.checkLocation(muColorAdjustLoc, "uColorAdjust");
// initialize default values
setKernel(new float[] {0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f}, 0f);
setTexSize(256, 256);
}
}
示例3: getTextureTarget
@Override public int getTextureTarget() {
//return GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
return GLES20.GL_TEXTURE_2D;
}
示例4: getTextureTarget
@Override public int getTextureTarget() {
return GLES20.GL_TEXTURE_2D;
}