1 /* 2 ** Copyright 2012, The Android Open Source Project 3 ** 4 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** you may not use this file except in compliance with the License. 6 ** You may obtain a copy of the License at 7 ** 8 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** 10 ** Unless required by applicable law or agreed to in writing, software 11 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** See the License for the specific language governing permissions and 14 ** limitations under the License. 15 */ 16 17 // This source file is automatically generated 18 19 package android.opengl; 20 21 import android.compat.annotation.UnsupportedAppUsage; 22 import android.graphics.SurfaceTexture; 23 import android.view.Surface; 24 import android.view.SurfaceHolder; 25 import android.view.SurfaceView; 26 27 /** 28 * EGL 1.4 29 * 30 */ 31 public class EGL14 { 32 33 public static final int EGL_DEFAULT_DISPLAY = 0; 34 public static EGLContext EGL_NO_CONTEXT = null; 35 public static EGLDisplay EGL_NO_DISPLAY = null; 36 public static EGLSurface EGL_NO_SURFACE = null; 37 38 public static final int EGL_FALSE = 0; 39 public static final int EGL_TRUE = 1; 40 public static final int EGL_SUCCESS = 0x3000; 41 public static final int EGL_NOT_INITIALIZED = 0x3001; 42 public static final int EGL_BAD_ACCESS = 0x3002; 43 public static final int EGL_BAD_ALLOC = 0x3003; 44 public static final int EGL_BAD_ATTRIBUTE = 0x3004; 45 public static final int EGL_BAD_CONFIG = 0x3005; 46 public static final int EGL_BAD_CONTEXT = 0x3006; 47 public static final int EGL_BAD_CURRENT_SURFACE = 0x3007; 48 public static final int EGL_BAD_DISPLAY = 0x3008; 49 public static final int EGL_BAD_MATCH = 0x3009; 50 public static final int EGL_BAD_NATIVE_PIXMAP = 0x300A; 51 public static final int EGL_BAD_NATIVE_WINDOW = 0x300B; 52 public static final int EGL_BAD_PARAMETER = 0x300C; 53 public static final int EGL_BAD_SURFACE = 0x300D; 54 public static final int EGL_CONTEXT_LOST = 0x300E; 55 public static final int EGL_BUFFER_SIZE = 0x3020; 56 public static final int EGL_ALPHA_SIZE = 0x3021; 57 public static final int EGL_BLUE_SIZE = 0x3022; 58 public static final int EGL_GREEN_SIZE = 0x3023; 59 public static final int EGL_RED_SIZE = 0x3024; 60 public static final int EGL_DEPTH_SIZE = 0x3025; 61 public static final int EGL_STENCIL_SIZE = 0x3026; 62 public static final int EGL_CONFIG_CAVEAT = 0x3027; 63 public static final int EGL_CONFIG_ID = 0x3028; 64 public static final int EGL_LEVEL = 0x3029; 65 public static final int EGL_MAX_PBUFFER_HEIGHT = 0x302A; 66 public static final int EGL_MAX_PBUFFER_PIXELS = 0x302B; 67 public static final int EGL_MAX_PBUFFER_WIDTH = 0x302C; 68 public static final int EGL_NATIVE_RENDERABLE = 0x302D; 69 public static final int EGL_NATIVE_VISUAL_ID = 0x302E; 70 public static final int EGL_NATIVE_VISUAL_TYPE = 0x302F; 71 public static final int EGL_SAMPLES = 0x3031; 72 public static final int EGL_SAMPLE_BUFFERS = 0x3032; 73 public static final int EGL_SURFACE_TYPE = 0x3033; 74 public static final int EGL_TRANSPARENT_TYPE = 0x3034; 75 public static final int EGL_TRANSPARENT_BLUE_VALUE = 0x3035; 76 public static final int EGL_TRANSPARENT_GREEN_VALUE = 0x3036; 77 public static final int EGL_TRANSPARENT_RED_VALUE = 0x3037; 78 public static final int EGL_NONE = 0x3038; 79 public static final int EGL_BIND_TO_TEXTURE_RGB = 0x3039; 80 public static final int EGL_BIND_TO_TEXTURE_RGBA = 0x303A; 81 public static final int EGL_MIN_SWAP_INTERVAL = 0x303B; 82 public static final int EGL_MAX_SWAP_INTERVAL = 0x303C; 83 public static final int EGL_LUMINANCE_SIZE = 0x303D; 84 public static final int EGL_ALPHA_MASK_SIZE = 0x303E; 85 public static final int EGL_COLOR_BUFFER_TYPE = 0x303F; 86 public static final int EGL_RENDERABLE_TYPE = 0x3040; 87 public static final int EGL_MATCH_NATIVE_PIXMAP = 0x3041; 88 public static final int EGL_CONFORMANT = 0x3042; 89 public static final int EGL_SLOW_CONFIG = 0x3050; 90 public static final int EGL_NON_CONFORMANT_CONFIG = 0x3051; 91 public static final int EGL_TRANSPARENT_RGB = 0x3052; 92 public static final int EGL_RGB_BUFFER = 0x308E; 93 public static final int EGL_LUMINANCE_BUFFER = 0x308F; 94 public static final int EGL_NO_TEXTURE = 0x305C; 95 public static final int EGL_TEXTURE_RGB = 0x305D; 96 public static final int EGL_TEXTURE_RGBA = 0x305E; 97 public static final int EGL_TEXTURE_2D = 0x305F; 98 public static final int EGL_PBUFFER_BIT = 0x0001; 99 public static final int EGL_PIXMAP_BIT = 0x0002; 100 public static final int EGL_WINDOW_BIT = 0x0004; 101 public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020; 102 public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040; 103 public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200; 104 public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400; 105 public static final int EGL_OPENGL_ES_BIT = 0x0001; 106 public static final int EGL_OPENVG_BIT = 0x0002; 107 public static final int EGL_OPENGL_ES2_BIT = 0x0004; 108 public static final int EGL_OPENGL_BIT = 0x0008; 109 public static final int EGL_VENDOR = 0x3053; 110 public static final int EGL_VERSION = 0x3054; 111 public static final int EGL_EXTENSIONS = 0x3055; 112 public static final int EGL_CLIENT_APIS = 0x308D; 113 public static final int EGL_HEIGHT = 0x3056; 114 public static final int EGL_WIDTH = 0x3057; 115 public static final int EGL_LARGEST_PBUFFER = 0x3058; 116 public static final int EGL_TEXTURE_FORMAT = 0x3080; 117 public static final int EGL_TEXTURE_TARGET = 0x3081; 118 public static final int EGL_MIPMAP_TEXTURE = 0x3082; 119 public static final int EGL_MIPMAP_LEVEL = 0x3083; 120 public static final int EGL_RENDER_BUFFER = 0x3086; 121 public static final int EGL_VG_COLORSPACE = 0x3087; 122 public static final int EGL_VG_ALPHA_FORMAT = 0x3088; 123 public static final int EGL_HORIZONTAL_RESOLUTION = 0x3090; 124 public static final int EGL_VERTICAL_RESOLUTION = 0x3091; 125 public static final int EGL_PIXEL_ASPECT_RATIO = 0x3092; 126 public static final int EGL_SWAP_BEHAVIOR = 0x3093; 127 public static final int EGL_MULTISAMPLE_RESOLVE = 0x3099; 128 public static final int EGL_BACK_BUFFER = 0x3084; 129 public static final int EGL_SINGLE_BUFFER = 0x3085; 130 public static final int EGL_VG_COLORSPACE_sRGB = 0x3089; 131 public static final int EGL_VG_COLORSPACE_LINEAR = 0x308A; 132 public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B; 133 public static final int EGL_VG_ALPHA_FORMAT_PRE = 0x308C; 134 public static final int EGL_DISPLAY_SCALING = 10000; 135 public static final int EGL_BUFFER_PRESERVED = 0x3094; 136 public static final int EGL_BUFFER_DESTROYED = 0x3095; 137 public static final int EGL_OPENVG_IMAGE = 0x3096; 138 public static final int EGL_CONTEXT_CLIENT_TYPE = 0x3097; 139 public static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; 140 public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A; 141 public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B; 142 public static final int EGL_OPENGL_ES_API = 0x30A0; 143 public static final int EGL_OPENVG_API = 0x30A1; 144 public static final int EGL_OPENGL_API = 0x30A2; 145 public static final int EGL_DRAW = 0x3059; 146 public static final int EGL_READ = 0x305A; 147 public static final int EGL_CORE_NATIVE_ENGINE = 0x305B; 148 _nativeClassInit()149 native private static void _nativeClassInit(); 150 static { _nativeClassInit()151 _nativeClassInit(); 152 } 153 // C function EGLint eglGetError ( void ) 154 eglGetError( )155 public static native int eglGetError( 156 ); 157 158 // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) 159 eglGetDisplay( int display_id )160 public static native EGLDisplay eglGetDisplay( 161 int display_id 162 ); 163 164 /** 165 * {@hide} 166 */ 167 @UnsupportedAppUsage eglGetDisplay( long display_id )168 public static native EGLDisplay eglGetDisplay( 169 long display_id 170 ); 171 172 // C function EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) 173 eglInitialize( EGLDisplay dpy, int[] major, int majorOffset, int[] minor, int minorOffset )174 public static native boolean eglInitialize( 175 EGLDisplay dpy, 176 int[] major, 177 int majorOffset, 178 int[] minor, 179 int minorOffset 180 ); 181 182 // C function EGLBoolean eglTerminate ( EGLDisplay dpy ) 183 eglTerminate( EGLDisplay dpy )184 public static native boolean eglTerminate( 185 EGLDisplay dpy 186 ); 187 188 // C function const char * eglQueryString ( EGLDisplay dpy, EGLint name ) 189 eglQueryString( EGLDisplay dpy, int name )190 public static native String eglQueryString( 191 EGLDisplay dpy, 192 int name 193 ); 194 // C function EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) 195 eglGetConfigs( EGLDisplay dpy, EGLConfig[] configs, int configsOffset, int config_size, int[] num_config, int num_configOffset )196 public static native boolean eglGetConfigs( 197 EGLDisplay dpy, 198 EGLConfig[] configs, 199 int configsOffset, 200 int config_size, 201 int[] num_config, 202 int num_configOffset 203 ); 204 205 // C function EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) 206 eglChooseConfig( EGLDisplay dpy, int[] attrib_list, int attrib_listOffset, EGLConfig[] configs, int configsOffset, int config_size, int[] num_config, int num_configOffset )207 public static native boolean eglChooseConfig( 208 EGLDisplay dpy, 209 int[] attrib_list, 210 int attrib_listOffset, 211 EGLConfig[] configs, 212 int configsOffset, 213 int config_size, 214 int[] num_config, 215 int num_configOffset 216 ); 217 218 // C function EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value ) 219 eglGetConfigAttrib( EGLDisplay dpy, EGLConfig config, int attribute, int[] value, int offset )220 public static native boolean eglGetConfigAttrib( 221 EGLDisplay dpy, 222 EGLConfig config, 223 int attribute, 224 int[] value, 225 int offset 226 ); 227 228 // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) 229 _eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )230 private static native EGLSurface _eglCreateWindowSurface( 231 EGLDisplay dpy, 232 EGLConfig config, 233 Object win, 234 int[] attrib_list, 235 int offset 236 ); 237 _eglCreateWindowSurfaceTexture( EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )238 private static native EGLSurface _eglCreateWindowSurfaceTexture( 239 EGLDisplay dpy, 240 EGLConfig config, 241 Object win, 242 int[] attrib_list, 243 int offset 244 ); 245 eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )246 public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, 247 EGLConfig config, 248 Object win, 249 int[] attrib_list, 250 int offset 251 ){ 252 Surface sur = null; 253 if (win instanceof SurfaceView) { 254 SurfaceView surfaceView = (SurfaceView)win; 255 sur = surfaceView.getHolder().getSurface(); 256 } else if (win instanceof SurfaceHolder) { 257 SurfaceHolder holder = (SurfaceHolder)win; 258 sur = holder.getSurface(); 259 } else if (win instanceof Surface) { 260 sur = (Surface) win; 261 } 262 263 EGLSurface surface; 264 if (sur != null) { 265 surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset); 266 } else if (win instanceof SurfaceTexture) { 267 surface = _eglCreateWindowSurfaceTexture(dpy, config, 268 win, attrib_list, offset); 269 } else { 270 throw new java.lang.UnsupportedOperationException( 271 "eglCreateWindowSurface() can only be called with an instance of " + 272 "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + 273 "this will be fixed later."); 274 } 275 276 return surface; 277 } 278 // C function EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) 279 eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config, int[] attrib_list, int offset )280 public static native EGLSurface eglCreatePbufferSurface( 281 EGLDisplay dpy, 282 EGLConfig config, 283 int[] attrib_list, 284 int offset 285 ); 286 287 // C function EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) 288 289 @Deprecated eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config, int pixmap, int[] attrib_list, int offset )290 public static native EGLSurface eglCreatePixmapSurface( 291 EGLDisplay dpy, 292 EGLConfig config, 293 int pixmap, 294 int[] attrib_list, 295 int offset 296 ); 297 298 // C function EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) 299 eglDestroySurface( EGLDisplay dpy, EGLSurface surface )300 public static native boolean eglDestroySurface( 301 EGLDisplay dpy, 302 EGLSurface surface 303 ); 304 305 // C function EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) 306 eglQuerySurface( EGLDisplay dpy, EGLSurface surface, int attribute, int[] value, int offset )307 public static native boolean eglQuerySurface( 308 EGLDisplay dpy, 309 EGLSurface surface, 310 int attribute, 311 int[] value, 312 int offset 313 ); 314 315 // C function EGLBoolean eglBindAPI ( EGLenum api ) 316 eglBindAPI( int api )317 public static native boolean eglBindAPI( 318 int api 319 ); 320 321 // C function EGLenum eglQueryAPI ( void ) 322 eglQueryAPI( )323 public static native int eglQueryAPI( 324 ); 325 326 // C function EGLBoolean eglWaitClient ( void ) 327 eglWaitClient( )328 public static native boolean eglWaitClient( 329 ); 330 331 // C function EGLBoolean eglReleaseThread ( void ) 332 eglReleaseThread( )333 public static native boolean eglReleaseThread( 334 ); 335 336 // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) 337 // TODO Deprecate the below method eglCreatePbufferFromClientBuffer( EGLDisplay dpy, int buftype, int buffer, EGLConfig config, int[] attrib_list, int offset )338 public static native EGLSurface eglCreatePbufferFromClientBuffer( 339 EGLDisplay dpy, 340 int buftype, 341 int buffer, 342 EGLConfig config, 343 int[] attrib_list, 344 int offset 345 ); 346 // TODO Unhide the below method 347 /** 348 * {@hide} 349 */ eglCreatePbufferFromClientBuffer( EGLDisplay dpy, int buftype, long buffer, EGLConfig config, int[] attrib_list, int offset )350 public static native EGLSurface eglCreatePbufferFromClientBuffer( 351 EGLDisplay dpy, 352 int buftype, 353 long buffer, 354 EGLConfig config, 355 int[] attrib_list, 356 int offset 357 ); 358 359 // C function EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) 360 eglSurfaceAttrib( EGLDisplay dpy, EGLSurface surface, int attribute, int value )361 public static native boolean eglSurfaceAttrib( 362 EGLDisplay dpy, 363 EGLSurface surface, 364 int attribute, 365 int value 366 ); 367 368 // C function EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) 369 eglBindTexImage( EGLDisplay dpy, EGLSurface surface, int buffer )370 public static native boolean eglBindTexImage( 371 EGLDisplay dpy, 372 EGLSurface surface, 373 int buffer 374 ); 375 376 // C function EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) 377 eglReleaseTexImage( EGLDisplay dpy, EGLSurface surface, int buffer )378 public static native boolean eglReleaseTexImage( 379 EGLDisplay dpy, 380 EGLSurface surface, 381 int buffer 382 ); 383 384 // C function EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) 385 eglSwapInterval( EGLDisplay dpy, int interval )386 public static native boolean eglSwapInterval( 387 EGLDisplay dpy, 388 int interval 389 ); 390 391 // C function EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list ) 392 eglCreateContext( EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list, int offset )393 public static native EGLContext eglCreateContext( 394 EGLDisplay dpy, 395 EGLConfig config, 396 EGLContext share_context, 397 int[] attrib_list, 398 int offset 399 ); 400 401 // C function EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) 402 eglDestroyContext( EGLDisplay dpy, EGLContext ctx )403 public static native boolean eglDestroyContext( 404 EGLDisplay dpy, 405 EGLContext ctx 406 ); 407 408 // C function EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) 409 eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )410 public static native boolean eglMakeCurrent( 411 EGLDisplay dpy, 412 EGLSurface draw, 413 EGLSurface read, 414 EGLContext ctx 415 ); 416 417 // C function EGLContext eglGetCurrentContext ( void ) 418 eglGetCurrentContext( )419 public static native EGLContext eglGetCurrentContext( 420 ); 421 422 // C function EGLSurface eglGetCurrentSurface ( EGLint readdraw ) 423 eglGetCurrentSurface( int readdraw )424 public static native EGLSurface eglGetCurrentSurface( 425 int readdraw 426 ); 427 428 // C function EGLDisplay eglGetCurrentDisplay ( void ) 429 eglGetCurrentDisplay( )430 public static native EGLDisplay eglGetCurrentDisplay( 431 ); 432 433 // C function EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value ) 434 eglQueryContext( EGLDisplay dpy, EGLContext ctx, int attribute, int[] value, int offset )435 public static native boolean eglQueryContext( 436 EGLDisplay dpy, 437 EGLContext ctx, 438 int attribute, 439 int[] value, 440 int offset 441 ); 442 443 // C function EGLBoolean eglWaitGL ( void ) 444 eglWaitGL( )445 public static native boolean eglWaitGL( 446 ); 447 448 // C function EGLBoolean eglWaitNative ( EGLint engine ) 449 eglWaitNative( int engine )450 public static native boolean eglWaitNative( 451 int engine 452 ); 453 454 // C function EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface ) 455 eglSwapBuffers( EGLDisplay dpy, EGLSurface surface )456 public static native boolean eglSwapBuffers( 457 EGLDisplay dpy, 458 EGLSurface surface 459 ); 460 461 // C function EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target ) 462 eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, int target )463 public static native boolean eglCopyBuffers( 464 EGLDisplay dpy, 465 EGLSurface surface, 466 int target 467 ); 468 469 } 470