OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 import javax.microedition.khronos.egl.EGL10; | 38 import javax.microedition.khronos.egl.EGL10; |
39 import javax.microedition.khronos.egl.EGLConfig; | 39 import javax.microedition.khronos.egl.EGLConfig; |
40 import javax.microedition.khronos.egl.EGLContext; | 40 import javax.microedition.khronos.egl.EGLContext; |
41 import javax.microedition.khronos.egl.EGLDisplay; | 41 import javax.microedition.khronos.egl.EGLDisplay; |
42 import javax.microedition.khronos.egl.EGLSurface; | 42 import javax.microedition.khronos.egl.EGLSurface; |
43 | 43 |
44 /** | 44 /** |
45 * Holds EGL state and utility methods for handling an EGLContext, an EGLDisplay
, and an EGLSurface. | 45 * Holds EGL state and utility methods for handling an EGLContext, an EGLDisplay
, and an EGLSurface. |
46 */ | 46 */ |
47 public final class EglBase { | 47 public class EglBase { |
48 private static final String TAG = "EglBase"; | 48 private static final String TAG = "EglBase"; |
49 // These constants are taken from EGL14.EGL_OPENGL_ES2_BIT and EGL14.EGL_CONTE
XT_CLIENT_VERSION. | 49 // These constants are taken from EGL14.EGL_OPENGL_ES2_BIT and EGL14.EGL_CONTE
XT_CLIENT_VERSION. |
50 // https://android.googlesource.com/platform/frameworks/base/+/master/opengl/j
ava/android/opengl/EGL14.java | 50 // https://android.googlesource.com/platform/frameworks/base/+/master/opengl/j
ava/android/opengl/EGL14.java |
51 // This is similar to how GlSurfaceView does: | 51 // This is similar to how GlSurfaceView does: |
52 // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.androi
d/android/5.1.1_r1/android/opengl/GLSurfaceView.java#760 | 52 // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.androi
d/android/5.1.1_r1/android/opengl/GLSurfaceView.java#760 |
53 private static final int EGL_OPENGL_ES2_BIT = 4; | 53 private static final int EGL_OPENGL_ES2_BIT = 4; |
54 private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; | 54 private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; |
55 // Android-specific extension. | 55 // Android-specific extension. |
56 private static final int EGL_RECORDABLE_ANDROID = 0x3142; | 56 private static final int EGL_RECORDABLE_ANDROID = 0x3142; |
57 | 57 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { | 327 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { |
328 int[] contextAttributes = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE}; | 328 int[] contextAttributes = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE}; |
329 EGLContext eglContext = | 329 EGLContext eglContext = |
330 egl.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttrib
utes); | 330 egl.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttrib
utes); |
331 if (eglContext == EGL10.EGL_NO_CONTEXT) { | 331 if (eglContext == EGL10.EGL_NO_CONTEXT) { |
332 throw new RuntimeException("Failed to create EGL context"); | 332 throw new RuntimeException("Failed to create EGL context"); |
333 } | 333 } |
334 return eglContext; | 334 return eglContext; |
335 } | 335 } |
336 } | 336 } |
OLD | NEW |