当前位置: 首页>>代码示例>>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;未经允许,请勿转载。