当前位置: 首页>>代码示例>>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;未经允许,请勿转载。