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


Java EGLContext類代碼示例

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


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

示例1: createContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
@Override
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig){
    final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;

    int[] attrib_list = {
            EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL10.EGL_NONE
    };
    EGLContext mEGLContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT,
            attrib_list);
    //checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }
    return mEGLContext;
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:17,代碼來源:EGLUtil.java

示例2: createContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
    Log.d(LOG_TAG, "createContext " + egl + " " + display + " " + eglConfig);
    checkEglError("before createContext", egl);
    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};

    EGLContext ctx;

    if (mRenderer.mEGLCurrentContext == null) {
        mRenderer.mEGLCurrentContext = egl.eglCreateContext(display, eglConfig,
                EGL10.EGL_NO_CONTEXT, attrib_list);
        ctx = mRenderer.mEGLCurrentContext;
    } else {
        ctx = mRenderer.mEGLCurrentContext;
    }
    checkEglError("after createContext", egl);
    return ctx;
}
 
開發者ID:AgoraIO,項目名稱:Agora-Video-Source-Android,代碼行數:18,代碼來源:CustomizedCameraRenderer.java

示例3: initDrawContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public void initDrawContext(
            EGL10 egl,
            EGLDisplay eglDisplay,
            EGLSurface eglSurface,
            EGLContext eglContext)
    {
        mEgl = egl;
        mEglDisplay = eglDisplay;
        mEglSurface = eglSurface;
        mEglContext = eglContext;

        if (0 == mMapId) { return; }

//        makeCurrent();
        Api.ngsMapInit(mMapId);
    }
 
開發者ID:nextgis,項目名稱:android_nextgis_mobile,代碼行數:17,代碼來源:MapDrawing.java

示例4: createContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
@Override
public EGLContext createContext(
        EGL10 egl,
        EGLDisplay display,
        EGLConfig eglConfig)
{
    Log.w(ConstantsUI.TAG, "creating OpenGL ES 2.0 context");
    checkEglError(egl, "Before eglCreateContext");
    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
    mEglContext =
            egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
    if (EGL10.EGL_NO_CONTEXT == mEglContext) {
        throwEglException(egl, "eglCreateContext");
    }
    return mEglContext;
}
 
開發者ID:nextgis,項目名稱:android_nextgis_mobile,代碼行數:17,代碼來源:MapGlView.java

示例5: start

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
    throw new RuntimeException("eglGetDisplay failed");
  }

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:23,代碼來源:EGL.java

示例6: addExtensionsForConfig

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
private static void addExtensionsForConfig(EGL10 egl10, EGLDisplay egldisplay, EGLConfig eglconfig, int ai[], int ai1[], Set<String> set) {
    EGLContext eglContext = egl10.eglCreateContext(egldisplay, eglconfig, EGL10.EGL_NO_CONTEXT, ai1);
    if (eglContext == EGL10.EGL_NO_CONTEXT) {
        return;
    }
    javax.microedition.khronos.egl.EGLSurface eglSurface = egl10.eglCreatePbufferSurface(egldisplay, eglconfig, ai);
    if (eglSurface == EGL10.EGL_NO_SURFACE) {
        egl10.eglDestroyContext(egldisplay, eglContext);
    } else {
        egl10.eglMakeCurrent(egldisplay, eglSurface, eglSurface, eglContext);
        String s = GLES10.glGetString(7939);
        if (!TextUtils.isEmpty(s)) {
            String as[] = s.split(" ");
            int i = as.length;
            for (int j = 0; j < i; j++) {
                set.add(as[j]);
            }
        }
        egl10.eglMakeCurrent(egldisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
        egl10.eglDestroySurface(egldisplay, eglSurface);
        egl10.eglDestroyContext(egldisplay, eglContext);
    }
}
 
開發者ID:yeriomin,項目名稱:YalpStore,代碼行數:24,代碼來源:EglExtensionRetriever.java

示例7: getMaximumTextureSize

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public static int getMaximumTextureSize() {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    int[] version = new int[2];
    egl.eglInitialize(display, version);

    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    for (int i = 0; i < totalConfigurations[0]; i++) {
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);
        if (maximumTextureSize < textureSize[0]) {
            maximumTextureSize = textureSize[0];
        }
    }
    egl.eglTerminate(display);

    return maximumTextureSize;
}
 
開發者ID:LGDeveloper,項目名稱:FriendsCameraSDK-android,代碼行數:27,代碼來源:VrUtils.java

示例8: checkGL20

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
protected boolean checkGL20 () {
   EGL10 egl = (EGL10)EGLContext.getEGL();
   EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

   int[] version = new int[2];
   egl.eglInitialize(display, version);

   int EGL_OPENGL_ES2_BIT = 4;
   int[] configAttribs = {EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4, EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE,
      EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE};

   EGLConfig[] configs = new EGLConfig[10];
   int[] num_config = new int[1];
   egl.eglChooseConfig(display, configAttribs, configs, 10, num_config);
   egl.eglTerminate(display);
   return num_config[0] > 0;
}
 
開發者ID:raphaelbruno,項目名稱:ZombieInvadersVR,代碼行數:18,代碼來源:CardBoardGraphics.java

示例9: logConfig

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
private void logConfig (EGLConfig config) {
   EGL10 egl = (EGL10)EGLContext.getEGL();
   EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
   int r = getAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
   int g = getAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
   int b = getAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
   int a = getAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
   int d = getAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
   int s = getAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
   int samples = Math.max(getAttrib(egl, display, config, EGL10.EGL_SAMPLES, 0),
      getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0));
   boolean coverageSample = getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0) != 0;

   Gdx.app.log(LOG_TAG, "framebuffer: (" + r + ", " + g + ", " + b + ", " + a + ")");
   Gdx.app.log(LOG_TAG, "depthbuffer: (" + d + ")");
   Gdx.app.log(LOG_TAG, "stencilbuffer: (" + s + ")");
   Gdx.app.log(LOG_TAG, "samples: (" + samples + ")");
   Gdx.app.log(LOG_TAG, "coverage sampling: (" + coverageSample + ")");

   bufferFormat = new BufferFormat(r, g, b, a, d, s, samples, coverageSample);
}
 
開發者ID:raphaelbruno,項目名稱:ZombieInvadersVR,代碼行數:22,代碼來源:CardBoardGraphics.java

示例10: getMaxTextureSize

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public static int getMaxTextureSize() {
  final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int[] totalConfigurations = new int[1];
  egl.eglGetConfigs(display, null, 0, totalConfigurations);

  EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
  egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

  int[] textureSize = new int[1];
  int maximumTextureSize = 0;

  for (int i = 0; i < totalConfigurations[0]; i++) {
    egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

    if (maximumTextureSize < textureSize[0])
      maximumTextureSize = textureSize[0];
  }

  egl.eglTerminate(display);

  return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:30,代碼來源:BitmapUtil.java

示例11: eglSetup

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
private void eglSetup(int width, int height) {
    mEGL = (EGL10) EGLContext.getEGL();
    mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    if (mEGLDisplay == EGL10.EGL_NO_DISPLAY) {
        throw new RuntimeException("unable to get EGL10 display");
    }

    if (!mEGL.eglInitialize(mEGLDisplay, null)) {
        mEGLDisplay = null;
        throw new RuntimeException("unable to initialize EGL10");
    }

    int[] attribList = {
            EGL10.EGL_RED_SIZE, 8,
            EGL10.EGL_GREEN_SIZE, 8,
            EGL10.EGL_BLUE_SIZE, 8,
            EGL10.EGL_ALPHA_SIZE, 8,
            EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
            EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL10.EGL_NONE
    };
    EGLConfig[] configs = new EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!mEGL.eglChooseConfig(mEGLDisplay, attribList, configs, configs.length, numConfigs)) {
        throw new RuntimeException("unable to find RGB888+pbuffer EGL config");
    }
    int[] attrib_list = {
            EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL10.EGL_NONE
    };
    mEGLContext = mEGL.eglCreateContext(mEGLDisplay, configs[0], EGL10.EGL_NO_CONTEXT, attrib_list);
    checkEglError("eglCreateContext");
    if (mEGLContext == null) {
        throw new RuntimeException("null context");
    }
    int[] surfaceAttribs = {
            EGL10.EGL_WIDTH, width,
            EGL10.EGL_HEIGHT, height,
            EGL10.EGL_NONE
    };
    mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs);
    checkEglError("eglCreatePbufferSurface");
    if (mEGLSurface == null) {
        throw new RuntimeException("surface was null");
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:48,代碼來源:OutputSurface.java

示例12: createContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
    Log.w(TAG, "creating OpenGL ES 2.0 context");
    checkEglError("Before eglCreateContext", egl);
    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
    EGLContext context = egl.eglCreateContext(display, eglConfig,
            EGL10.EGL_NO_CONTEXT, attrib_list);
    checkEglError("After eglCreateContext", egl);
    return context;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:10,代碼來源:ViEAndroidGLES20.java

示例13: createContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig config) {
    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, mEGLContextClientVersion,
            EGL10.EGL_NONE };

    return egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT,
            mEGLContextClientVersion != 0 ? attrib_list : null);
}
 
開發者ID:pavelsemak,項目名稱:alpha-movie,代碼行數:8,代碼來源:GLTextureView.java

示例14: destroyContext

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public void destroyContext(EGL10 egl, EGLDisplay display,
                           EGLContext context) {
    if (!egl.eglDestroyContext(display, context)) {
        Log.e("DefaultContextFactory", "display:" + display + " context: " + context);
        if (LOG_THREADS) {
            Log.i("DefaultContextFactory", "tid=" + Thread.currentThread().getId());
        }
        EglHelper.throwEglException("eglDestroyContex", egl.eglGetError());
    }
}
 
開發者ID:pavelsemak,項目名稱:alpha-movie,代碼行數:11,代碼來源:GLTextureView.java

示例15: PixelBuffer

import javax.microedition.khronos.egl.EGLContext; //導入依賴的package包/類
public PixelBuffer(final int width, final int height) {
    mWidth = width;
    mHeight = height;

    int[] version = new int[2];
    int[] attribList = new int[] {
            EGL_WIDTH, mWidth,
            EGL_HEIGHT, mHeight,
            EGL_NONE
    };

    // No error checking performed, minimum required code to elucidate logic
    mEGL = (EGL10) EGLContext.getEGL();
    mEGLDisplay = mEGL.eglGetDisplay(EGL_DEFAULT_DISPLAY);
    mEGL.eglInitialize(mEGLDisplay, version);
    mEGLConfig = chooseConfig(); // Choosing a config is a little more
                                 // complicated

    // mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig,
    // EGL_NO_CONTEXT, null);
    int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
    int[] attrib_list = {
            EGL_CONTEXT_CLIENT_VERSION, 2,
            EGL10.EGL_NONE
    };
    mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL_NO_CONTEXT, attrib_list);

    mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
    mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);

    mGL = (GL10) mEGLContext.getGL();

    // Record thread owner of OpenGL context
    mThreadOwner = Thread.currentThread().getName();
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:36,代碼來源:PixelBuffer.java


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