当前位置: 首页>>代码示例>>Java>>正文


Java GLES20.glCheckFramebufferStatus方法代码示例

本文整理汇总了Java中android.opengl.GLES20.glCheckFramebufferStatus方法的典型用法代码示例。如果您正苦于以下问题:Java GLES20.glCheckFramebufferStatus方法的具体用法?Java GLES20.glCheckFramebufferStatus怎么用?Java GLES20.glCheckFramebufferStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glCheckFramebufferStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: initFBO

import android.opengl.GLES20; //导入方法依赖的package包/类
private void initFBO(int width, int height)
{
    Log.d(LOGTAG, "initFBO("+width+"x"+height+")");

    deleteFBO();

    GLES20.glGenTextures(1, texDraw, 0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texDraw[0]);
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);

    GLES20.glGenTextures(1, texFBO, 0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texFBO[0]);
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);

    //int hFBO;
    GLES20.glGenFramebuffers(1, FBO, 0);
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, FBO[0]);
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texFBO[0], 0);
    Log.d(LOGTAG, "initFBO error status: " + GLES20.glGetError());

    int FBOstatus = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
    if (FBOstatus != GLES20.GL_FRAMEBUFFER_COMPLETE)
        Log.e(LOGTAG, "initFBO failed, status: " + FBOstatus);

    mFBOWidth  = width;
    mFBOHeight = height;
}
 
开发者ID:jorenham,项目名称:fingerblox,代码行数:36,代码来源:CameraGLRendererBase.java

示例3: update

import android.opengl.GLES20; //导入方法依赖的package包/类
private void update(RectF bounds, Runnable action) {
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, getReusableFramebuffer());
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, getTexture(), 0);

    int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
    if (status == GLES20.GL_FRAMEBUFFER_COMPLETE) {
        GLES20.glViewport(0, 0, (int) size.width, (int) size.height);
        action.run();
    }
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    if (!isSuppressingChanges() && delegate != null) {
        delegate.contentChanged(bounds);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:16,代码来源:Painting.java

示例4: createEffectTexture

import android.opengl.GLES20; //导入方法依赖的package包/类
private void createEffectTexture() {
    AndroidUntil.checkGlError("initFBO_S");
    GLES20.glGenFramebuffers(1, mFboId, 0);
    GLES20.glGenRenderbuffers(1, mRboId, 0);
    GLES20.glGenTextures(1, mTexId, 0);

    GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, mRboId[0]);
    GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,
            GLES20.GL_DEPTH_COMPONENT16, mWidth, mHeight);

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFboId[0]);
    GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,
            GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, mRboId[0]);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexId[0]);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
            GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA,
            mWidth, mHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);

    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER,
            GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mTexId[0], 0);

    if (GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER) !=
            GLES20.GL_FRAMEBUFFER_COMPLETE) {
        throw new RuntimeException("glCheckFramebufferStatus()");
    }
    AndroidUntil.checkGlError("initFBO_E");
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:38,代码来源:Effect.java

示例5: createFbo

import android.opengl.GLES20; //导入方法依赖的package包/类
private int createFbo(int width, int height) {
    int[] texture = new int[1];
    int[] fbo = new int[1];
    GLES20.glGenFramebuffers(1, fbo, 0);
    GLES20.glGenTextures(1, texture, 0);
    mFbo = fbo[0];
    mDstTexture = texture[0];

    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mDstTexture);
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);

    // Bind the framebuffer
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFbo);
    // Specify texture as color attachment
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mDstTexture, 0);

    // Check for framebuffer complete
    int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
    if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
        Log.e(LOG_TAG, "Failed to create framebuffer!!!");
    }

    return 0;
}
 
开发者ID:AgoraIO,项目名称:Agora-Video-Source-Android,代码行数:29,代码来源:CustomizedCameraRenderer.java

示例6: prepareFramebuffer

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Prepares the off-screen framebuffer.
 */
private void prepareFramebuffer(int width, int height) {
    GlUtil.checkGlError("prepareFramebuffer start");

    int[] values = new int[1];

    // Create a texture object and bind it.  This will be the color buffer.
    GLES20.glGenTextures(1, values, 0);
    GlUtil.checkGlError("glGenTextures");
    mOffscreenTexture = values[0];   // expected > 0
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mOffscreenTexture);
    GlUtil.checkGlError("glBindTexture " + mOffscreenTexture);

    // Create texture storage.
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
            GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);

    // Set parameters.  We're probably using non-power-of-two dimensions, so
    // some values may not be available for use.
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,
            GLES20.GL_NEAREST);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,
            GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
            GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
            GLES20.GL_CLAMP_TO_EDGE);
    GlUtil.checkGlError("glTexParameter");

    // Create framebuffer object and bind it.
    GLES20.glGenFramebuffers(1, values, 0);
    GlUtil.checkGlError("glGenFramebuffers");
    mFramebuffer = values[0];    // expected > 0
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFramebuffer);
    GlUtil.checkGlError("glBindFramebuffer " + mFramebuffer);

    // Create a depth buffer and bind it.
    GLES20.glGenRenderbuffers(1, values, 0);
    GlUtil.checkGlError("glGenRenderbuffers");
    mDepthBuffer = values[0];    // expected > 0
    GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, mDepthBuffer);
    GlUtil.checkGlError("glBindRenderbuffer " + mDepthBuffer);

    // Allocate storage for the depth buffer.
    GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16,
            width, height);
    GlUtil.checkGlError("glRenderbufferStorage");

    // Attach the depth buffer and the texture (color buffer) to the framebuffer object.
    GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT,
            GLES20.GL_RENDERBUFFER, mDepthBuffer);
    GlUtil.checkGlError("glFramebufferRenderbuffer");
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
            GLES20.GL_TEXTURE_2D, mOffscreenTexture, 0);
    GlUtil.checkGlError("glFramebufferTexture2D");

    // See if GLES is happy with all this.
    int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
    if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
        throw new RuntimeException("Framebuffer not complete, status=" + status);
    }

    // Switch back to the default framebuffer.
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    GlUtil.checkGlError("prepareFramebuffer done");
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:70,代码来源:RecordFBOActivity.java

示例7: status

import android.opengl.GLES20; //导入方法依赖的package包/类
public boolean status() {
	bind();
	return GLES20.glCheckFramebufferStatus( GLES20.GL_FRAMEBUFFER ) == GLES20.GL_FRAMEBUFFER_COMPLETE;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:5,代码来源:Framebuffer.java


注:本文中的android.opengl.GLES20.glCheckFramebufferStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。