本文整理汇总了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
}
示例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);
}
示例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();
}
示例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);
}
}
示例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");
}
示例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);
}
示例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) {
}
}
}
示例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();
}
}
示例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 );
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}