Java Code Examples for android.opengl.GLES20#glCheckFramebufferStatus()
The following examples show how to use
android.opengl.GLES20#glCheckFramebufferStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLES20Canvas.java From LB-Launcher with Apache License 2.0 | 6 votes |
private static void checkFramebufferStatus() { int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { String msg = ""; switch (status) { case GLES20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: msg = "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"; break; case GLES20.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: msg = "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"; break; case GLES20.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: msg = "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"; break; case GLES20.GL_FRAMEBUFFER_UNSUPPORTED: msg = "GL_FRAMEBUFFER_UNSUPPORTED"; break; } throw new RuntimeException(msg + ":" + Integer.toHexString(status)); } }
Example 2
Source File: GLES20Canvas.java From android-openGL-canvas with Apache License 2.0 | 6 votes |
private static void checkFramebufferStatus() { int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { String msg = ""; switch (status) { case GLES20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: msg = "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"; break; case GLES20.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: msg = "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"; break; case GLES20.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: msg = "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"; break; case GLES20.GL_FRAMEBUFFER_UNSUPPORTED: msg = "GL_FRAMEBUFFER_UNSUPPORTED"; break; } throw new RuntimeException(msg + ":" + Integer.toHexString(status)); } }
Example 3
Source File: CameraGLRendererBase.java From VIA-AI with MIT License | 5 votes |
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; }
Example 4
Source File: CameraGLRendererBase.java From MOAAP with MIT License | 5 votes |
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; }
Example 5
Source File: CameraGLRendererBase.java From MOAAP with MIT License | 5 votes |
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; }
Example 6
Source File: CameraGLRendererBase.java From OpenCV-Android-Object-Detection with MIT License | 5 votes |
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; }
Example 7
Source File: CameraGLRendererBase.java From MOAAP with MIT License | 5 votes |
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; }
Example 8
Source File: CameraGLRendererBase.java From ml-authentication with Apache License 2.0 | 5 votes |
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; }
Example 9
Source File: CameraGLRendererBase.java From FtcSamples with MIT License | 5 votes |
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; }
Example 10
Source File: CameraGLRendererBase.java From LPR with Apache License 2.0 | 5 votes |
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; }
Example 11
Source File: FBO.java From PLDroidMediaStreaming with Apache License 2.0 | 4 votes |
/** * Prepares the off-screen framebuffer. */ private void prepareFramebuffer(int width, int height) { GlUtil.checkGlError("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 Log.i(TAG, "prepareFramebuffer mOffscreenTexture:" + mOffscreenTexture); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mOffscreenTexture); GlUtil.checkGlError("glBindTexture"); // Create texture storage. GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameterf(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); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mOffscreenTexture, 0); // 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); } GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0); // Switch back to the default framebuffer. GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GlUtil.checkGlError("glBindFramebuffer"); }
Example 12
Source File: Framebuffer.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public boolean status() { bind(); return GLES20.glCheckFramebufferStatus( GLES20.GL_FRAMEBUFFER ) == GLES20.GL_FRAMEBUFFER_COMPLETE; }
Example 13
Source File: GLState.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public int getFramebufferStatus() { return GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); }
Example 14
Source File: GLSurface.java From libcommon with Apache License 2.0 | 4 votes |
/** * 指定したテクスチャをこのオフスクリーンに割り当てる * @param texture_name * @param width * @param height */ @Override public void assignTexture(final int texture_name, final int width, final int height) { if ((width > mTexWidth) || (height > mTexHeight)) { mWidth = width; mHeight = height; releaseFrameBuffer(); createFrameBuffer(width, height); } mFBOTexId = texture_name; GLES20.glActiveTexture(TEX_UNIT); // フレームバッファオブジェクトをbindする GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBufferObj); com.serenegiant.glutils.es2.GLHelper.checkGlError("glBindFramebuffer " + mFrameBufferObj); // フレームバッファにカラーバッファ(テクスチャ)を接続する GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, TEX_TARGET, mFBOTexId, 0); com.serenegiant.glutils.es2.GLHelper.checkGlError("glFramebufferTexture2D"); if (mHasDepthBuffer) { // フレームバッファにデプスバッファを接続する GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, mDepthBufferObj); com.serenegiant.glutils.es2.GLHelper.checkGlError("glFramebufferRenderbuffer"); } // 正常に終了したかどうかを確認する final int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException("Framebuffer not complete, status=" + status); } // デフォルトのフレームバッファに戻す GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); // テクスチャ座標変換行列を初期化 Matrix.setIdentityM(mTexMatrix, 0); mTexMatrix[0] = width / (float)mTexWidth; mTexMatrix[5] = height / (float)mTexHeight; }
Example 15
Source File: GLES20FramebufferObject.java From CameraRecorder-android with MIT License | 4 votes |
public void setup(final int width, final int height) { final int[] args = new int[1]; GLES20.glGetIntegerv(GL_MAX_TEXTURE_SIZE, args, 0); if (width > args[0] || height > args[0]) { throw new IllegalArgumentException("GL_MAX_TEXTURE_SIZE " + args[0]); } GLES20.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, args, 0); if (width > args[0] || height > args[0]) { throw new IllegalArgumentException("GL_MAX_RENDERBUFFER_SIZE " + args[0]); } GLES20.glGetIntegerv(GL_FRAMEBUFFER_BINDING, args, 0); final int saveFramebuffer = args[0]; GLES20.glGetIntegerv(GL_RENDERBUFFER_BINDING, args, 0); final int saveRenderbuffer = args[0]; GLES20.glGetIntegerv(GL_TEXTURE_BINDING_2D, args, 0); final int saveTexName = args[0]; release(); try { this.width = width; this.height = height; GLES20.glGenFramebuffers(args.length, args, 0); framebufferName = args[0]; GLES20.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName); GLES20.glGenRenderbuffers(args.length, args, 0); renderBufferName = args[0]; GLES20.glBindRenderbuffer(GL_RENDERBUFFER, renderBufferName); GLES20.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height); GLES20.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderBufferName); GLES20.glGenTextures(args.length, args, 0); texName = args[0]; GLES20.glBindTexture(GL_TEXTURE_2D, texName); EglUtil.setupSampler(GL_TEXTURE_2D, GL_LINEAR, GL_NEAREST); GLES20.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, null); GLES20.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texName, 0); final int status = GLES20.glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException("Failed to initialize framebuffer object " + status); } } catch (final RuntimeException e) { release(); throw e; } GLES20.glBindFramebuffer(GL_FRAMEBUFFER, saveFramebuffer); GLES20.glBindRenderbuffer(GL_RENDERBUFFER, saveRenderbuffer); GLES20.glBindTexture(GL_TEXTURE_2D, saveTexName); }
Example 16
Source File: MDDrawingCache.java From MD360Player4Android with Apache License 2.0 | 4 votes |
private void createFrameBuffer(int width, int height){ if (this.mTextureIdOutput != 0) { GLES20.glDeleteTextures(1, new int[] { this.mTextureIdOutput}, 0); } if (this.mRenderBufferId != 0) { GLES20.glDeleteRenderbuffers(1, new int[] { this.mRenderBufferId }, 0); } if (this.mFrameBufferId != 0) { GLES20.glDeleteFramebuffers(1, new int[] { this.mFrameBufferId }, 0); } GLES20.glGetIntegerv(GLES20.GL_FRAMEBUFFER_BINDING, originalFramebufferId, 0); // frame buffer int[] frameBuffer = new int[1]; GLES20.glGenFramebuffers(1, frameBuffer, 0); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffer[0]); mFrameBufferId = frameBuffer[0]; glCheck("Multi Fish Eye frame buffer"); // renderer buffer final int[] renderbufferIds = { 0 }; GLES20.glGenRenderbuffers(1, renderbufferIds, 0); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, renderbufferIds[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16, width, height); mRenderBufferId = renderbufferIds[0]; glCheck("Multi Fish Eye renderer buffer"); final int[] textureIds = { 0 }; GLES20.glGenTextures(1, textureIds, 0); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureIds[0]); 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); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, (Buffer)null); mTextureIdOutput = textureIds[0]; glCheck("Multi Fish Eye texture"); // attach GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mTextureIdOutput, 0); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, renderbufferIds[0]); glCheck("Multi Fish Eye attach"); // check final int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { final String s = "Framebuffer is not complete: "; final String value = String.valueOf(Integer.toHexString(status)); throw new RuntimeException((value.length() != 0) ? s.concat(value) : s); } GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, originalFramebufferId[0]); glCheck("Multi Fish Eye attach"); }
Example 17
Source File: Framebuffer.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
public boolean status() { bind(); return GLES20.glCheckFramebufferStatus( GLES20.GL_FRAMEBUFFER ) == GLES20.GL_FRAMEBUFFER_COMPLETE; }
Example 18
Source File: GlFramebufferObject.java From GPUVideo-android with MIT License | 4 votes |
public void setup(final int width, final int height) { final int[] args = new int[1]; GLES20.glGetIntegerv(GL_MAX_TEXTURE_SIZE, args, 0); if (width > args[0] || height > args[0]) { throw new IllegalArgumentException("GL_MAX_TEXTURE_SIZE " + args[0]); } GLES20.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, args, 0); if (width > args[0] || height > args[0]) { throw new IllegalArgumentException("GL_MAX_RENDERBUFFER_SIZE " + args[0]); } GLES20.glGetIntegerv(GL_FRAMEBUFFER_BINDING, args, 0); final int saveFramebuffer = args[0]; GLES20.glGetIntegerv(GL_RENDERBUFFER_BINDING, args, 0); final int saveRenderbuffer = args[0]; GLES20.glGetIntegerv(GL_TEXTURE_BINDING_2D, args, 0); final int saveTexName = args[0]; release(); try { this.width = width; this.height = height; GLES20.glGenFramebuffers(args.length, args, 0); framebufferName = args[0]; GLES20.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName); GLES20.glGenRenderbuffers(args.length, args, 0); renderBufferName = args[0]; GLES20.glBindRenderbuffer(GL_RENDERBUFFER, renderBufferName); GLES20.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height); GLES20.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderBufferName); GLES20.glGenTextures(args.length, args, 0); texName = args[0]; GLES20.glBindTexture(GL_TEXTURE_2D, texName); EglUtil.setupSampler(GL_TEXTURE_2D, GL_LINEAR, GL_NEAREST); GLES20.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, null); GLES20.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texName, 0); final int status = GLES20.glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException("Failed to initialize framebuffer object " + status); } } catch (final RuntimeException e) { release(); throw e; } GLES20.glBindFramebuffer(GL_FRAMEBUFFER, saveFramebuffer); GLES20.glBindRenderbuffer(GL_RENDERBUFFER, saveRenderbuffer); GLES20.glBindTexture(GL_TEXTURE_2D, saveTexName); }
Example 19
Source File: DistortionRenderer.java From Cardboard with Apache License 2.0 | 4 votes |
private int setupRenderTextureAndRenderbuffer(int width, int height) { if (this.mTextureId != -1) { GLES20.glDeleteTextures(1, new int[] { this.mTextureId }, 0); } if (this.mRenderbufferId != -1) { GLES20.glDeleteRenderbuffers(1, new int[] { this.mRenderbufferId }, 0); } if (this.mFramebufferId != -1) { GLES20.glDeleteFramebuffers(1, new int[] { this.mFramebufferId }, 0); } this.mTextureId = createTexture(width, height); checkGlError("setupRenderTextureAndRenderbuffer: create texture"); int[] renderbufferIds = new int[1]; GLES20.glGenRenderbuffers(1, renderbufferIds, 0); GLES20.glBindRenderbuffer(36161, renderbufferIds[0]); GLES20.glRenderbufferStorage(36161, 33189, width, height); this.mRenderbufferId = renderbufferIds[0]; checkGlError("setupRenderTextureAndRenderbuffer: create renderbuffer"); int[] framebufferIds = new int[1]; GLES20.glGenFramebuffers(1, framebufferIds, 0); GLES20.glBindFramebuffer(36160, framebufferIds[0]); this.mFramebufferId = framebufferIds[0]; GLES20.glFramebufferTexture2D(36160, 36064, 3553, this.mTextureId, 0); GLES20.glFramebufferRenderbuffer(36160, 36096, 36161, renderbufferIds[0]); int status = GLES20.glCheckFramebufferStatus(36160); if (status != 36053) { throw new RuntimeException("Framebuffer is not complete: " + Integer.toHexString(status)); } GLES20.glBindFramebuffer(36160, 0); return framebufferIds[0]; }
Example 20
Source File: BitmapOutput.java From UltimateAndroid with Apache License 2.0 | votes |
private void initFBO() { if(frameBuffer != null) { GLES20.glDeleteFramebuffers(1, frameBuffer, 0); frameBuffer = null; } if(texture_out != null) { GLES20.glDeleteTextures(1, texture_out, 0); texture_out = null; } if(depthRenderBuffer != null) { GLES20.glDeleteRenderbuffers(1, depthRenderBuffer, 0); depthRenderBuffer = null; } frameBuffer = new int[1]; texture_out = new int[1]; depthRenderBuffer = new int[1]; GLES20.glGenFramebuffers(1, frameBuffer, 0); GLES20.glGenRenderbuffers(1, depthRenderBuffer, 0); GLES20.glGenTextures(1, texture_out, 0); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffer[0]); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture_out[0]); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, getWidth(), getHeight(), 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); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texture_out[0], 0); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, depthRenderBuffer[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16, getWidth(), getHeight()); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, depthRenderBuffer[0]); int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException(this+": Failed to set up render buffer with status "+status+" and error "+GLES20.glGetError()); } }