EGL14.java revision 1296c63bf14af034a90d5579ff301d1a2b70e34a
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 * EGL 1.4
29 *
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    // C function EGLint eglGetError ( void )
154
155    public static native int eglGetError(
156    );
157
158    // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id )
159
160    public static native EGLDisplay eglGetDisplay(
161        int display_id
162    );
163
164    // 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    // 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    // 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    // 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    // 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        } else if (win instanceof Surface) {
252            sur = (Surface) win;
253        }
254
255        EGLSurface surface;
256        if (sur != null) {
257            surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
258        } else if (win instanceof SurfaceTexture) {
259            surface = _eglCreateWindowSurfaceTexture(dpy, config,
260                    win, attrib_list, offset);
261        } else {
262            throw new java.lang.UnsupportedOperationException(
263                "eglCreateWindowSurface() can only be called with an instance of " +
264                "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
265                "this will be fixed later.");
266        }
267
268        return surface;
269    }
270    // C function EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list )
271
272    public static native EGLSurface eglCreatePbufferSurface(
273        EGLDisplay dpy,
274        EGLConfig config,
275        int[] attrib_list,
276        int offset
277    );
278
279    // C function EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list )
280
281    public static native EGLSurface eglCreatePixmapSurface(
282        EGLDisplay dpy,
283        EGLConfig config,
284        int pixmap,
285        int[] attrib_list,
286        int offset
287    );
288
289    // C function EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface )
290
291    public static native boolean eglDestroySurface(
292        EGLDisplay dpy,
293        EGLSurface surface
294    );
295
296    // C function EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value )
297
298    public static native boolean eglQuerySurface(
299        EGLDisplay dpy,
300        EGLSurface surface,
301        int attribute,
302        int[] value,
303        int offset
304    );
305
306    // C function EGLBoolean eglBindAPI ( EGLenum api )
307
308    public static native boolean eglBindAPI(
309        int api
310    );
311
312    // C function EGLenum eglQueryAPI ( void )
313
314    public static native int eglQueryAPI(
315    );
316
317    // C function EGLBoolean eglWaitClient ( void )
318
319    public static native boolean eglWaitClient(
320    );
321
322    // C function EGLBoolean eglReleaseThread ( void )
323
324    public static native boolean eglReleaseThread(
325    );
326
327    // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list )
328
329    public static native EGLSurface eglCreatePbufferFromClientBuffer(
330        EGLDisplay dpy,
331        int buftype,
332        int buffer,
333        EGLConfig config,
334        int[] attrib_list,
335        int offset
336    );
337
338    // C function EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value )
339
340    public static native boolean eglSurfaceAttrib(
341        EGLDisplay dpy,
342        EGLSurface surface,
343        int attribute,
344        int value
345    );
346
347    // C function EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
348
349    public static native boolean eglBindTexImage(
350        EGLDisplay dpy,
351        EGLSurface surface,
352        int buffer
353    );
354
355    // C function EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
356
357    public static native boolean eglReleaseTexImage(
358        EGLDisplay dpy,
359        EGLSurface surface,
360        int buffer
361    );
362
363    // C function EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval )
364
365    public static native boolean eglSwapInterval(
366        EGLDisplay dpy,
367        int interval
368    );
369
370    // C function EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list )
371
372    public static native EGLContext eglCreateContext(
373        EGLDisplay dpy,
374        EGLConfig config,
375        EGLContext share_context,
376        int[] attrib_list,
377        int offset
378    );
379
380    // C function EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx )
381
382    public static native boolean eglDestroyContext(
383        EGLDisplay dpy,
384        EGLContext ctx
385    );
386
387    // C function EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )
388
389    public static native boolean eglMakeCurrent(
390        EGLDisplay dpy,
391        EGLSurface draw,
392        EGLSurface read,
393        EGLContext ctx
394    );
395
396    // C function EGLContext eglGetCurrentContext ( void )
397
398    public static native EGLContext eglGetCurrentContext(
399    );
400
401    // C function EGLSurface eglGetCurrentSurface ( EGLint readdraw )
402
403    public static native EGLSurface eglGetCurrentSurface(
404        int readdraw
405    );
406
407    // C function EGLDisplay eglGetCurrentDisplay ( void )
408
409    public static native EGLDisplay eglGetCurrentDisplay(
410    );
411
412    // C function EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value )
413
414    public static native boolean eglQueryContext(
415        EGLDisplay dpy,
416        EGLContext ctx,
417        int attribute,
418        int[] value,
419        int offset
420    );
421
422    // C function EGLBoolean eglWaitGL ( void )
423
424    public static native boolean eglWaitGL(
425    );
426
427    // C function EGLBoolean eglWaitNative ( EGLint engine )
428
429    public static native boolean eglWaitNative(
430        int engine
431    );
432
433    // C function EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface )
434
435    public static native boolean eglSwapBuffers(
436        EGLDisplay dpy,
437        EGLSurface surface
438    );
439
440    // C function EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target )
441
442    public static native boolean eglCopyBuffers(
443        EGLDisplay dpy,
444        EGLSurface surface,
445        int target
446    );
447
448}
449