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