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


Java GLES20.glBlendFunc方法代碼示例

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


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

示例1: onDraw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
protected void onDraw() {
    //todo change blend and viewport
    super.onDraw();
    if(markTextureId!=-1){
        GLES20.glGetIntegerv(GLES20.GL_VIEWPORT,viewPort,0);
        GLES20.glViewport(markPort[0],mHeight-markPort[3]-markPort[1],markPort[2],markPort[3]);

        GLES20.glEnable(GLES20.GL_BLEND);
        GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);
        GLES20.glBlendEquation(GLES20.GL_FUNC_ADD);
        mark.draw(markTextureId);
        GLES20.glDisable(GLES20.GL_BLEND);

        GLES20.glViewport(viewPort[0],viewPort[1],viewPort[2],viewPort[3]);
    }
    //todo reset blend and view port
}
 
開發者ID:aiyaapp,項目名稱:AAVT,代碼行數:19,代碼來源:WaterMarkFilter.java

示例2: onDraw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
protected void onDraw() {
    super.onDraw();

    // 開啟混合
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    for (ComponentRender componentRender : mComponentRenders) {
        componentRender.setScreenAnchor(mScreenAnchor);
        componentRender.updateRenderVertices(getWidth(), getHeight());
        componentRender.onDraw(mTextureHandle, mPositionHandle, mTextureCoordHandle, mTextureVertices[2]);
    }

    GLES20.glDisable(GLES20.GL_BLEND);
}
 
開發者ID:uestccokey,項目名稱:EZFilter,代碼行數:17,代碼來源:StickerRender.java

示例3: renderBlit

import android.opengl.GLES20; //導入方法依賴的package包/類
private void renderBlit() {
    Shader shader = shaders.get("blit");
    if (shader == null) {
        return;
    }

    GLES20.glUseProgram(shader.program);

    GLES20.glUniformMatrix4fv(shader.getUniform("mvpMatrix"), 1, false, FloatBuffer.wrap(renderProjection));
    GLES20.glUniform1i(shader.getUniform("texture"), 0);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, getTexture());

    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    GLES20.glVertexAttribPointer(0, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer);
    GLES20.glEnableVertexAttribArray(0);
    GLES20.glVertexAttribPointer(1, 2, GLES20.GL_FLOAT, false, 8, textureBuffer);
    GLES20.glEnableVertexAttribArray(1);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

    Utils.HasGLError();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:26,代碼來源:Painting.java

示例4: run

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void run() {
    if (!initialized || shuttingDown) {
        return;
    }

    setCurrentContext();

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
    GLES20.glViewport(0, 0, bufferWidth, bufferHeight);

    GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    painting.render();

    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    egl10.eglSwapBuffers(eglDisplay, eglSurface);

    if (!ready) {
        queue.postRunnable(new Runnable() {
            @Override
            public void run() {
                ready = true;
            }
        }, 200);
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:30,代碼來源:RenderView.java

示例5: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Draws the scene.
 */
private void draw() {
    GlUtil.checkGlError("draw start");

    // Clear to a non-black color to make the content easily differentiable from
    // the pillar-/letter-boxing.
    GLES20.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    // Textures may include alpha, so turn blending on.
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    if (mUseFlatShading) {
        mTri.draw(mFlatProgram, mDisplayProjectionMatrix);
        mRect.draw(mFlatProgram, mDisplayProjectionMatrix);
    } else {
        mTri.draw(mTexProgram, mDisplayProjectionMatrix);
        mRect.draw(mTexProgram, mDisplayProjectionMatrix);
    }
    GLES20.glDisable(GLES20.GL_BLEND);

    for (int i = 0; i < 4; i++) {
        mEdges[i].draw(mFlatProgram, mDisplayProjectionMatrix);
    }

    GlUtil.checkGlError("draw done");
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:30,代碼來源:HardwareScalerActivity.java

示例6: drawUIOverlay

import android.opengl.GLES20; //導入方法依賴的package包/類
private void drawUIOverlay() {
    mColorFilter = CLEAR_COLOR_FILTER;
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    
    GLES20.glUniform1i(mTexHandle, 1);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glUniform1i");
    
    GLES20.glVertexAttribPointer(mTexCoordHandle, 2, GLES20.GL_FLOAT,
            false, 0, mUITextureCoord);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:12,代碼來源:StereoDiveEffect.java

示例7: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw() {
	if (light) {
		GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
		super.draw();
		GLES20.glBlendFunc(GL10.GL_SRC_ALPHA,
				GL10.GL_ONE_MINUS_SRC_ALPHA);
	} else {
		try {
			super.draw();
		} catch (Exception e) {
		}
	}
}
 
開發者ID:G2159687,項目名稱:ESPD,代碼行數:15,代碼來源:PixelScene.java

示例8: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw() {
	
	super.draw();
	
	if (lightMode) {
		GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
		drawRays();
		GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
	} else {
		drawRays();
	}
}
 
開發者ID:mango-tree,項目名稱:UNIST-pixel-dungeon,代碼行數:14,代碼來源:Flare.java

示例9: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw() {
	GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
	super.draw();
	GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
}
 
開發者ID:mango-tree,項目名稱:UNIST-pixel-dungeon,代碼行數:7,代碼來源:Identification.java

示例10: onSurfaceCreated

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

    // Set the background clear color to black.
    GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    // Use culling to remove back face.
    GLES20.glDisable(GLES20.GL_CULL_FACE);

    // Enable depth testing
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);

    // Enable blending
    GLES20.glEnable(GLES20.GL_BLEND);

    GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE);

    mCube = new Cube(mActivity);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:20,代碼來源:LessonFiveRenderer.java

示例11: onDrawFrame

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 glUnused) {
    synchronized(this) {
        if (updateSurface) {
            surface.updateTexImage();
            surface.getTransformMatrix(sTMatrix);
            updateSurface = false;
        }
    }
    GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    GLES20.glUseProgram(program);
    checkGlError("glUseProgram");

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureID);

    triangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
    GLES20.glVertexAttribPointer(aPositionHandle, 3, GLES20.GL_FLOAT, false,
            TRIANGLE_VERTICES_DATA_STRIDE_BYTES, triangleVertices);
    checkGlError("glVertexAttribPointer maPosition");
    GLES20.glEnableVertexAttribArray(aPositionHandle);
    checkGlError("glEnableVertexAttribArray aPositionHandle");

    triangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
    GLES20.glVertexAttribPointer(aTextureHandle, 3, GLES20.GL_FLOAT, false,
            TRIANGLE_VERTICES_DATA_STRIDE_BYTES, triangleVertices);
    checkGlError("glVertexAttribPointer aTextureHandle");
    GLES20.glEnableVertexAttribArray(aTextureHandle);
    checkGlError("glEnableVertexAttribArray aTextureHandle");

    Matrix.setIdentityM(mVPMatrix, 0);
    GLES20.glUniformMatrix4fv(uMVPMatrixHandle, 1, false, mVPMatrix, 0);
    GLES20.glUniformMatrix4fv(uSTMatrixHandle, 1, false, sTMatrix, 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    checkGlError("glDrawArrays");

    GLES20.glFinish();
}
 
開發者ID:pavelsemak,項目名稱:alpha-movie,代碼行數:45,代碼來源:VideoRenderer.java

示例12: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw() {
	GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
	super.draw();
	GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
}
 
開發者ID:G2159687,項目名稱:ESPD,代碼行數:7,代碼來源:GhostSprite.java

示例13: render

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
     * draws Sphere objects
     * @param aMVPMatrix
     */
    public void render(float[] aMVPMatrix) {

        if(BLENDING) {
            // Enable blending
            GLES20.glEnable(GLES20.GL_BLEND);
//            GLES20.glBlendFuncSeparate(GLES20.GL_ONE_MINUS_SRC_COLOR, GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);
            GLES20.glBlendFunc( GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);

//            GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
        }
        // Set our per-vertex lighting program.
        GLES20.glUseProgram(aSphereProgramHandle);

        int aSphereMVPMatrixHandle = GLES20.glGetUniformLocation(aSphereProgramHandle, "u_MVPMatrix");
        int aSpherePositionHandle = GLES20.glGetAttribLocation(aSphereProgramHandle, "a_Position");
        int aSphereColorHandle = GLES20.glGetAttribLocation(aSphereProgramHandle, "a_Color");

        // Pass in the combined matrix.
        //GLES20.glUniformMatrix4fv(aMVPMatrixHandle, 1, false, aMVPMatrix, 0);
        GLES20.glUniformMatrix4fv(aSphereMVPMatrixHandle, 1, false, aMVPMatrix, 0);

        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, aSpheresVerticesBufferIdx);
        GLES20.glEnableVertexAttribArray(aSpherePositionHandle);
        GLES20.glVertexAttribPointer(aSpherePositionHandle, POSITION_DATA_SIZE, GLES20.GL_FLOAT, false, 0, 0);

        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, aSpheresColorsBufferIdx);
        GLES20.glEnableVertexAttribArray(aSphereColorHandle);
        GLES20.glVertexAttribPointer(aSphereColorHandle, COLOR_DATA_SIZE , GLES20.GL_FLOAT, false, 0, 0);

        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

        // Draw the vertices.
        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

        // draw the vertices using indices
//            GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, aSphereIndicesBufferIdx);
//            GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);

        // Clear the currently bound buffer (so future OpenGL calls do not use this buffer).
//            GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);

        if(BLENDING) {
            // Enable blending
            GLES20.glDisable(GLES20.GL_BLEND);
//            GLES20.glBlendFuncSeparate(GLES20.GL_ONE_MINUS_SRC_COLOR, GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);

//            GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
        }
    }
 
開發者ID:regar007,項目名稱:ShapesInOpenGLES2.0,代碼行數:54,代碼來源:Spheres.java


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