Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EGLDisplay display;
- EGLConfig config;
- EGLContext context;
- EGLint num_config;
- EGLSurface surface;
- EGLNativeWindowType native_window;
- Display *x_display;
- // get an EGL display connection
- display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- // initialize the EGL display connection
- eglInitialize(display, NULL, NULL);
- eglBindAPI(EGL_OPENGL_ES_API);
- // get an appropriate EGL frame buffer configuration
- EGLint attribute_list[] = {
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
- eglChooseConfig(display, attribute_list, &config, 1, &num_config);
- if(num_config != 1)
- {
- LOGE("Number of suitable EGL configs found = %d.\n", num_config);
- exit(1);
- }
- // create an EGL rendering context
- EGLint ContextAttributes[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2, // selects OpenGL ES 2.0
- EGL_NONE
- };
- context = eglCreateContext(display, config, EGL_NO_CONTEXT, ContextAttributes);
- if(context == EGL_NO_CONTEXT)
- {
- LOGE("EGL Context creation failed\n");
- exit(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment