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