javax.microedition.khronos.opengles.GL Java Examples
The following examples show how to use
javax.microedition.khronos.opengles.GL.
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: GLTextureView.java From PhotoMovie with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLSurfaceViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #2
Source File: CubeMapActivity.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public void createBufferObjects(GL gl) { checkGLError(gl); // Generate a the vertex and element buffer IDs int[] vboIds = new int[2]; GL11 gl11 = (GL11) gl; gl11.glGenBuffers(2, vboIds, 0); mVertexBufferObjectId = vboIds[0]; mElementBufferObjectId = vboIds[1]; // Upload the vertex data gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId); mVertexByteBuffer.position(0); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, mVertexByteBuffer.capacity(), mVertexByteBuffer, GL11.GL_STATIC_DRAW); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId); mIndexBuffer.position(0); gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer.capacity() * CHAR_SIZE, mIndexBuffer, GL11.GL_STATIC_DRAW); // We don't need the in-memory data any more mVertexBuffer = null; mVertexByteBuffer = null; mIndexBuffer = null; checkGLError(gl); }
Example #3
Source File: MatrixPaletteRenderer.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
private Grid generateWeightedGrid(GL gl) { final int uSteps = 20; final int vSteps = 20; float radius = 0.25f; float height = 2.0f; Grid grid = new Grid(uSteps + 1, vSteps + 1); for (int j = 0; j <= vSteps; j++) { for (int i = 0; i <= uSteps; i++) { double angle = Math.PI * 2 * i / uSteps; float x = radius * (float) Math.cos(angle); float y = height * ((float) j / vSteps - 0.5f); float z = radius * (float) Math.sin(angle); float u = -4.0f * (float) i / uSteps; float v = -4.0f * (float) j / vSteps; float w0 = (float) j / vSteps; float w1 = 1.0f - w0; grid.set(i, j, x, y, z, u, v, w0, w1, 0, 1); } } grid.createBufferObjects(gl); return grid; }
Example #4
Source File: MatrixPaletteRenderer.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public void createBufferObjects(GL gl) { // Generate a the vertex and element buffer IDs int[] vboIds = new int[2]; GL11 gl11 = (GL11) gl; gl11.glGenBuffers(2, vboIds, 0); mVertexBufferObjectId = vboIds[0]; mElementBufferObjectId = vboIds[1]; // Upload the vertex data gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId); mVertexByteBuffer.position(0); gl11.glBufferData(GL11.GL_ARRAY_BUFFER, mVertexByteBuffer.capacity(), mVertexByteBuffer, GL11.GL_STATIC_DRAW); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId); mIndexBuffer.position(0); gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer.capacity() * CHAR_SIZE, mIndexBuffer, GL11.GL_STATIC_DRAW); // We don't need the in-memory data any more mVertexBuffer = null; mVertexByteBuffer = null; mIndexBuffer = null; }
Example #5
Source File: MatrixTrackingGL.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public MatrixTrackingGL(GL gl) { mgl = (GL10) gl; if (gl instanceof GL10Ext) { mgl10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mgl11 = (GL11) gl; } if (gl instanceof GL11Ext) { mgl11Ext = (GL11Ext) gl; } mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #6
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 #7
Source File: MatrixTrackingGL.java From panoramagl with Apache License 2.0 | 6 votes |
public MatrixTrackingGL(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; } mGLSurfaceView = glSurfaceView; mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #8
Source File: GLTextureView.java From ZGDanmaku with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #9
Source File: GLTextureView.java From MD360Player4Android with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #10
Source File: GlTextureView.java From ParticleView with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GlTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #11
Source File: GLSurfaceView.java From unity-ads-android with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLSurfaceView view = mGLSurfaceViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #12
Source File: GLTextureView.java From android-RoundedTextureView with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. */ GL createGL() { GL gl = eglContext.getGL(); GLTextureView view = glTextureViewWeakRef.get(); if (view != null) { if (view.glWrapper != null) { gl = view.glWrapper.wrap(gl); } if ((view.debugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.debugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.debugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #13
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 #14
Source File: MatrixTrackingGL.java From PanoramaGL with Apache License 2.0 | 6 votes |
public MatrixTrackingGL(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; } mGLSurfaceView = glSurfaceView; mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #15
Source File: GLTextureView.java From VideoRecorder with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #16
Source File: GLTextureView.java From MusicPlayer with GNU General Public License v3.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLSurfaceViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #17
Source File: GLTextureView.java From alpha-movie with Apache License 2.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLSurfaceViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #18
Source File: GLSurfaceView.java From EZFilter with MIT License | 6 votes |
/** * Create a GL object for the current EGL context. * * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLSurfaceView view = mGLSurfaceViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #19
Source File: GLTextureView.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 6 votes |
/** * Create a GL object for the current EGL context. * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #20
Source File: GLTextureView.java From EZFilter with MIT License | 6 votes |
/** * Create a GL object for the current EGL context. * * @return */ GL createGL() { GL gl = mEglContext.getGL(); GLTextureView view = mGLTextureViewWeakRef.get(); if (view != null) { if (view.mGLWrapper != null) { gl = view.mGLWrapper.wrap(gl); } if ((view.mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS)) != 0) { int configFlags = 0; Writer log = null; if ((view.mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((view.mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, configFlags, log); } } return gl; }
Example #21
Source File: CubeMapActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
private Grid generateTorusGrid(GL gl, int uSteps, int vSteps, float majorRadius, float minorRadius) { Grid grid = new Grid(uSteps + 1, vSteps + 1); for (int j = 0; j <= vSteps; j++) { double angleV = Math.PI * 2 * j / vSteps; float cosV = (float) Math.cos(angleV); float sinV = (float) Math.sin(angleV); for (int i = 0; i <= uSteps; i++) { double angleU = Math.PI * 2 * i / uSteps; float cosU = (float) Math.cos(angleU); float sinU = (float) Math.sin(angleU); float d = majorRadius+minorRadius*cosU; float x = d*cosV; float y = d*(-sinV); float z = minorRadius * sinU; float nx = cosV * cosU; float ny = -sinV * cosU; float nz = sinU; float length = (float) Math.sqrt(nx*nx + ny*ny + nz*nz); nx /= length; ny /= length; nz /= length; grid.set(i, j, x, y, z, nx, ny, nz); } } grid.createBufferObjects(gl); return grid; }
Example #22
Source File: SpriteTextActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGLSurfaceView = new GLSurfaceView(this); mGLSurfaceView.setGLWrapper(new GLSurfaceView.GLWrapper() { public GL wrap(GL gl) { return new MatrixTrackingGL(gl); }}); mGLSurfaceView.setRenderer(new SpriteTextRenderer(this)); setContentView(mGLSurfaceView); }
Example #23
Source File: EGL.java From BambooPlayer with Apache License 2.0 | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #24
Source File: EGL.java From MyHearts with Apache License 2.0 | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #25
Source File: EGL.java From HPlayer with Apache License 2.0 | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #26
Source File: EGL.java From video-player with MIT License | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #27
Source File: EGL.java From Vitamio with Apache License 2.0 | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #28
Source File: EGL.java From react-native-android-vitamio with MIT License | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #29
Source File: EGL.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
public GL createSurface(Surface surface) { if (mEgl == null) throw new RuntimeException("egl not initialized"); if (mEglDisplay == null) throw new RuntimeException("eglDisplay not initialized"); if (mEglConfig == null) throw new RuntimeException("mEglConfig not initialized"); if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } throwEglException("createWindowSurface", error); } if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throwEglException("eglMakeCurrent"); } GL gl = mEglContext.getGL(); return gl; }
Example #30
Source File: FrameBufferObjectActivity.java From codeexamples-android with Eclipse Public License 1.0 | 4 votes |
static void checkGLError(GL gl) { int error = ((GL10) gl).glGetError(); if (error != GL10.GL_NO_ERROR) { throw new RuntimeException("GLError 0x" + Integer.toHexString(error)); } }