javax.microedition.khronos.opengles.GL11ExtensionPack Java Examples
The following examples show how to use
javax.microedition.khronos.opengles.GL11ExtensionPack.
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: FrameBufferObjectActivity.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public void onDrawFrame(GL10 gl) { checkGLError(gl); if (mContextSupportsFrameBufferObject) { GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; if (DEBUG_RENDER_OFFSCREEN_ONSCREEN) { drawOffscreenImage(gl, mSurfaceWidth, mSurfaceHeight); } else { gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFramebuffer); drawOffscreenImage(gl, mFramebufferWidth, mFramebufferHeight); gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0); drawOnscreen(gl, mSurfaceWidth, mSurfaceHeight); } } else { // Current context doesn't support frame buffer objects. // Indicate this by drawing a red background. gl.glClearColor(1,0,0,0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); } }
Example #2
Source File: GLWrapper.java From panoramagl with Apache License 2.0 | 6 votes |
/** * init methods */ public GLWrapper(GL gl, GLSurfaceView glSurfaceView) { mGL = (GL10) gl; if (gl instanceof GL10Ext) { mGL10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mGL11 = (GL11) gl; } if (gl instanceof GL11Ext) { mGL11Ext = (GL11Ext) gl; } if (gl instanceof GL11ExtensionPack) { mGL11ExtPack = (GL11ExtensionPack) gl; } mGLSurfaceView = glSurfaceView; }
Example #3
Source File: PLRenderer.java From PanoramaGL with Apache License 2.0 | 6 votes |
/**buffer methods*/ protected void createFrameBuffer(GL11ExtensionPack gl11ep) { if(mContextSupportsFrameBufferObject) { gl11ep.glGenFramebuffersOES(1, mDefaultFramebuffer, 0); if(mDefaultFramebuffer[0] <= 0) PLLog.error("PLRenderer::createFrameBuffer", "Invalid framebuffer id returned!"); gl11ep.glGenRenderbuffersOES(1, mColorRenderbuffer, 0); if(mColorRenderbuffer[0] <= 0) PLLog.error("PLRenderer::createFrameBuffer", "Invalid renderbuffer id returned!"); gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mDefaultFramebuffer[0]); gl11ep.glBindRenderbufferOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, mColorRenderbuffer[0]); } }
Example #4
Source File: PLRenderer.java From PanoramaGL with Apache License 2.0 | 6 votes |
protected void destroyFramebuffer(GL11ExtensionPack gl11ep) { if(mContextSupportsFrameBufferObject) { if(mDefaultFramebuffer[0] != 0) { gl11ep.glDeleteFramebuffersOES(1, mDefaultFramebuffer, 0); mDefaultFramebuffer[0] = 0; } if(mColorRenderbuffer[0] != 0) { gl11ep.glDeleteRenderbuffersOES(1, mColorRenderbuffer, 0); mColorRenderbuffer[0] = 0; } } }
Example #5
Source File: PLRenderer.java From panoramagl with Apache License 2.0 | 6 votes |
/** * dealloc methods */ @Override protected void finalize() throws Throwable { try { this.stop(); if (mContextSupportsFrameBufferObject) this.destroyFramebuffer((GL11ExtensionPack) mGLWrapper); } catch (Throwable e) { } mBackingWidth = mBackingHeight = null; mDefaultFramebuffer = mColorRenderbuffer = null; mView = null; mScene = null; mViewport = mTempViewport = null; mSize = mTempSize = null; mListener = null; mGLWrapper = null; super.finalize(); }
Example #6
Source File: PLRenderer.java From PanoramaGL with Apache License 2.0 | 6 votes |
/**dealloc methods*/ @Override protected void finalize() throws Throwable { try { this.stop(); if(mContextSupportsFrameBufferObject) this.destroyFramebuffer((GL11ExtensionPack)mGLWrapper); } catch(Throwable e) { } mBackingWidth = mBackingHeight = null; mDefaultFramebuffer = mColorRenderbuffer = null; mView = null; mScene = null; mViewport = mTempViewport = null; mSize = mTempSize = null; mListener = null; mGLWrapper = null; super.finalize(); }
Example #7
Source File: GLWrapper.java From PanoramaGL with Apache License 2.0 | 6 votes |
/**init methods*/ public GLWrapper(GL gl, GLSurfaceView glSurfaceView) { mGL = (GL10)gl; if(gl instanceof GL10Ext) { mGL10Ext = (GL10Ext)gl; } if(gl instanceof GL11) { mGL11 = (GL11)gl; } if(gl instanceof GL11Ext) { mGL11Ext = (GL11Ext)gl; } if(gl instanceof GL11ExtensionPack) { mGL11ExtPack = (GL11ExtensionPack)gl; } mGLSurfaceView = glSurfaceView; }
Example #8
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 5 votes |
private void setRenderTarget(RawTexture texture) { GL11ExtensionPack gl11ep = (GL11ExtensionPack) mGL; if (mTargetTexture == null && texture != null) { mGLId.glGenBuffers(1, mFrameBuffer, 0); gl11ep.glBindFramebufferOES( GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFrameBuffer[0]); } if (mTargetTexture != null && texture == null) { gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0); gl11ep.glDeleteFramebuffersOES(1, mFrameBuffer, 0); } mTargetTexture = texture; if (texture == null) { setSize(mScreenWidth, mScreenHeight); } else { setSize(texture.getWidth(), texture.getHeight()); if (!texture.isLoaded()) { texture.prepare(this); } gl11ep.glFramebufferTexture2DOES( GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL11.GL_TEXTURE_2D, texture.getId(), 0); checkFramebufferStatus(gl11ep); } }
Example #9
Source File: FrameBufferObjectActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
private int createFrameBuffer(GL10 gl, int width, int height, int targetTextureId) { GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; int framebuffer; int[] framebuffers = new int[1]; gl11ep.glGenFramebuffersOES(1, framebuffers, 0); framebuffer = framebuffers[0]; gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, framebuffer); int depthbuffer; int[] renderbuffers = new int[1]; gl11ep.glGenRenderbuffersOES(1, renderbuffers, 0); depthbuffer = renderbuffers[0]; gl11ep.glBindRenderbufferOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, depthbuffer); gl11ep.glRenderbufferStorageOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_DEPTH_COMPONENT16, width, height); gl11ep.glFramebufferRenderbufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_DEPTH_ATTACHMENT_OES, GL11ExtensionPack.GL_RENDERBUFFER_OES, depthbuffer); gl11ep.glFramebufferTexture2DOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL10.GL_TEXTURE_2D, targetTextureId, 0); int status = gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES); if (status != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { throw new RuntimeException("Framebuffer is not complete: " + Integer.toHexString(status)); } gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0); return framebuffer; }
Example #10
Source File: CubeMapActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
private int generateCubeMap(GL10 gl, int[] resourceIds) { checkGLError(gl); int[] ids = new int[1]; gl.glGenTextures(1, ids, 0); int cubeMapTextureId = ids[0]; gl.glBindTexture(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, cubeMapTextureId); gl.glTexParameterf(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); gl.glTexParameterf(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); for (int face = 0; face < 6; face++) { InputStream is = getResources().openRawResource(resourceIds[face]); Bitmap bitmap; try { bitmap = BitmapFactory.decodeStream(is); } finally { try { is.close(); } catch(IOException e) { Log.e("CubeMap", "Could not decode texture for face " + Integer.toString(face)); } } GLUtils.texImage2D(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, bitmap, 0); bitmap.recycle(); } checkGLError(gl); return cubeMapTextureId; }
Example #11
Source File: PLRenderer.java From panoramagl with Apache License 2.0 | 5 votes |
@Override public void onSurfaceChanged(GL10 gl, int width, int height) { mSize.setValues(width, height); this.resizeFromLayer(mContextSupportsFrameBufferObject ? (GL11ExtensionPack) mGLWrapper : null); if (!mIsGLContextCreated) { if (mListener != null) mListener.rendererFirstChanged(mGLWrapper, this, width, height); mIsGLContextCreated = true; } if (mListener != null) mListener.rendererChanged(this, width, height); }
Example #12
Source File: PLRenderer.java From panoramagl with Apache License 2.0 | 5 votes |
protected void destroyFramebuffer(GL11ExtensionPack gl11ep) { if (mContextSupportsFrameBufferObject) { if (mDefaultFramebuffer[0] != 0) { gl11ep.glDeleteFramebuffersOES(1, mDefaultFramebuffer, 0); mDefaultFramebuffer[0] = 0; } if (mColorRenderbuffer[0] != 0) { gl11ep.glDeleteRenderbuffersOES(1, mColorRenderbuffer, 0); mColorRenderbuffer[0] = 0; } } }
Example #13
Source File: PLRenderer.java From panoramagl with Apache License 2.0 | 5 votes |
/** * buffer methods */ protected void createFrameBuffer(GL11ExtensionPack gl11ep) { if (mContextSupportsFrameBufferObject) { gl11ep.glGenFramebuffersOES(1, mDefaultFramebuffer, 0); if (mDefaultFramebuffer[0] <= 0) PLLog.error("PLRenderer::createFrameBuffer", "Invalid framebuffer id returned!"); gl11ep.glGenRenderbuffersOES(1, mColorRenderbuffer, 0); if (mColorRenderbuffer[0] <= 0) PLLog.error("PLRenderer::createFrameBuffer", "Invalid renderbuffer id returned!"); gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mDefaultFramebuffer[0]); gl11ep.glBindRenderbufferOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, mColorRenderbuffer[0]); } }
Example #14
Source File: PLRenderer.java From PanoramaGL with Apache License 2.0 | 5 votes |
@Override public void onSurfaceChanged(GL10 gl, int width, int height) { mSize.setValues(width, height); this.resizeFromLayer(mContextSupportsFrameBufferObject ? (GL11ExtensionPack)mGLWrapper : null); if(!mIsGLContextCreated) { if(mListener != null) mListener.rendererFirstChanged(mGLWrapper, this, width, height); mIsGLContextCreated = true; } if(mListener != null) mListener.rendererChanged(this, width, height); }
Example #15
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 5 votes |
private static void checkFramebufferStatus(GL11ExtensionPack gl11ep) { int status = gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES); if (status != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { String msg = ""; switch (status) { case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES: msg = "FRAMEBUFFER_FORMATS"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES: msg = "FRAMEBUFFER_ATTACHMENT"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES: msg = "FRAMEBUFFER_MISSING_ATTACHMENT"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES: msg = "FRAMEBUFFER_DRAW_BUFFER"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES: msg = "FRAMEBUFFER_READ_BUFFER"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_UNSUPPORTED_OES: msg = "FRAMEBUFFER_UNSUPPORTED"; break; case GL11ExtensionPack.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES: msg = "FRAMEBUFFER_INCOMPLETE_DIMENSIONS"; break; } throw new RuntimeException(msg + ":" + Integer.toHexString(status)); } }
Example #16
Source File: GLES20IdImpl.java From Trebuchet with GNU General Public License v3.0 | 4 votes |
@Override public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset) { GLES20.glDeleteFramebuffers(n, buffers, offset); GLES20Canvas.checkError(); }
Example #17
Source File: GLES20IdImpl.java From TurboLauncher with Apache License 2.0 | 4 votes |
@Override public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset) { GLES20.glDeleteFramebuffers(n, buffers, offset); GLES20Canvas.checkError(); }
Example #18
Source File: PLRenderer.java From panoramagl with Apache License 2.0 | 4 votes |
@Override public boolean resizeFromLayer(GL11ExtensionPack gl11ep) { if (mContextSupportsFrameBufferObject && gl11ep != null) { synchronized (this) { if (mBackingWidth[0] != mSize.width || mBackingHeight[0] != mSize.height) { boolean isRunning = mIsRunning; if (isRunning) mIsRunning = false; this.destroyFramebuffer(gl11ep); this.createFrameBuffer(gl11ep); gl11ep.glRenderbufferStorageOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RGBA8, mSize.width, mSize.height); gl11ep.glFramebufferRenderbufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL11ExtensionPack.GL_RENDERBUFFER_OES, mColorRenderbuffer[0]); gl11ep.glGetRenderbufferParameterivOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RENDERBUFFER_WIDTH_OES, mBackingWidth, 0); gl11ep.glGetRenderbufferParameterivOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RENDERBUFFER_HEIGHT_OES, mBackingHeight, 0); mViewport.x = -(mViewport.width / 2 - mSize.width / 2); mViewport.y = -(mViewport.height / 2 - mSize.height / 2); if (gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES) != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { PLLog.error("PLRenderer::resizeFromLayer", "Failed to make complete framebuffer object %x", gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES)); return false; } if (isRunning) mIsRunning = true; return true; } } } else { synchronized (this) { mViewport.x = -(mViewport.width / 2 - mSize.width / 2); mViewport.y = -(mViewport.height / 2 - mSize.height / 2); } } return false; }
Example #19
Source File: PLRenderer.java From PanoramaGL with Apache License 2.0 | 4 votes |
@Override public boolean resizeFromLayer(GL11ExtensionPack gl11ep) { if(mContextSupportsFrameBufferObject && gl11ep != null) { synchronized(this) { if(mBackingWidth[0] != mSize.width || mBackingHeight[0] != mSize.height) { boolean isRunning = mIsRunning; if(isRunning) mIsRunning = false; this.destroyFramebuffer(gl11ep); this.createFrameBuffer(gl11ep); gl11ep.glRenderbufferStorageOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RGBA8, mSize.width, mSize.height); gl11ep.glFramebufferRenderbufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL11ExtensionPack.GL_RENDERBUFFER_OES, mColorRenderbuffer[0]); gl11ep.glGetRenderbufferParameterivOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RENDERBUFFER_WIDTH_OES, mBackingWidth, 0); gl11ep.glGetRenderbufferParameterivOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, GL11ExtensionPack.GL_RENDERBUFFER_HEIGHT_OES, mBackingHeight, 0); mViewport.x = -(mViewport.width / 2 - mSize.width / 2); mViewport.y = -(mViewport.height / 2 - mSize.height / 2); if(gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES) != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) { PLLog.error("PLRenderer::resizeFromLayer", "Failed to make complete framebuffer object %x", gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES)); return false; } if(isRunning) mIsRunning = true; return true; } } } else { synchronized(this) { mViewport.x = -(mViewport.width / 2 - mSize.width / 2); mViewport.y = -(mViewport.height / 2 - mSize.height / 2); } } return false; }
Example #20
Source File: GLES20IdImpl.java From PhotoMovie with Apache License 2.0 | 4 votes |
@Override public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset) { GLES20.glDeleteFramebuffers(n, buffers, offset); GLES20Canvas.checkError(); }
Example #21
Source File: GLES20IdImpl.java From LB-Launcher with Apache License 2.0 | 4 votes |
@Override public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset) { GLES20.glDeleteFramebuffers(n, buffers, offset); GLES20Canvas.checkError(); }
Example #22
Source File: CubeMapActivity.java From codeexamples-android with Eclipse Public License 1.0 | 4 votes |
public void onDrawFrame(GL10 gl) { checkGLError(gl); if (mContextSupportsCubeMap) { gl.glClearColor(0,0,1,0); } else { // Current context doesn't support cube maps. // Indicate this by drawing a red background. gl.glClearColor(1,0,0,0); } gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); gl.glRotatef(mAngle, 0, 1, 0); gl.glRotatef(mAngle*0.25f, 1, 0, 0); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); checkGLError(gl); if (mContextSupportsCubeMap) { gl.glActiveTexture(GL10.GL_TEXTURE0); checkGLError(gl); gl.glEnable(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP); checkGLError(gl); gl.glBindTexture(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, mCubeMapTextureID); checkGLError(gl); GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; gl11ep.glTexGeni(GL11ExtensionPack.GL_TEXTURE_GEN_STR, GL11ExtensionPack.GL_TEXTURE_GEN_MODE, GL11ExtensionPack.GL_REFLECTION_MAP); checkGLError(gl); gl.glEnable(GL11ExtensionPack.GL_TEXTURE_GEN_STR); checkGLError(gl); gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_DECAL); } checkGLError(gl); mGrid.draw(gl); if (mContextSupportsCubeMap) { gl.glDisable(GL11ExtensionPack.GL_TEXTURE_GEN_STR); } checkGLError(gl); mAngle += 1.2f; }
Example #23
Source File: GLES11IdImpl.java From PhotoMovie with Apache License 2.0 | 4 votes |
@Override public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset) { synchronized (sLock) { gl11ep.glDeleteFramebuffersOES(n, buffers, offset); } }
Example #24
Source File: GLId.java From TurboLauncher with Apache License 2.0 | votes |
public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset);
Example #25
Source File: PLIRenderer.java From panoramagl with Apache License 2.0 | votes |
boolean resizeFromLayer(GL11ExtensionPack gl11ep);
Example #26
Source File: GLId.java From Trebuchet with GNU General Public License v3.0 | votes |
public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset);
Example #27
Source File: PLIRenderer.java From PanoramaGL with Apache License 2.0 | votes |
boolean resizeFromLayer(GL11ExtensionPack gl11ep);
Example #28
Source File: GLId.java From LB-Launcher with Apache License 2.0 | votes |
public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset);
Example #29
Source File: GLId.java From PhotoMovie with Apache License 2.0 | votes |
public void glDeleteFramebuffers(GL11ExtensionPack gl11ep, int n, int[] buffers, int offset);