當前位置: 首頁>>代碼示例>>Java>>正文


Java GLES20.glActiveTexture方法代碼示例

本文整理匯總了Java中android.opengl.GLES20.glActiveTexture方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glActiveTexture方法的具體用法?Java GLES20.glActiveTexture怎麽用?Java GLES20.glActiveTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glActiveTexture方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bindShaderValues

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
protected void bindShaderValues() {
    mRenderVertices.position(0);
    GLES20.glVertexAttribPointer(mPositionHandle, 2, GLES20.GL_FLOAT, false,
            8, mRenderVertices);
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    mTextureVertices[mCurrentRotation].position(0);
    GLES20.glVertexAttribPointer(mTextureCoordHandle, 2, GLES20.GL_FLOAT, false,
            8, mTextureVertices[mCurrentRotation]);
    GLES20.glEnableVertexAttribArray(mTextureCoordHandle);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureIn);
    GLES20.glUniform1i(mTextureHandle, 0);

    mSurfaceTexture.getTransformMatrix(mMatrix);
    GLES20.glUniformMatrix4fv(mMatrixHandle, 1, false, mMatrix, 0);
}
 
開發者ID:uestccokey,項目名稱:EZFilter,代碼行數:19,代碼來源:Camera2Input.java

示例2: prepareTexture

import android.opengl.GLES20; //導入方法依賴的package包/類
private void prepareTexture(BasicTexture texture, int program, ShaderParameter[] params) {
    deleteRecycledResources();
    GLES20.glUseProgram(program);
    checkError();
    GLES20.glDisable(GLES20.GL_BLEND);
    checkError();
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    checkError();
    texture.onBind(this);
    GLES20.glBindTexture(GL_TARGET, texture.getId());
    checkError();
    GLES20.glUniform1i(params[INDEX_TEXTURE_SAMPLER].handle, 0);
    checkError();
    GLES20.glUniform1f(params[INDEX_ALPHA].handle, 1);
    checkError();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:17,代碼來源:GLES20Canvas.java

示例3: onDraw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void onDraw(final int textureId, final FloatBuffer cubeBuffer, final FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mGLProgId);
    runPendingOnDrawTasks();
    if (!mIsInitialized) {
        return;
    }

    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);
    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
            textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);
    if (textureId != OpenGlUtils.NO_TEXTURE) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
        GLES20.glUniform1i(mGLUniformTexture, 0);
    }
    onDrawArraysPre();
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    GLES20.glDisableVertexAttribArray(mGLAttribPosition);
    GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:26,代碼來源:CameraFilter.java

示例4: d

import android.opengl.GLES20; //導入方法依賴的package包/類
@CallSuper
protected void d(int paramInt)
{
    super.d(paramInt);
    for (int i = 0; i < 8; i++) {
        if (this.bu[i] != -1)
        {
            GLES20.glActiveTexture(bs[i]);
            GLES20.glBindTexture(3553, this.bu[i]);
            GLES20.glUniform1i(this.bt[i], 3 + i);
        }
    }
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:14,代碼來源:GPUImageFilterE.java

示例5: onDrawArraysAfter

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysAfter(){
	for(int i = 0; i < inputTextureHandles.length
			&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
	}
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:9,代碼來源:MagicBrannanFilter.java

示例6: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * draw specific texture with specific texture matrix
 * @param tex_id texture ID
 * @param tex_matrix texture matrix、if this is null, the last one use(we don't check size of this array and needs at least 16 of float)
 */
public void draw(final int tex_id, final float[] tex_matrix) {
	GLES20.glUseProgram(hProgram);
	if (tex_matrix != null)
		GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, tex_matrix, 0);
       GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mMvpMatrix, 0);
	GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
	GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex_id);
	GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, VERTEX_NUM);
	GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
       GLES20.glUseProgram(0);
}
 
開發者ID:FacePlusPlus,項目名稱:MegviiFacepp-Android-SDK,代碼行數:17,代碼來源:GLDrawer2D.java

示例7: onDrawArraysAfter

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysAfter(){
	if (mToneCurveTexture[0] != -1){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    }
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:8,代碼來源:MagicSakuraFilter.java

示例8: onDrawArraysPre

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysPre(){
	for(int i = 0; i < inputTextureHandles.length 
			&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
		GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
	}
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:9,代碼來源:MagicAmaroFilter.java

示例9: onDrawArraysPre

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysPre(){
	for(int i = 0; i < inputTextureHandles.length 
			&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
		GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
	}
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:9,代碼來源:MagicEarlyBirdFilter.java

示例10: drawTex

import android.opengl.GLES20; //導入方法依賴的package包/類
private void drawTex(int tex, boolean isOES, int fbo)
{
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);

    if(fbo == 0)
        GLES20.glViewport(0, 0, mView.getWidth(), mView.getHeight());
    else
        GLES20.glViewport(0, 0, mFBOWidth, mFBOHeight);

    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    if(isOES) {
        GLES20.glUseProgram(progOES);
        GLES20.glVertexAttribPointer(vPosOES, 2, GLES20.GL_FLOAT, false, 4*2, vert);
        GLES20.glVertexAttribPointer(vTCOES,  2, GLES20.GL_FLOAT, false, 4*2, texOES);
    } else {
        GLES20.glUseProgram(prog2D);
        GLES20.glVertexAttribPointer(vPos2D, 2, GLES20.GL_FLOAT, false, 4*2, vert);
        GLES20.glVertexAttribPointer(vTC2D,  2, GLES20.GL_FLOAT, false, 4*2, tex2D);
    }

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);

    if(isOES) {
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex);
        GLES20.glUniform1i(GLES20.glGetUniformLocation(progOES, "sTexture"), 0);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
        GLES20.glUniform1i(GLES20.glGetUniformLocation(prog2D, "sTexture"), 0);
    }

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    GLES20.glFlush();
}
 
開發者ID:johnhany,項目名稱:MOAAP,代碼行數:35,代碼來源:CameraGLRendererBase.java

示例11: onDrawArraysAfter

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysAfter(){
	for(int i = 0; i < inputTextureHandles.length
			&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0+i);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
	}
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:9,代碼來源:MagicXproIIFilter.java

示例12: onDrawArraysAfter

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysAfter(){
	if (mToneCurveTexture[0] != -1){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    }
	if (mMaskGrey1TextureId != -1){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
		GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    }
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:13,代碼來源:MagicHealthyFilter.java

示例13: setSize

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * (Re)allocate texture. Will do nothing if the requested size equals the current size. An
 * EGLContext must be bound on the current thread when calling this function. Must be called at
 * least once before using the framebuffer. May be called multiple times to change size.
 */
public void setSize(int width, int height) {
  if (width == 0 || height == 0) {
    throw new IllegalArgumentException("Invalid size: " + width + "x" + height);
  }
  if (width == this.width && height == this.height) {
    return;
  }
  this.width = width;
  this.height = height;

  // Allocate texture.
  GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
  GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, pixelFormat, width, height, 0, pixelFormat,
      GLES20.GL_UNSIGNED_BYTE, null);
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
  GlUtil.checkNoGLES2Error("GlTextureFrameBuffer setSize");

  // Attach the texture to the framebuffer as color attachment.
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBufferId);
  GLES20.glFramebufferTexture2D(
      GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, textureId, 0);

  // Check that the framebuffer is in a good state.
  final int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
  if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
    throw new IllegalStateException("Framebuffer not complete, status: " + status);
  }

  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
}
 
開發者ID:lgyjg,項目名稱:AndroidRTC,代碼行數:37,代碼來源:GlTextureFrameBuffer.java

示例14: createExternalTextures

import android.opengl.GLES20; //導入方法依賴的package包/類
public static void createExternalTextures(int cantidad, int[] texturesId, int position) {
  GLES20.glGenTextures(cantidad, texturesId, position);
  for (int i = 0; i < cantidad; i++) {
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + position + i);
    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texturesId[position + i]);
    GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
        GLES20.GL_LINEAR);
    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);
  }
}
 
開發者ID:pedroSG94,項目名稱:rtmp-rtsp-stream-client-java,代碼行數:16,代碼來源:GlUtil.java

示例15: onDrawArraysPre

import android.opengl.GLES20; //導入方法依賴的package包/類
protected void onDrawArraysPre(){
	if (mToneCurveTexture[0] != -1){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
		GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
    }
	if (mMaskGrey1TextureId != -1){
		GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
		GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
		GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
    }
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:13,代碼來源:MagicSweetsFilter.java


注:本文中的android.opengl.GLES20.glActiveTexture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。