當前位置: 首頁>>代碼示例>>Java>>正文


Java EGL10.EGL_BAD_NATIVE_WINDOW屬性代碼示例

本文整理匯總了Java中javax.microedition.khronos.egl.EGL10.EGL_BAD_NATIVE_WINDOW屬性的典型用法代碼示例。如果您正苦於以下問題:Java EGL10.EGL_BAD_NATIVE_WINDOW屬性的具體用法?Java EGL10.EGL_BAD_NATIVE_WINDOW怎麽用?Java EGL10.EGL_BAD_NATIVE_WINDOW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.microedition.khronos.egl.EGL10的用法示例。


在下文中一共展示了EGL10.EGL_BAD_NATIVE_WINDOW屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: swap

public boolean swap() {
  if (!mEgl.eglSwapBuffers(mEglDisplay, mEglSurface)) {
    int error = mEgl.eglGetError();
    switch (error) {
      case EGL11.EGL_CONTEXT_LOST:
        return false;
      case EGL10.EGL_BAD_NATIVE_WINDOW:
        Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_NATIVE_WINDOW. tid=" + Thread.currentThread().getId());
        break;
      case EGL10.EGL_BAD_SURFACE:
        Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_SURFACE. tid=" + Thread.currentThread().getId());
        return false;
      default:
        throwEglException("eglSwapBuffers", error);
    }
  }
  return true;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:18,代碼來源:EGL.java

示例2: getErrorString

public static String getErrorString(int error)
{
    switch (error) {
        case EGL10.EGL_SUCCESS:
            return "EGL_SUCCESS";
        case EGL10.EGL_NOT_INITIALIZED:
            return "EGL_NOT_INITIALIZED";
        case EGL10.EGL_BAD_ACCESS:
            return "EGL_BAD_ACCESS";
        case EGL10.EGL_BAD_ALLOC:
            return "EGL_BAD_ALLOC";
        case EGL10.EGL_BAD_ATTRIBUTE:
            return "EGL_BAD_ATTRIBUTE";
        case EGL10.EGL_BAD_CONFIG:
            return "EGL_BAD_CONFIG";
        case EGL10.EGL_BAD_CONTEXT:
            return "EGL_BAD_CONTEXT";
        case EGL10.EGL_BAD_CURRENT_SURFACE:
            return "EGL_BAD_CURRENT_SURFACE";
        case EGL10.EGL_BAD_DISPLAY:
            return "EGL_BAD_DISPLAY";
        case EGL10.EGL_BAD_MATCH:
            return "EGL_BAD_MATCH";
        case EGL10.EGL_BAD_NATIVE_PIXMAP:
            return "EGL_BAD_NATIVE_PIXMAP";
        case EGL10.EGL_BAD_NATIVE_WINDOW:
            return "EGL_BAD_NATIVE_WINDOW";
        case EGL10.EGL_BAD_PARAMETER:
            return "EGL_BAD_PARAMETER";
        case EGL10.EGL_BAD_SURFACE:
            return "EGL_BAD_SURFACE";
        case EGL11.EGL_CONTEXT_LOST:
            return "EGL_CONTEXT_LOST";
        default:
            return getHex(error);
    }
}
 
開發者ID:nextgis,項目名稱:android_nextgis_mobile,代碼行數:37,代碼來源:MapGlView.java

示例3: createSurface

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;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:32,代碼來源:EGL.java

示例4: createSurface

/**
 * Create an egl surface for the current SurfaceHolder surface. If a surface
 * already exists, destroy it before creating the new surface.
 *
 * @return true if the surface was created successfully.
 */
public boolean createSurface() {
    if (LOG_EGL) {
        Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
    }
    /*
     * Check preconditions.
     */
    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");
    }

    /*
     *  The window size has changed, so we need to create a new
     *  surface.
     */
    destroySurfaceImp();

    /*
     * Create an EGL surface we can render into.
     */
    GLTextureView view = mGLSurfaceViewWeakRef.get();
    if (view != null) {
        mEglSurface = view.mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
                mEglDisplay, mEglConfig, view.getSurfaceTexture());
    } else {
        mEglSurface = null;
    }

    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 false;
    }

    /*
     * Before we can issue GL commands, we need to make sure
     * the context is current and bound to a surface.
     */
    if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
        /*
         * Could not make the context current, probably because the underlying
         * SurfaceView surface has been destroyed.
         */
        logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError());
        return false;
    }

    return true;
}
 
開發者ID:pavelsemak,項目名稱:alpha-movie,代碼行數:63,代碼來源:GLTextureView.java

示例5: createSurface

/**
 * Create an egl surface for the current SurfaceHolder surface. If a surface
 * already exists, destroy it before creating the new surface.
 *
 * @return true if the surface was created successfully.
 */
public boolean createSurface() {
    if (LOG_EGL) {
        Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
    }
    /*
     * Check preconditions.
     */
    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");
    }

    /*
     *  The window size has changed, so we need to create a new
     *  surface.
     */
    destroySurfaceImp();

    /*
     * Create an EGL surface we can render into.
     */
    GLSurfaceView view = mGLSurfaceViewWeakRef.get();
    if (view != null) {
        mEglSurface = view.mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
                mEglDisplay, mEglConfig, view.getHolder());
    } else {
        mEglSurface = null;
    }

    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 false;
    }

    /*
     * Before we can issue GL commands, we need to make sure
     * the context is current and bound to a surface.
     */
    if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
        /*
         * Could not make the context current, probably because the underlying
         * SurfaceView surface has been destroyed.
         */
        logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError());
        return false;
    }

    return true;
}
 
開發者ID:uestccokey,項目名稱:EZFilter,代碼行數:63,代碼來源:GLSurfaceView.java

示例6: createSurface

/**
 * Create an egl surface for the current SurfaceHolder surface. If a surface
 * already exists, destroy it before creating the new surface.
 *
 * @return true if the surface was created successfully.
 */
public boolean createSurface() {
    if (LOG_EGL) {
        Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
    }
    /*
     * Check preconditions.
     */
    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");
    }

    /*
     *  The window size has changed, so we need to create a new
     *  surface.
     */
    destroySurfaceImp();

    /*
     * Create an EGL surface we can render into.
     */
    GLTextureView view = mGLTextureViewWeakRef.get();
    if (view != null) {
        mEglSurface = view.mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
                mEglDisplay, mEglConfig, view.getSurfaceTexture());
    } else {
        mEglSurface = null;
    }

    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 false;
    }

    /*
     * Before we can issue GL commands, we need to make sure
     * the context is current and bound to a surface.
     */
    if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
        /*
         * Could not make the context current, probably because the underlying
         * TextureView surface has been destroyed.
         */
        logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError());
        return false;
    }

    return true;
}
 
開發者ID:uestccokey,項目名稱:EZFilter,代碼行數:63,代碼來源:GLTextureView.java

示例7: initGL

private void initGL(SurfaceTexture texture) {
    egl10 = (EGL10) EGLContext.getEGL();

    eglDisplay = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
        throw new RuntimeException("eglGetDisplay failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }

    int[] version = new int[2];
    if (!egl10.eglInitialize(eglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }

    int[] configsCount = new int[1];
    EGLConfig[] configs = new EGLConfig[1];
    int[] configSpec = {
            EGL10.EGL_RENDERABLE_TYPE,
            EGL_OPENGL_ES2_BIT,
            EGL10.EGL_RED_SIZE, 8,
            EGL10.EGL_GREEN_SIZE, 8,
            EGL10.EGL_BLUE_SIZE, 8,
            EGL10.EGL_ALPHA_SIZE, 8,
            EGL10.EGL_DEPTH_SIZE, 0,
            EGL10.EGL_STENCIL_SIZE, 0,
            EGL10.EGL_NONE
    };

    EGLConfig eglConfig = null;
    if (!egl10.eglChooseConfig(eglDisplay, configSpec, configs, 1, configsCount)) {
        throw new IllegalArgumentException("eglChooseConfig failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    } else if (configsCount[0] > 0) {
        eglConfig = configs[0];
    }
    if (eglConfig == null) {
        throw new RuntimeException("eglConfig not initialized");
    }

    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
    eglContext = egl10.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
    eglSurface = egl10.eglCreateWindowSurface(eglDisplay, eglConfig, texture, null);

    if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) {
        int error = egl10.eglGetError();
        if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
            Log.e(TAG, "eglCreateWindowSurface returned EGL10.EGL_BAD_NATIVE_WINDOW");
            return;
        }
        throw new RuntimeException("eglCreateWindowSurface failed " +
                android.opengl.GLUtils.getEGLErrorString(error));
    }

    if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
        throw new RuntimeException("eglMakeCurrent failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:59,代碼來源:MyCameraRenderer.java


注:本文中的javax.microedition.khronos.egl.EGL10.EGL_BAD_NATIVE_WINDOW屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。