1 /*
2  * Copyright (C) 2007 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 package android.opengl;
18 
19 import java.io.IOException;
20 import java.io.Writer;
21 import java.nio.Buffer;
22 import java.nio.ByteBuffer;
23 import java.nio.ByteOrder;
24 import java.nio.CharBuffer;
25 import java.nio.DoubleBuffer;
26 import java.nio.FloatBuffer;
27 import java.nio.IntBuffer;
28 import java.nio.LongBuffer;
29 import java.nio.ShortBuffer;
30 import java.util.Arrays;
31 
32 import javax.microedition.khronos.opengles.GL;
33 
34 /**
35  * A wrapper that logs all GL calls (and results) in human-readable form.
36  *
37  */
38 class GLLogWrapper extends GLWrapperBase {
39     private static final int FORMAT_INT = 0;
40     private static final int FORMAT_FLOAT = 1;
41     private static final int FORMAT_FIXED = 2;
42 
GLLogWrapper(GL gl, Writer log, boolean logArgumentNames)43     public GLLogWrapper(GL gl, Writer log, boolean logArgumentNames) {
44         super(gl);
45         mLog = log;
46         mLogArgumentNames = logArgumentNames;
47     }
48 
checkError()49     private void checkError() {
50         int glError;
51         if ((glError = mgl.glGetError()) != 0) {
52             String errorMessage = "glError: " + Integer.toString(glError);
53             logLine(errorMessage);
54         }
55     }
56 
logLine(String message)57     private void logLine(String message) {
58         log(message + '\n');
59     }
60 
log(String message)61     private void log(String message) {
62         try {
63             mLog.write(message);
64         } catch (IOException e) {
65             // Ignore exception, keep on trying
66         }
67     }
68 
begin(String name)69     private void begin(String name) {
70         log(name + '(');
71         mArgCount = 0;
72     }
73 
arg(String name, String value)74     private void arg(String name, String value) {
75         if (mArgCount++ > 0) {
76             log(", ");
77         }
78         if (mLogArgumentNames) {
79             log(name + "=");
80         }
81         log(value);
82     }
83 
end()84     private void end() {
85         log(");\n");
86         flush();
87     }
88 
flush()89     private void flush() {
90         try {
91             mLog.flush();
92         } catch (IOException e) {
93             mLog = null;
94         }
95     }
96 
arg(String name, boolean value)97     private void arg(String name, boolean value) {
98         arg(name, Boolean.toString(value));
99     }
100 
arg(String name, int value)101     private void arg(String name, int value) {
102         arg(name, Integer.toString(value));
103     }
104 
arg(String name, float value)105     private void arg(String name, float value) {
106         arg(name, Float.toString(value));
107     }
108 
returns(String result)109     private void returns(String result) {
110         log(") returns " + result + ";\n");
111         flush();
112     }
113 
returns(int result)114     private void returns(int result) {
115         returns(Integer.toString(result));
116     }
117 
arg(String name, int n, int[] arr, int offset)118     private void arg(String name, int n, int[] arr, int offset) {
119         arg(name, toString(n, FORMAT_INT, arr, offset));
120     }
121 
arg(String name, int n, short[] arr, int offset)122     private void arg(String name, int n, short[] arr, int offset) {
123         arg(name, toString(n, arr, offset));
124     }
125 
arg(String name, int n, float[] arr, int offset)126     private void arg(String name, int n, float[] arr, int offset) {
127         arg(name, toString(n, arr, offset));
128     }
129 
formattedAppend(StringBuilder buf, int value, int format)130     private void formattedAppend(StringBuilder buf, int value, int format) {
131         switch (format) {
132         case FORMAT_INT:
133             buf.append(value);
134             break;
135         case FORMAT_FLOAT:
136             buf.append(Float.intBitsToFloat(value));
137             break;
138         case FORMAT_FIXED:
139             buf.append(value / 65536.0f);
140             break;
141         }
142     }
143 
toString(int n, int format, int[] arr, int offset)144     private String toString(int n, int format, int[] arr, int offset) {
145         StringBuilder buf = new StringBuilder();
146         buf.append("{\n");
147         int arrLen = arr.length;
148         for (int i = 0; i < n; i++) {
149             int index = offset + i;
150             buf.append(" [" + index + "] = ");
151             if (index < 0 || index >= arrLen) {
152                 buf.append("out of bounds");
153             } else {
154                 formattedAppend(buf, arr[index], format);
155             }
156             buf.append('\n');
157         }
158         buf.append("}");
159         return buf.toString();
160     }
161 
toString(int n, short[] arr, int offset)162     private String toString(int n, short[] arr, int offset) {
163         StringBuilder buf = new StringBuilder();
164         buf.append("{\n");
165         int arrLen = arr.length;
166         for (int i = 0; i < n; i++) {
167             int index = offset + i;
168             buf.append(" [" + index + "] = ");
169             if (index < 0 || index >= arrLen) {
170                 buf.append("out of bounds");
171             } else {
172                 buf.append(arr[index]);
173             }
174             buf.append('\n');
175         }
176         buf.append("}");
177         return buf.toString();
178     }
179 
toString(int n, float[] arr, int offset)180     private String toString(int n, float[] arr, int offset) {
181         StringBuilder buf = new StringBuilder();
182         buf.append("{\n");
183         int arrLen = arr.length;
184         for (int i = 0; i < n; i++) {
185             int index = offset + i;
186             buf.append("[" + index + "] = ");
187             if (index < 0 || index >= arrLen) {
188                 buf.append("out of bounds");
189             } else {
190                 buf.append(arr[index]);
191             }
192             buf.append('\n');
193         }
194         buf.append("}");
195         return buf.toString();
196     }
197 
toString(int n, FloatBuffer buf)198     private String toString(int n, FloatBuffer buf) {
199         StringBuilder builder = new StringBuilder();
200         builder.append("{\n");
201         for (int i = 0; i < n; i++) {
202             builder.append(" [" + i + "] = " + buf.get(i) + '\n');
203         }
204         builder.append("}");
205         return builder.toString();
206     }
207 
toString(int n, int format, IntBuffer buf)208     private String toString(int n, int format, IntBuffer buf) {
209         StringBuilder builder = new StringBuilder();
210         builder.append("{\n");
211         for (int i = 0; i < n; i++) {
212             builder.append(" [" + i + "] = ");
213             formattedAppend(builder, buf.get(i), format);
214             builder.append('\n');
215         }
216         builder.append("}");
217         return builder.toString();
218     }
219 
toString(int n, ShortBuffer buf)220     private String toString(int n, ShortBuffer buf) {
221         StringBuilder builder = new StringBuilder();
222         builder.append("{\n");
223         for (int i = 0; i < n; i++) {
224             builder.append(" [" + i + "] = " + buf.get(i) + '\n');
225         }
226         builder.append("}");
227         return builder.toString();
228     }
229 
arg(String name, int n, FloatBuffer buf)230     private void arg(String name, int n, FloatBuffer buf) {
231         arg(name, toString(n, buf));
232     }
233 
arg(String name, int n, IntBuffer buf)234     private void arg(String name, int n, IntBuffer buf) {
235         arg(name, toString(n, FORMAT_INT, buf));
236     }
237 
arg(String name, int n, ShortBuffer buf)238     private void arg(String name, int n, ShortBuffer buf) {
239         arg(name, toString(n, buf));
240     }
241 
argPointer(int size, int type, int stride, Buffer pointer)242     private void argPointer(int size, int type, int stride, Buffer pointer) {
243         arg("size", size);
244         arg("type", getPointerTypeName(type));
245         arg("stride", stride);
246         arg("pointer", pointer.toString());
247     }
248 
getHex(int value)249     private static String getHex(int value) {
250         return "0x" + Integer.toHexString(value);
251     }
252 
getErrorString(int error)253     public static String getErrorString(int error) {
254         switch (error) {
255         case GL_NO_ERROR:
256             return "GL_NO_ERROR";
257         case GL_INVALID_ENUM:
258             return "GL_INVALID_ENUM";
259         case GL_INVALID_VALUE:
260             return "GL_INVALID_VALUE";
261         case GL_INVALID_OPERATION:
262             return "GL_INVALID_OPERATION";
263         case GL_STACK_OVERFLOW:
264             return "GL_STACK_OVERFLOW";
265         case GL_STACK_UNDERFLOW:
266             return "GL_STACK_UNDERFLOW";
267         case GL_OUT_OF_MEMORY:
268             return "GL_OUT_OF_MEMORY";
269         default:
270             return getHex(error);
271         }
272     }
273 
getClearBufferMask(int mask)274     private String getClearBufferMask(int mask) {
275         StringBuilder b = new StringBuilder();
276         if ((mask & GL_DEPTH_BUFFER_BIT) != 0) {
277             b.append("GL_DEPTH_BUFFER_BIT");
278             mask &= ~GL_DEPTH_BUFFER_BIT;
279         }
280         if ((mask & GL_STENCIL_BUFFER_BIT) != 0) {
281             if (b.length() > 0) {
282                 b.append(" | ");
283             }
284             b.append("GL_STENCIL_BUFFER_BIT");
285             mask &= ~GL_STENCIL_BUFFER_BIT;
286         }
287         if ((mask & GL_COLOR_BUFFER_BIT) != 0) {
288             if (b.length() > 0) {
289                 b.append(" | ");
290             }
291             b.append("GL_COLOR_BUFFER_BIT");
292             mask &= ~GL_COLOR_BUFFER_BIT;
293         }
294         if (mask != 0) {
295             if (b.length() > 0) {
296                 b.append(" | ");
297             }
298             b.append(getHex(mask));
299         }
300         return b.toString();
301     }
302 
getFactor(int factor)303     private String getFactor(int factor) {
304         switch(factor) {
305         case GL_ZERO:
306             return "GL_ZERO";
307         case GL_ONE:
308             return "GL_ONE";
309         case GL_SRC_COLOR:
310             return "GL_SRC_COLOR";
311         case GL_ONE_MINUS_SRC_COLOR:
312             return "GL_ONE_MINUS_SRC_COLOR";
313         case GL_DST_COLOR:
314             return "GL_DST_COLOR";
315         case GL_ONE_MINUS_DST_COLOR:
316             return "GL_ONE_MINUS_DST_COLOR";
317         case GL_SRC_ALPHA:
318             return "GL_SRC_ALPHA";
319         case GL_ONE_MINUS_SRC_ALPHA:
320             return "GL_ONE_MINUS_SRC_ALPHA";
321         case GL_DST_ALPHA:
322             return "GL_DST_ALPHA";
323         case GL_ONE_MINUS_DST_ALPHA:
324             return "GL_ONE_MINUS_DST_ALPHA";
325         case GL_SRC_ALPHA_SATURATE:
326             return "GL_SRC_ALPHA_SATURATE";
327 
328         default:
329             return getHex(factor);
330         }
331     }
332 
getShadeModel(int model)333     private String getShadeModel(int model) {
334         switch(model) {
335         case GL_FLAT:
336             return "GL_FLAT";
337         case GL_SMOOTH:
338             return "GL_SMOOTH";
339         default:
340             return getHex(model);
341         }
342     }
343 
getTextureTarget(int target)344     private String getTextureTarget(int target) {
345         switch (target) {
346         case GL_TEXTURE_2D:
347             return "GL_TEXTURE_2D";
348         default:
349             return getHex(target);
350         }
351     }
352 
getTextureEnvTarget(int target)353     private String getTextureEnvTarget(int target) {
354         switch (target) {
355         case GL_TEXTURE_ENV:
356             return "GL_TEXTURE_ENV";
357         default:
358             return getHex(target);
359         }
360     }
361 
getTextureEnvPName(int pname)362     private String getTextureEnvPName(int pname) {
363         switch (pname) {
364         case GL_TEXTURE_ENV_MODE:
365             return "GL_TEXTURE_ENV_MODE";
366         case GL_TEXTURE_ENV_COLOR:
367             return "GL_TEXTURE_ENV_COLOR";
368         default:
369             return getHex(pname);
370         }
371     }
372 
getTextureEnvParamCount(int pname)373     private int getTextureEnvParamCount(int pname) {
374         switch (pname) {
375         case GL_TEXTURE_ENV_MODE:
376             return 1;
377         case GL_TEXTURE_ENV_COLOR:
378             return 4;
379         default:
380             return 0;
381         }
382     }
383 
getTextureEnvParamName(float param)384     private String getTextureEnvParamName(float param) {
385         int iparam = (int) param;
386         if (param == (float) iparam) {
387             switch (iparam) {
388             case GL_REPLACE:
389                 return "GL_REPLACE";
390             case GL_MODULATE:
391                 return "GL_MODULATE";
392             case GL_DECAL:
393                 return "GL_DECAL";
394             case GL_BLEND:
395                 return "GL_BLEND";
396             case GL_ADD:
397                 return "GL_ADD";
398             case GL_COMBINE:
399                 return "GL_COMBINE";
400             default:
401                 return getHex(iparam);
402             }
403         }
404         return Float.toString(param);
405     }
406 
getMatrixMode(int matrixMode)407     private String getMatrixMode(int matrixMode) {
408         switch (matrixMode) {
409         case GL_MODELVIEW:
410             return "GL_MODELVIEW";
411         case GL_PROJECTION:
412             return "GL_PROJECTION";
413         case GL_TEXTURE:
414             return "GL_TEXTURE";
415         default:
416             return getHex(matrixMode);
417         }
418     }
419 
getClientState(int clientState)420     private String getClientState(int clientState) {
421         switch (clientState) {
422         case GL_COLOR_ARRAY:
423             return "GL_COLOR_ARRAY";
424         case GL_VERTEX_ARRAY:
425             return "GL_VERTEX_ARRAY";
426         case GL_NORMAL_ARRAY:
427             return "GL_NORMAL_ARRAY";
428         case GL_TEXTURE_COORD_ARRAY:
429             return "GL_TEXTURE_COORD_ARRAY";
430         default:
431             return getHex(clientState);
432         }
433     }
434 
getCap(int cap)435     private String getCap(int cap) {
436         switch (cap) {
437         case GL_FOG:
438             return "GL_FOG";
439         case GL_LIGHTING:
440             return "GL_LIGHTING";
441         case GL_TEXTURE_2D:
442             return "GL_TEXTURE_2D";
443         case GL_CULL_FACE:
444             return "GL_CULL_FACE";
445         case GL_ALPHA_TEST:
446             return "GL_ALPHA_TEST";
447         case GL_BLEND:
448             return "GL_BLEND";
449         case GL_COLOR_LOGIC_OP:
450             return "GL_COLOR_LOGIC_OP";
451         case GL_DITHER:
452             return "GL_DITHER";
453         case GL_STENCIL_TEST:
454             return "GL_STENCIL_TEST";
455         case GL_DEPTH_TEST:
456             return "GL_DEPTH_TEST";
457         case GL_LIGHT0:
458             return "GL_LIGHT0";
459         case GL_LIGHT1:
460             return "GL_LIGHT1";
461         case GL_LIGHT2:
462             return "GL_LIGHT2";
463         case GL_LIGHT3:
464             return "GL_LIGHT3";
465         case GL_LIGHT4:
466             return "GL_LIGHT4";
467         case GL_LIGHT5:
468             return "GL_LIGHT5";
469         case GL_LIGHT6:
470             return "GL_LIGHT6";
471         case GL_LIGHT7:
472             return "GL_LIGHT7";
473         case GL_POINT_SMOOTH:
474             return "GL_POINT_SMOOTH";
475         case GL_LINE_SMOOTH:
476             return "GL_LINE_SMOOTH";
477         case GL_COLOR_MATERIAL:
478             return "GL_COLOR_MATERIAL";
479         case GL_NORMALIZE:
480             return "GL_NORMALIZE";
481         case GL_RESCALE_NORMAL:
482             return "GL_RESCALE_NORMAL";
483         case GL_VERTEX_ARRAY:
484             return "GL_VERTEX_ARRAY";
485         case GL_NORMAL_ARRAY:
486             return "GL_NORMAL_ARRAY";
487         case GL_COLOR_ARRAY:
488             return "GL_COLOR_ARRAY";
489         case GL_TEXTURE_COORD_ARRAY:
490             return "GL_TEXTURE_COORD_ARRAY";
491         case GL_MULTISAMPLE:
492             return "GL_MULTISAMPLE";
493         case GL_SAMPLE_ALPHA_TO_COVERAGE:
494             return "GL_SAMPLE_ALPHA_TO_COVERAGE";
495         case GL_SAMPLE_ALPHA_TO_ONE:
496             return "GL_SAMPLE_ALPHA_TO_ONE";
497         case GL_SAMPLE_COVERAGE:
498             return "GL_SAMPLE_COVERAGE";
499         case GL_SCISSOR_TEST:
500             return "GL_SCISSOR_TEST";
501         default:
502             return getHex(cap);
503         }
504     }
505 
getTexturePName(int pname)506     private String getTexturePName(int pname) {
507         switch (pname) {
508         case GL_TEXTURE_MAG_FILTER:
509             return "GL_TEXTURE_MAG_FILTER";
510         case GL_TEXTURE_MIN_FILTER:
511             return "GL_TEXTURE_MIN_FILTER";
512         case GL_TEXTURE_WRAP_S:
513             return "GL_TEXTURE_WRAP_S";
514         case GL_TEXTURE_WRAP_T:
515             return "GL_TEXTURE_WRAP_T";
516         case GL_GENERATE_MIPMAP:
517             return "GL_GENERATE_MIPMAP";
518         case GL_TEXTURE_CROP_RECT_OES:
519             return "GL_TEXTURE_CROP_RECT_OES";
520         default:
521             return getHex(pname);
522         }
523     }
524 
getTextureParamName(float param)525     private String getTextureParamName(float param) {
526         int iparam = (int) param;
527         if (param == (float) iparam) {
528             switch (iparam) {
529             case GL_CLAMP_TO_EDGE:
530                 return "GL_CLAMP_TO_EDGE";
531             case GL_REPEAT:
532                 return "GL_REPEAT";
533             case GL_NEAREST:
534                 return "GL_NEAREST";
535             case GL_LINEAR:
536                 return "GL_LINEAR";
537             case GL_NEAREST_MIPMAP_NEAREST:
538                 return "GL_NEAREST_MIPMAP_NEAREST";
539             case GL_LINEAR_MIPMAP_NEAREST:
540                 return "GL_LINEAR_MIPMAP_NEAREST";
541             case GL_NEAREST_MIPMAP_LINEAR:
542                 return "GL_NEAREST_MIPMAP_LINEAR";
543             case GL_LINEAR_MIPMAP_LINEAR:
544                 return "GL_LINEAR_MIPMAP_LINEAR";
545             default:
546                 return getHex(iparam);
547             }
548         }
549         return Float.toString(param);
550     }
551 
getFogPName(int pname)552     private String getFogPName(int pname) {
553         switch (pname) {
554         case GL_FOG_DENSITY:
555             return "GL_FOG_DENSITY";
556         case GL_FOG_START:
557             return "GL_FOG_START";
558         case GL_FOG_END:
559             return "GL_FOG_END";
560         case GL_FOG_MODE:
561             return "GL_FOG_MODE";
562         case GL_FOG_COLOR:
563             return "GL_FOG_COLOR";
564         default:
565             return getHex(pname);
566         }
567     }
568 
getFogParamCount(int pname)569     private int getFogParamCount(int pname) {
570         switch (pname) {
571         case GL_FOG_DENSITY:
572             return 1;
573         case GL_FOG_START:
574             return 1;
575         case GL_FOG_END:
576             return 1;
577         case GL_FOG_MODE:
578             return 1;
579         case GL_FOG_COLOR:
580             return 4;
581         default:
582             return 0;
583         }
584     }
585 
getBeginMode(int mode)586     private String getBeginMode(int mode) {
587         switch (mode) {
588         case GL_POINTS:
589             return "GL_POINTS";
590         case GL_LINES:
591             return "GL_LINES";
592         case GL_LINE_LOOP:
593             return "GL_LINE_LOOP";
594         case GL_LINE_STRIP:
595             return "GL_LINE_STRIP";
596         case GL_TRIANGLES:
597             return "GL_TRIANGLES";
598         case GL_TRIANGLE_STRIP:
599             return "GL_TRIANGLE_STRIP";
600         case GL_TRIANGLE_FAN:
601             return "GL_TRIANGLE_FAN";
602         default:
603             return getHex(mode);
604         }
605     }
606 
getIndexType(int type)607     private String getIndexType(int type) {
608         switch (type) {
609         case GL_UNSIGNED_SHORT:
610             return "GL_UNSIGNED_SHORT";
611         case GL_UNSIGNED_BYTE:
612             return "GL_UNSIGNED_BYTE";
613         default:
614             return getHex(type);
615         }
616     }
617 
getIntegerStateName(int pname)618     private String getIntegerStateName(int pname) {
619         switch (pname) {
620         case GL_ALPHA_BITS:
621             return "GL_ALPHA_BITS";
622         case GL_ALIASED_LINE_WIDTH_RANGE:
623             return "GL_ALIASED_LINE_WIDTH_RANGE";
624         case GL_ALIASED_POINT_SIZE_RANGE:
625             return "GL_ALIASED_POINT_SIZE_RANGE";
626         case GL_BLUE_BITS:
627             return "GL_BLUE_BITS";
628         case GL_COMPRESSED_TEXTURE_FORMATS:
629             return "GL_COMPRESSED_TEXTURE_FORMATS";
630         case GL_DEPTH_BITS:
631             return "GL_DEPTH_BITS";
632         case GL_GREEN_BITS:
633             return "GL_GREEN_BITS";
634         case GL_MAX_ELEMENTS_INDICES:
635             return "GL_MAX_ELEMENTS_INDICES";
636         case GL_MAX_ELEMENTS_VERTICES:
637             return "GL_MAX_ELEMENTS_VERTICES";
638         case GL_MAX_LIGHTS:
639             return "GL_MAX_LIGHTS";
640         case GL_MAX_TEXTURE_SIZE:
641             return "GL_MAX_TEXTURE_SIZE";
642         case GL_MAX_VIEWPORT_DIMS:
643             return "GL_MAX_VIEWPORT_DIMS";
644         case GL_MAX_MODELVIEW_STACK_DEPTH:
645             return "GL_MAX_MODELVIEW_STACK_DEPTH";
646         case GL_MAX_PROJECTION_STACK_DEPTH:
647             return "GL_MAX_PROJECTION_STACK_DEPTH";
648         case GL_MAX_TEXTURE_STACK_DEPTH:
649             return "GL_MAX_TEXTURE_STACK_DEPTH";
650         case GL_MAX_TEXTURE_UNITS:
651             return "GL_MAX_TEXTURE_UNITS";
652         case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
653             return "GL_NUM_COMPRESSED_TEXTURE_FORMATS";
654         case GL_RED_BITS:
655             return "GL_RED_BITS";
656         case GL_SMOOTH_LINE_WIDTH_RANGE:
657             return "GL_SMOOTH_LINE_WIDTH_RANGE";
658         case GL_SMOOTH_POINT_SIZE_RANGE:
659             return "GL_SMOOTH_POINT_SIZE_RANGE";
660         case GL_STENCIL_BITS:
661             return "GL_STENCIL_BITS";
662         case GL_SUBPIXEL_BITS:
663             return "GL_SUBPIXEL_BITS";
664 
665         case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
666             return "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES";
667         case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
668             return "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES";
669         case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
670             return "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES";
671 
672         default:
673             return getHex(pname);
674         }
675     }
676 
getIntegerStateSize(int pname)677     private int getIntegerStateSize(int pname) {
678         switch (pname) {
679         case GL_ALPHA_BITS:
680             return 1;
681         case GL_ALIASED_LINE_WIDTH_RANGE:
682             return 2;
683         case GL_ALIASED_POINT_SIZE_RANGE:
684             return 2;
685         case GL_BLUE_BITS:
686             return 1;
687         case GL_COMPRESSED_TEXTURE_FORMATS:
688             // Have to ask the implementation for the size
689         {
690             int[] buffer = new int[1];
691             mgl.glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, buffer, 0);
692             return buffer[0];
693         }
694         case GL_DEPTH_BITS:
695             return 1;
696         case GL_GREEN_BITS:
697             return 1;
698         case GL_MAX_ELEMENTS_INDICES:
699             return 1;
700         case GL_MAX_ELEMENTS_VERTICES:
701             return 1;
702         case GL_MAX_LIGHTS:
703             return 1;
704         case GL_MAX_TEXTURE_SIZE:
705             return 1;
706         case GL_MAX_VIEWPORT_DIMS:
707             return 2;
708         case GL_MAX_MODELVIEW_STACK_DEPTH:
709             return 1;
710         case GL_MAX_PROJECTION_STACK_DEPTH:
711             return 1;
712         case GL_MAX_TEXTURE_STACK_DEPTH:
713             return 1;
714         case GL_MAX_TEXTURE_UNITS:
715             return 1;
716         case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
717             return 1;
718         case GL_RED_BITS:
719             return 1;
720         case GL_SMOOTH_LINE_WIDTH_RANGE:
721             return 2;
722         case GL_SMOOTH_POINT_SIZE_RANGE:
723             return 2;
724         case GL_STENCIL_BITS:
725             return 1;
726         case GL_SUBPIXEL_BITS:
727             return 1;
728 
729         case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
730         case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
731         case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
732             return 16;
733 
734         default:
735             return 0;
736         }
737     }
738 
getIntegerStateFormat(int pname)739     private int getIntegerStateFormat(int pname) {
740         switch (pname) {
741         case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
742         case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
743         case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
744             return FORMAT_FLOAT;
745 
746         default:
747             return FORMAT_INT;
748         }
749     }
750 
getHintTarget(int target)751     private String getHintTarget(int target) {
752         switch (target) {
753         case GL_FOG_HINT:
754             return "GL_FOG_HINT";
755         case GL_LINE_SMOOTH_HINT:
756             return "GL_LINE_SMOOTH_HINT";
757         case GL_PERSPECTIVE_CORRECTION_HINT:
758             return "GL_PERSPECTIVE_CORRECTION_HINT";
759         case GL_POINT_SMOOTH_HINT:
760             return "GL_POINT_SMOOTH_HINT";
761         case GL_POLYGON_SMOOTH_HINT:
762             return "GL_POLYGON_SMOOTH_HINT";
763         case GL_GENERATE_MIPMAP_HINT:
764             return "GL_GENERATE_MIPMAP_HINT";
765         default:
766             return getHex(target);
767         }
768     }
769 
getHintMode(int mode)770     private String getHintMode(int mode) {
771         switch (mode) {
772         case GL_FASTEST:
773             return "GL_FASTEST";
774         case GL_NICEST:
775             return "GL_NICEST";
776         case GL_DONT_CARE:
777             return "GL_DONT_CARE";
778         default:
779             return getHex(mode);
780         }
781     }
782 
getFaceName(int face)783     private String getFaceName(int face) {
784         switch (face) {
785         case GL_FRONT_AND_BACK:
786             return "GL_FRONT_AND_BACK";
787         default:
788             return getHex(face);
789         }
790     }
791 
getMaterialPName(int pname)792     private String getMaterialPName(int pname) {
793         switch (pname) {
794         case GL_AMBIENT:
795             return "GL_AMBIENT";
796         case GL_DIFFUSE:
797             return "GL_DIFFUSE";
798         case GL_SPECULAR:
799             return "GL_SPECULAR";
800         case GL_EMISSION:
801             return "GL_EMISSION";
802         case GL_SHININESS:
803             return "GL_SHININESS";
804         case GL_AMBIENT_AND_DIFFUSE:
805             return "GL_AMBIENT_AND_DIFFUSE";
806         default:
807             return getHex(pname);
808         }
809     }
810 
getMaterialParamCount(int pname)811     private int getMaterialParamCount(int pname) {
812         switch (pname) {
813         case GL_AMBIENT:
814             return 4;
815         case GL_DIFFUSE:
816             return 4;
817         case GL_SPECULAR:
818             return 4;
819         case GL_EMISSION:
820             return 4;
821         case GL_SHININESS:
822             return 1;
823         case GL_AMBIENT_AND_DIFFUSE:
824             return 4;
825         default:
826             return 0;
827         }
828     }
829 
getLightName(int light)830     private String getLightName(int light) {
831         if (light >= GL_LIGHT0 && light <= GL_LIGHT7) {
832             return "GL_LIGHT" + Integer.toString(light);
833         }
834         return getHex(light);
835     }
836 
getLightPName(int pname)837     private String getLightPName(int pname) {
838         switch (pname) {
839         case GL_AMBIENT:
840             return "GL_AMBIENT";
841         case GL_DIFFUSE:
842             return "GL_DIFFUSE";
843         case GL_SPECULAR:
844             return "GL_SPECULAR";
845         case GL_POSITION:
846             return "GL_POSITION";
847         case GL_SPOT_DIRECTION:
848             return "GL_SPOT_DIRECTION";
849         case GL_SPOT_EXPONENT:
850             return "GL_SPOT_EXPONENT";
851         case GL_SPOT_CUTOFF:
852             return "GL_SPOT_CUTOFF";
853         case GL_CONSTANT_ATTENUATION:
854             return "GL_CONSTANT_ATTENUATION";
855         case GL_LINEAR_ATTENUATION:
856             return "GL_LINEAR_ATTENUATION";
857         case GL_QUADRATIC_ATTENUATION:
858             return "GL_QUADRATIC_ATTENUATION";
859         default:
860             return getHex(pname);
861         }
862     }
863 
getLightParamCount(int pname)864     private int getLightParamCount(int pname) {
865         switch (pname) {
866         case GL_AMBIENT:
867             return 4;
868         case GL_DIFFUSE:
869             return 4;
870         case GL_SPECULAR:
871             return 4;
872         case GL_POSITION:
873             return 4;
874         case GL_SPOT_DIRECTION:
875             return 3;
876         case GL_SPOT_EXPONENT:
877             return 1;
878         case GL_SPOT_CUTOFF:
879             return 1;
880         case GL_CONSTANT_ATTENUATION:
881             return 1;
882         case GL_LINEAR_ATTENUATION:
883             return 1;
884         case GL_QUADRATIC_ATTENUATION:
885             return 1;
886         default:
887             return 0;
888         }
889     }
890 
getLightModelPName(int pname)891     private String getLightModelPName(int pname) {
892         switch (pname) {
893         case GL_LIGHT_MODEL_AMBIENT:
894             return "GL_LIGHT_MODEL_AMBIENT";
895         case GL_LIGHT_MODEL_TWO_SIDE:
896             return "GL_LIGHT_MODEL_TWO_SIDE";
897         default:
898             return getHex(pname);
899         }
900     }
901 
getLightModelParamCount(int pname)902     private int getLightModelParamCount(int pname) {
903         switch (pname) {
904         case GL_LIGHT_MODEL_AMBIENT:
905             return 4;
906         case GL_LIGHT_MODEL_TWO_SIDE:
907             return 1;
908         default:
909             return 0;
910         }
911     }
912 
getPointerTypeName(int type)913     private String getPointerTypeName(int type) {
914         switch (type) {
915         case GL_BYTE:
916             return "GL_BYTE";
917         case GL_UNSIGNED_BYTE:
918             return "GL_UNSIGNED_BYTE";
919         case GL_SHORT:
920             return "GL_SHORT";
921         case GL_FIXED:
922             return "GL_FIXED";
923         case GL_FLOAT:
924             return "GL_FLOAT";
925         default:
926             return getHex(type);
927         }
928     }
929 
toByteBuffer(int byteCount, Buffer input)930     private ByteBuffer toByteBuffer(int byteCount, Buffer input) {
931         ByteBuffer result = null;
932         boolean convertWholeBuffer = (byteCount < 0);
933         if (input instanceof ByteBuffer) {
934             ByteBuffer input2 = (ByteBuffer) input;
935             int position = input2.position();
936             if (convertWholeBuffer) {
937                 byteCount = input2.limit() - position;
938             }
939             result = ByteBuffer.allocate(byteCount).order(input2.order());
940             for (int i = 0; i < byteCount; i++) {
941                 result.put(input2.get());
942             }
943             input2.position(position);
944         } else if (input instanceof CharBuffer) {
945             CharBuffer input2 = (CharBuffer) input;
946             int position = input2.position();
947             if (convertWholeBuffer) {
948                 byteCount = (input2.limit() - position) * 2;
949             }
950             result = ByteBuffer.allocate(byteCount).order(input2.order());
951             CharBuffer result2 = result.asCharBuffer();
952             for (int i = 0; i < byteCount / 2; i++) {
953                 result2.put(input2.get());
954             }
955             input2.position(position);
956         } else if (input instanceof ShortBuffer) {
957             ShortBuffer input2 = (ShortBuffer) input;
958             int position = input2.position();
959             if (convertWholeBuffer) {
960                 byteCount = (input2.limit() - position)* 2;
961             }
962             result = ByteBuffer.allocate(byteCount).order(input2.order());
963             ShortBuffer result2 = result.asShortBuffer();
964             for (int i = 0; i < byteCount / 2; i++) {
965                 result2.put(input2.get());
966             }
967             input2.position(position);
968         } else if (input instanceof IntBuffer) {
969             IntBuffer input2 = (IntBuffer) input;
970             int position = input2.position();
971             if (convertWholeBuffer) {
972                 byteCount = (input2.limit() - position) * 4;
973             }
974             result = ByteBuffer.allocate(byteCount).order(input2.order());
975             IntBuffer result2 = result.asIntBuffer();
976             for (int i = 0; i < byteCount / 4; i++) {
977                 result2.put(input2.get());
978             }
979             input2.position(position);
980         } else if (input instanceof FloatBuffer) {
981             FloatBuffer input2 = (FloatBuffer) input;
982             int position = input2.position();
983             if (convertWholeBuffer) {
984                 byteCount = (input2.limit() - position) * 4;
985             }
986             result = ByteBuffer.allocate(byteCount).order(input2.order());
987             FloatBuffer result2 = result.asFloatBuffer();
988             for (int i = 0; i < byteCount / 4; i++) {
989                 result2.put(input2.get());
990             }
991             input2.position(position);
992         } else if (input instanceof DoubleBuffer) {
993             DoubleBuffer input2 = (DoubleBuffer) input;
994             int position = input2.position();
995             if (convertWholeBuffer) {
996                 byteCount = (input2.limit() - position) * 8;
997             }
998             result = ByteBuffer.allocate(byteCount).order(input2.order());
999             DoubleBuffer result2 = result.asDoubleBuffer();
1000             for (int i = 0; i < byteCount / 8; i++) {
1001                 result2.put(input2.get());
1002             }
1003             input2.position(position);
1004         } else if (input instanceof LongBuffer) {
1005             LongBuffer input2 = (LongBuffer) input;
1006             int position = input2.position();
1007             if (convertWholeBuffer) {
1008                 byteCount = (input2.limit() - position) * 8;
1009             }
1010             result = ByteBuffer.allocate(byteCount).order(input2.order());
1011             LongBuffer result2 = result.asLongBuffer();
1012             for (int i = 0; i < byteCount / 8; i++) {
1013                 result2.put(input2.get());
1014             }
1015             input2.position(position);
1016         } else {
1017             throw new RuntimeException("Unimplemented Buffer subclass.");
1018         }
1019         result.rewind();
1020         // The OpenGL API will interpret the result in hardware byte order,
1021         // so we better do that as well:
1022         result.order(ByteOrder.nativeOrder());
1023         return result;
1024     }
1025 
toCharIndices(int count, int type, Buffer indices)1026     private char[] toCharIndices(int count, int type, Buffer indices) {
1027         char[] result = new char[count];
1028         switch (type) {
1029         case GL_UNSIGNED_BYTE: {
1030             ByteBuffer byteBuffer = toByteBuffer(count, indices);
1031             byte[] array = byteBuffer.array();
1032             int offset = byteBuffer.arrayOffset();
1033             for (int i = 0; i < count; i++) {
1034                 result[i] = (char) (0xff & array[offset + i]);
1035             }
1036         }
1037             break;
1038         case GL_UNSIGNED_SHORT: {
1039             CharBuffer charBuffer;
1040             if (indices instanceof CharBuffer) {
1041                 charBuffer = (CharBuffer) indices;
1042             } else {
1043                 ByteBuffer byteBuffer = toByteBuffer(count * 2, indices);
1044                 charBuffer = byteBuffer.asCharBuffer();
1045             }
1046             int oldPosition = charBuffer.position();
1047             charBuffer.position(0);
1048             charBuffer.get(result);
1049             charBuffer.position(oldPosition);
1050         }
1051             break;
1052         default:
1053             // Don't throw an exception, because we don't want logging to
1054             // change the behavior.
1055             break;
1056         }
1057         return result;
1058     }
1059 
doArrayElement(StringBuilder builder, boolean enabled, String name, PointerInfo pointer, int index)1060     private void doArrayElement(StringBuilder builder, boolean enabled,
1061             String name, PointerInfo pointer, int index) {
1062         if (!enabled) {
1063             return;
1064         }
1065         builder.append(" ");
1066         builder.append(name + ":{");
1067         if (pointer == null || pointer.mTempByteBuffer == null ) {
1068             builder.append("undefined }");
1069             return;
1070         }
1071         if (pointer.mStride < 0) {
1072             builder.append("invalid stride");
1073             return;
1074         }
1075 
1076         int stride = pointer.getStride();
1077         ByteBuffer byteBuffer = pointer.mTempByteBuffer;
1078         int size = pointer.mSize;
1079         int type = pointer.mType;
1080         int sizeofType = pointer.sizeof(type);
1081         int byteOffset = stride * index;
1082         for (int i = 0; i < size; i++) {
1083             if (i > 0) {
1084                 builder.append(", ");
1085             }
1086             switch (type) {
1087             case GL_BYTE: {
1088                 byte d = byteBuffer.get(byteOffset);
1089                 builder.append(Integer.toString(d));
1090             }
1091                 break;
1092             case GL_UNSIGNED_BYTE: {
1093                 byte d = byteBuffer.get(byteOffset);
1094                 builder.append(Integer.toString(0xff & d));
1095             }
1096                 break;
1097             case GL_SHORT: {
1098                 ShortBuffer shortBuffer = byteBuffer.asShortBuffer();
1099                 short d = shortBuffer.get(byteOffset / 2);
1100                 builder.append(Integer.toString(d));
1101             }
1102                 break;
1103             case GL_FIXED: {
1104                 IntBuffer intBuffer = byteBuffer.asIntBuffer();
1105                 int d = intBuffer.get(byteOffset / 4);
1106                 builder.append(Integer.toString(d));
1107             }
1108                 break;
1109             case GL_FLOAT: {
1110                 FloatBuffer intBuffer = byteBuffer.asFloatBuffer();
1111                 float d = intBuffer.get(byteOffset / 4);
1112                 builder.append(Float.toString(d));
1113             }
1114                 break;
1115             default:
1116                 builder.append("?");
1117                 break;
1118             }
1119             byteOffset += sizeofType;
1120         }
1121         builder.append("}");
1122     }
1123 
doElement(StringBuilder builder, int ordinal, int vertexIndex)1124     private void doElement(StringBuilder builder, int ordinal, int vertexIndex) {
1125         builder.append(" [" + ordinal + " : " + vertexIndex + "] =");
1126         doArrayElement(builder, mVertexArrayEnabled, "v", mVertexPointer,
1127                 vertexIndex);
1128         doArrayElement(builder, mNormalArrayEnabled, "n", mNormalPointer,
1129                 vertexIndex);
1130         doArrayElement(builder, mColorArrayEnabled, "c", mColorPointer,
1131                 vertexIndex);
1132         doArrayElement(builder, mTextureCoordArrayEnabled, "t",
1133                 mTexCoordPointer, vertexIndex);
1134         builder.append("\n");
1135         // Vertex
1136         // Normal
1137         // Color
1138         // TexCoord
1139     }
1140 
bindArrays()1141     private void bindArrays() {
1142         if (mColorArrayEnabled)
1143             mColorPointer.bindByteBuffer();
1144         if (mNormalArrayEnabled)
1145             mNormalPointer.bindByteBuffer();
1146         if (mTextureCoordArrayEnabled)
1147             mTexCoordPointer.bindByteBuffer();
1148         if (mVertexArrayEnabled)
1149             mVertexPointer.bindByteBuffer();
1150     }
1151 
unbindArrays()1152     private void unbindArrays() {
1153         if (mColorArrayEnabled)
1154             mColorPointer.unbindByteBuffer();
1155         if (mNormalArrayEnabled)
1156             mNormalPointer.unbindByteBuffer();
1157         if (mTextureCoordArrayEnabled)
1158             mTexCoordPointer.unbindByteBuffer();
1159         if (mVertexArrayEnabled)
1160             mVertexPointer.unbindByteBuffer();
1161     }
1162 
startLogIndices()1163     private void startLogIndices() {
1164         mStringBuilder = new StringBuilder();
1165         mStringBuilder.append("\n");
1166         bindArrays();
1167     }
1168 
endLogIndices()1169     private void endLogIndices() {
1170         log(mStringBuilder.toString());
1171         unbindArrays();
1172     }
1173 
1174     // ---------------------------------------------------------------------
1175     // GL10 methods:
1176 
glActiveTexture(int texture)1177     public void glActiveTexture(int texture) {
1178         begin("glActiveTexture");
1179         arg("texture", texture);
1180         end();
1181         mgl.glActiveTexture(texture);
1182         checkError();
1183     }
1184 
glAlphaFunc(int func, float ref)1185     public void glAlphaFunc(int func, float ref) {
1186         begin("glAlphaFunc");
1187         arg("func", func);
1188         arg("ref", ref);
1189         end();
1190         mgl.glAlphaFunc(func, ref);
1191         checkError();
1192     }
1193 
glAlphaFuncx(int func, int ref)1194     public void glAlphaFuncx(int func, int ref) {
1195         begin("glAlphaFuncx");
1196         arg("func", func);
1197         arg("ref", ref);
1198         end();
1199         mgl.glAlphaFuncx(func, ref);
1200         checkError();
1201     }
1202 
glBindTexture(int target, int texture)1203     public void glBindTexture(int target, int texture) {
1204         begin("glBindTexture");
1205         arg("target", getTextureTarget(target));
1206         arg("texture", texture);
1207         end();
1208         mgl.glBindTexture(target, texture);
1209         checkError();
1210     }
1211 
glBlendFunc(int sfactor, int dfactor)1212     public void glBlendFunc(int sfactor, int dfactor) {
1213         begin("glBlendFunc");
1214         arg("sfactor", getFactor(sfactor));
1215         arg("dfactor", getFactor(dfactor));
1216         end();
1217 
1218         mgl.glBlendFunc(sfactor, dfactor);
1219         checkError();
1220     }
1221 
glClear(int mask)1222     public void glClear(int mask) {
1223         begin("glClear");
1224         arg("mask", getClearBufferMask(mask));
1225         end();
1226 
1227         mgl.glClear(mask);
1228         checkError();
1229     }
1230 
glClearColor(float red, float green, float blue, float alpha)1231     public void glClearColor(float red, float green, float blue, float alpha) {
1232         begin("glClearColor");
1233         arg("red", red);
1234         arg("green", green);
1235         arg("blue", blue);
1236         arg("alpha", alpha);
1237         end();
1238 
1239         mgl.glClearColor(red, green, blue, alpha);
1240         checkError();
1241     }
1242 
glClearColorx(int red, int green, int blue, int alpha)1243     public void glClearColorx(int red, int green, int blue, int alpha) {
1244         begin("glClearColor");
1245         arg("red", red);
1246         arg("green", green);
1247         arg("blue", blue);
1248         arg("alpha", alpha);
1249         end();
1250 
1251         mgl.glClearColorx(red, green, blue, alpha);
1252         checkError();
1253     }
1254 
glClearDepthf(float depth)1255     public void glClearDepthf(float depth) {
1256         begin("glClearDepthf");
1257         arg("depth", depth);
1258         end();
1259 
1260         mgl.glClearDepthf(depth);
1261         checkError();
1262     }
1263 
glClearDepthx(int depth)1264     public void glClearDepthx(int depth) {
1265         begin("glClearDepthx");
1266         arg("depth", depth);
1267         end();
1268 
1269         mgl.glClearDepthx(depth);
1270         checkError();
1271     }
1272 
glClearStencil(int s)1273     public void glClearStencil(int s) {
1274         begin("glClearStencil");
1275         arg("s", s);
1276         end();
1277 
1278         mgl.glClearStencil(s);
1279         checkError();
1280     }
1281 
glClientActiveTexture(int texture)1282     public void glClientActiveTexture(int texture) {
1283         begin("glClientActiveTexture");
1284         arg("texture", texture);
1285         end();
1286 
1287         mgl.glClientActiveTexture(texture);
1288         checkError();
1289     }
1290 
glColor4f(float red, float green, float blue, float alpha)1291     public void glColor4f(float red, float green, float blue, float alpha) {
1292         begin("glColor4f");
1293         arg("red", red);
1294         arg("green", green);
1295         arg("blue", blue);
1296         arg("alpha", alpha);
1297         end();
1298 
1299         mgl.glColor4f(red, green, blue, alpha);
1300         checkError();
1301     }
1302 
glColor4x(int red, int green, int blue, int alpha)1303     public void glColor4x(int red, int green, int blue, int alpha) {
1304         begin("glColor4x");
1305         arg("red", red);
1306         arg("green", green);
1307         arg("blue", blue);
1308         arg("alpha", alpha);
1309         end();
1310 
1311         mgl.glColor4x(red, green, blue, alpha);
1312         checkError();
1313     }
1314 
glColorMask(boolean red, boolean green, boolean blue, boolean alpha)1315     public void glColorMask(boolean red, boolean green, boolean blue,
1316             boolean alpha) {
1317         begin("glColorMask");
1318         arg("red", red);
1319         arg("green", green);
1320         arg("blue", blue);
1321         arg("alpha", alpha);
1322         end();
1323 
1324         mgl.glColorMask(red, green, blue, alpha);
1325         checkError();
1326     }
1327 
glColorPointer(int size, int type, int stride, Buffer pointer)1328     public void glColorPointer(int size, int type, int stride, Buffer pointer) {
1329         begin("glColorPointer");
1330         argPointer(size, type, stride, pointer);
1331         end();
1332         mColorPointer = new PointerInfo(size, type, stride, pointer);
1333 
1334         mgl.glColorPointer(size, type, stride, pointer);
1335         checkError();
1336     }
1337 
glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer data)1338     public void glCompressedTexImage2D(int target, int level,
1339             int internalformat, int width, int height, int border,
1340             int imageSize, Buffer data) {
1341         begin("glCompressedTexImage2D");
1342         arg("target", getTextureTarget(target));
1343         arg("level", level);
1344         arg("internalformat", internalformat);
1345         arg("width", width);
1346         arg("height", height);
1347         arg("border", border);
1348         arg("imageSize", imageSize);
1349         arg("data", data.toString());
1350         end();
1351 
1352         mgl.glCompressedTexImage2D(target, level, internalformat, width,
1353                 height, border, imageSize, data);
1354         checkError();
1355     }
1356 
glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, Buffer data)1357     public void glCompressedTexSubImage2D(int target, int level, int xoffset,
1358             int yoffset, int width, int height, int format, int imageSize,
1359             Buffer data) {
1360         begin("glCompressedTexSubImage2D");
1361         arg("target", getTextureTarget(target));
1362         arg("level", level);
1363         arg("xoffset", xoffset);
1364         arg("yoffset", yoffset);
1365         arg("width", width);
1366         arg("height", height);
1367         arg("format", format);
1368         arg("imageSize", imageSize);
1369         arg("data", data.toString());
1370         end();
1371 
1372         mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width,
1373                 height, format, imageSize, data);
1374         checkError();
1375     }
1376 
glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height, int border)1377     public void glCopyTexImage2D(int target, int level, int internalformat,
1378             int x, int y, int width, int height, int border) {
1379         begin("glCopyTexImage2D");
1380         arg("target", getTextureTarget(target));
1381         arg("level", level);
1382         arg("internalformat", internalformat);
1383         arg("x", x);
1384         arg("y", y);
1385         arg("width", width);
1386         arg("height", height);
1387         arg("border", border);
1388         end();
1389 
1390         mgl.glCopyTexImage2D(target, level, internalformat, x, y, width,
1391                 height, border);
1392         checkError();
1393     }
1394 
glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height)1395     public void glCopyTexSubImage2D(int target, int level, int xoffset,
1396             int yoffset, int x, int y, int width, int height) {
1397         begin("glCopyTexSubImage2D");
1398         arg("target", getTextureTarget(target));
1399         arg("level", level);
1400         arg("xoffset", xoffset);
1401         arg("yoffset", yoffset);
1402         arg("x", x);
1403         arg("y", y);
1404         arg("width", width);
1405         arg("height", height);
1406         end();
1407 
1408         mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
1409                 height);
1410         checkError();
1411     }
1412 
glCullFace(int mode)1413     public void glCullFace(int mode) {
1414         begin("glCullFace");
1415         arg("mode", mode);
1416         end();
1417 
1418         mgl.glCullFace(mode);
1419         checkError();
1420     }
1421 
glDeleteTextures(int n, int[] textures, int offset)1422     public void glDeleteTextures(int n, int[] textures, int offset) {
1423         begin("glDeleteTextures");
1424         arg("n", n);
1425         arg("textures", n, textures, offset);
1426         arg("offset", offset);
1427         end();
1428 
1429         mgl.glDeleteTextures(n, textures, offset);
1430         checkError();
1431     }
1432 
glDeleteTextures(int n, IntBuffer textures)1433     public void glDeleteTextures(int n, IntBuffer textures) {
1434         begin("glDeleteTextures");
1435         arg("n", n);
1436         arg("textures", n, textures);
1437         end();
1438 
1439         mgl.glDeleteTextures(n, textures);
1440         checkError();
1441     }
1442 
glDepthFunc(int func)1443     public void glDepthFunc(int func) {
1444         begin("glDepthFunc");
1445         arg("func", func);
1446         end();
1447 
1448         mgl.glDepthFunc(func);
1449         checkError();
1450     }
1451 
glDepthMask(boolean flag)1452     public void glDepthMask(boolean flag) {
1453         begin("glDepthMask");
1454         arg("flag", flag);
1455         end();
1456 
1457         mgl.glDepthMask(flag);
1458         checkError();
1459     }
1460 
glDepthRangef(float near, float far)1461     public void glDepthRangef(float near, float far) {
1462         begin("glDepthRangef");
1463         arg("near", near);
1464         arg("far", far);
1465         end();
1466 
1467         mgl.glDepthRangef(near, far);
1468         checkError();
1469     }
1470 
glDepthRangex(int near, int far)1471     public void glDepthRangex(int near, int far) {
1472         begin("glDepthRangex");
1473         arg("near", near);
1474         arg("far", far);
1475         end();
1476 
1477         mgl.glDepthRangex(near, far);
1478         checkError();
1479     }
1480 
glDisable(int cap)1481     public void glDisable(int cap) {
1482         begin("glDisable");
1483         arg("cap", getCap(cap));
1484         end();
1485 
1486         mgl.glDisable(cap);
1487         checkError();
1488     }
1489 
glDisableClientState(int array)1490     public void glDisableClientState(int array) {
1491         begin("glDisableClientState");
1492         arg("array", getClientState(array));
1493         end();
1494 
1495         switch (array) {
1496         case GL_COLOR_ARRAY:
1497             mColorArrayEnabled = false;
1498             break;
1499         case GL_NORMAL_ARRAY:
1500             mNormalArrayEnabled = false;
1501             break;
1502         case GL_TEXTURE_COORD_ARRAY:
1503             mTextureCoordArrayEnabled = false;
1504             break;
1505         case GL_VERTEX_ARRAY:
1506             mVertexArrayEnabled = false;
1507             break;
1508         }
1509         mgl.glDisableClientState(array);
1510         checkError();
1511     }
1512 
glDrawArrays(int mode, int first, int count)1513     public void glDrawArrays(int mode, int first, int count) {
1514         begin("glDrawArrays");
1515         arg("mode", mode);
1516         arg("first", first);
1517         arg("count", count);
1518         startLogIndices();
1519         for (int i = 0; i < count; i++) {
1520             doElement(mStringBuilder, i, first + i);
1521         }
1522         endLogIndices();
1523         end();
1524 
1525         mgl.glDrawArrays(mode, first, count);
1526         checkError();
1527     }
1528 
glDrawElements(int mode, int count, int type, Buffer indices)1529     public void glDrawElements(int mode, int count, int type, Buffer indices) {
1530         begin("glDrawElements");
1531         arg("mode", getBeginMode(mode));
1532         arg("count", count);
1533         arg("type", getIndexType(type));
1534         char[] indexArray = toCharIndices(count, type, indices);
1535         int indexArrayLength = indexArray.length;
1536         startLogIndices();
1537         for (int i = 0; i < indexArrayLength; i++) {
1538             doElement(mStringBuilder, i, indexArray[i]);
1539         }
1540         endLogIndices();
1541         end();
1542 
1543         mgl.glDrawElements(mode, count, type, indices);
1544         checkError();
1545     }
1546 
glEnable(int cap)1547     public void glEnable(int cap) {
1548         begin("glEnable");
1549         arg("cap", getCap(cap));
1550         end();
1551 
1552         mgl.glEnable(cap);
1553         checkError();
1554     }
1555 
glEnableClientState(int array)1556     public void glEnableClientState(int array) {
1557         begin("glEnableClientState");
1558         arg("array", getClientState(array));
1559         end();
1560 
1561         switch (array) {
1562         case GL_COLOR_ARRAY:
1563             mColorArrayEnabled = true;
1564             break;
1565         case GL_NORMAL_ARRAY:
1566             mNormalArrayEnabled = true;
1567             break;
1568         case GL_TEXTURE_COORD_ARRAY:
1569             mTextureCoordArrayEnabled = true;
1570             break;
1571         case GL_VERTEX_ARRAY:
1572             mVertexArrayEnabled = true;
1573             break;
1574         }
1575         mgl.glEnableClientState(array);
1576         checkError();
1577     }
1578 
glFinish()1579     public void glFinish() {
1580         begin("glFinish");
1581         end();
1582 
1583         mgl.glFinish();
1584         checkError();
1585     }
1586 
glFlush()1587     public void glFlush() {
1588         begin("glFlush");
1589         end();
1590 
1591         mgl.glFlush();
1592         checkError();
1593     }
1594 
glFogf(int pname, float param)1595     public void glFogf(int pname, float param) {
1596         begin("glFogf");
1597         arg("pname", pname);
1598         arg("param", param);
1599         end();
1600 
1601         mgl.glFogf(pname, param);
1602         checkError();
1603     }
1604 
glFogfv(int pname, float[] params, int offset)1605     public void glFogfv(int pname, float[] params, int offset) {
1606         begin("glFogfv");
1607         arg("pname", getFogPName(pname));
1608         arg("params", getFogParamCount(pname), params, offset);
1609         arg("offset", offset);
1610         end();
1611 
1612         mgl.glFogfv(pname, params, offset);
1613         checkError();
1614     }
1615 
glFogfv(int pname, FloatBuffer params)1616     public void glFogfv(int pname, FloatBuffer params) {
1617         begin("glFogfv");
1618         arg("pname", getFogPName(pname));
1619         arg("params", getFogParamCount(pname), params);
1620         end();
1621 
1622         mgl.glFogfv(pname, params);
1623         checkError();
1624     }
1625 
glFogx(int pname, int param)1626     public void glFogx(int pname, int param) {
1627         begin("glFogx");
1628         arg("pname", getFogPName(pname));
1629         arg("param", param);
1630         end();
1631 
1632         mgl.glFogx(pname, param);
1633         checkError();
1634     }
1635 
glFogxv(int pname, int[] params, int offset)1636     public void glFogxv(int pname, int[] params, int offset) {
1637         begin("glFogxv");
1638         arg("pname", getFogPName(pname));
1639         arg("params", getFogParamCount(pname), params, offset);
1640         arg("offset", offset);
1641         end();
1642 
1643         mgl.glFogxv(pname, params, offset);
1644         checkError();
1645     }
1646 
glFogxv(int pname, IntBuffer params)1647     public void glFogxv(int pname, IntBuffer params) {
1648         begin("glFogxv");
1649         arg("pname", getFogPName(pname));
1650         arg("params", getFogParamCount(pname), params);
1651         end();
1652 
1653         mgl.glFogxv(pname, params);
1654         checkError();
1655     }
1656 
glFrontFace(int mode)1657     public void glFrontFace(int mode) {
1658         begin("glFrontFace");
1659         arg("mode", mode);
1660         end();
1661 
1662         mgl.glFrontFace(mode);
1663         checkError();
1664     }
1665 
glFrustumf(float left, float right, float bottom, float top, float near, float far)1666     public void glFrustumf(float left, float right, float bottom, float top,
1667             float near, float far) {
1668         begin("glFrustumf");
1669         arg("left", left);
1670         arg("right", right);
1671         arg("bottom", bottom);
1672         arg("top", top);
1673         arg("near", near);
1674         arg("far", far);
1675         end();
1676 
1677         mgl.glFrustumf(left, right, bottom, top, near, far);
1678         checkError();
1679     }
1680 
glFrustumx(int left, int right, int bottom, int top, int near, int far)1681     public void glFrustumx(int left, int right, int bottom, int top, int near,
1682             int far) {
1683         begin("glFrustumx");
1684         arg("left", left);
1685         arg("right", right);
1686         arg("bottom", bottom);
1687         arg("top", top);
1688         arg("near", near);
1689         arg("far", far);
1690         end();
1691 
1692         mgl.glFrustumx(left, right, bottom, top, near, far);
1693         checkError();
1694     }
1695 
glGenTextures(int n, int[] textures, int offset)1696     public void glGenTextures(int n, int[] textures, int offset) {
1697         begin("glGenTextures");
1698         arg("n", n);
1699         arg("textures", Arrays.toString(textures));
1700         arg("offset", offset);
1701 
1702         mgl.glGenTextures(n, textures, offset);
1703 
1704         returns(toString(n, FORMAT_INT, textures, offset));
1705 
1706         checkError();
1707     }
1708 
glGenTextures(int n, IntBuffer textures)1709     public void glGenTextures(int n, IntBuffer textures) {
1710         begin("glGenTextures");
1711         arg("n", n);
1712         arg("textures", textures.toString());
1713 
1714         mgl.glGenTextures(n, textures);
1715 
1716         returns(toString(n, FORMAT_INT, textures));
1717 
1718         checkError();
1719     }
1720 
glGetError()1721     public int glGetError() {
1722         begin("glGetError");
1723 
1724         int result = mgl.glGetError();
1725 
1726         returns(result);
1727 
1728         return result;
1729     }
1730 
glGetIntegerv(int pname, int[] params, int offset)1731     public void glGetIntegerv(int pname, int[] params, int offset) {
1732         begin("glGetIntegerv");
1733         arg("pname", getIntegerStateName(pname));
1734         arg("params", Arrays.toString(params));
1735         arg("offset", offset);
1736 
1737         mgl.glGetIntegerv(pname, params, offset);
1738 
1739         returns(toString(getIntegerStateSize(pname),
1740                 getIntegerStateFormat(pname), params, offset));
1741 
1742         checkError();
1743     }
1744 
glGetIntegerv(int pname, IntBuffer params)1745     public void glGetIntegerv(int pname, IntBuffer params) {
1746         begin("glGetIntegerv");
1747         arg("pname", getIntegerStateName(pname));
1748         arg("params", params.toString());
1749 
1750         mgl.glGetIntegerv(pname, params);
1751 
1752         returns(toString(getIntegerStateSize(pname),
1753                 getIntegerStateFormat(pname), params));
1754 
1755         checkError();
1756     }
1757 
glGetString(int name)1758     public String glGetString(int name) {
1759         begin("glGetString");
1760         arg("name", name);
1761 
1762         String result = mgl.glGetString(name);
1763 
1764         returns(result);
1765 
1766         checkError();
1767         return result;
1768     }
1769 
glHint(int target, int mode)1770     public void glHint(int target, int mode) {
1771         begin("glHint");
1772         arg("target", getHintTarget(target));
1773         arg("mode", getHintMode(mode));
1774         end();
1775 
1776         mgl.glHint(target, mode);
1777         checkError();
1778     }
1779 
glLightModelf(int pname, float param)1780     public void glLightModelf(int pname, float param) {
1781         begin("glLightModelf");
1782         arg("pname", getLightModelPName(pname));
1783         arg("param", param);
1784         end();
1785 
1786         mgl.glLightModelf(pname, param);
1787         checkError();
1788     }
1789 
glLightModelfv(int pname, float[] params, int offset)1790     public void glLightModelfv(int pname, float[] params, int offset) {
1791         begin("glLightModelfv");
1792         arg("pname", getLightModelPName(pname));
1793         arg("params", getLightModelParamCount(pname), params, offset);
1794         arg("offset", offset);
1795         end();
1796 
1797         mgl.glLightModelfv(pname, params, offset);
1798         checkError();
1799     }
1800 
glLightModelfv(int pname, FloatBuffer params)1801     public void glLightModelfv(int pname, FloatBuffer params) {
1802         begin("glLightModelfv");
1803         arg("pname", getLightModelPName(pname));
1804         arg("params", getLightModelParamCount(pname), params);
1805         end();
1806 
1807         mgl.glLightModelfv(pname, params);
1808         checkError();
1809     }
1810 
glLightModelx(int pname, int param)1811     public void glLightModelx(int pname, int param) {
1812         begin("glLightModelx");
1813         arg("pname", getLightModelPName(pname));
1814         arg("param", param);
1815         end();
1816 
1817         mgl.glLightModelx(pname, param);
1818         checkError();
1819     }
1820 
glLightModelxv(int pname, int[] params, int offset)1821     public void glLightModelxv(int pname, int[] params, int offset) {
1822         begin("glLightModelxv");
1823         arg("pname", getLightModelPName(pname));
1824         arg("params", getLightModelParamCount(pname), params, offset);
1825         arg("offset", offset);
1826         end();
1827 
1828         mgl.glLightModelxv(pname, params, offset);
1829         checkError();
1830     }
1831 
glLightModelxv(int pname, IntBuffer params)1832     public void glLightModelxv(int pname, IntBuffer params) {
1833         begin("glLightModelfv");
1834         arg("pname", getLightModelPName(pname));
1835         arg("params", getLightModelParamCount(pname), params);
1836         end();
1837 
1838         mgl.glLightModelxv(pname, params);
1839         checkError();
1840     }
1841 
glLightf(int light, int pname, float param)1842     public void glLightf(int light, int pname, float param) {
1843         begin("glLightf");
1844         arg("light", getLightName(light));
1845         arg("pname", getLightPName(pname));
1846         arg("param", param);
1847         end();
1848 
1849         mgl.glLightf(light, pname, param);
1850         checkError();
1851     }
1852 
glLightfv(int light, int pname, float[] params, int offset)1853     public void glLightfv(int light, int pname, float[] params, int offset) {
1854         begin("glLightfv");
1855         arg("light", getLightName(light));
1856         arg("pname", getLightPName(pname));
1857         arg("params", getLightParamCount(pname), params, offset);
1858         arg("offset", offset);
1859         end();
1860 
1861         mgl.glLightfv(light, pname, params, offset);
1862         checkError();
1863     }
1864 
glLightfv(int light, int pname, FloatBuffer params)1865     public void glLightfv(int light, int pname, FloatBuffer params) {
1866         begin("glLightfv");
1867         arg("light", getLightName(light));
1868         arg("pname", getLightPName(pname));
1869         arg("params", getLightParamCount(pname), params);
1870         end();
1871 
1872         mgl.glLightfv(light, pname, params);
1873         checkError();
1874     }
1875 
glLightx(int light, int pname, int param)1876     public void glLightx(int light, int pname, int param) {
1877         begin("glLightx");
1878         arg("light", getLightName(light));
1879         arg("pname", getLightPName(pname));
1880         arg("param", param);
1881         end();
1882 
1883         mgl.glLightx(light, pname, param);
1884         checkError();
1885     }
1886 
glLightxv(int light, int pname, int[] params, int offset)1887     public void glLightxv(int light, int pname, int[] params, int offset) {
1888         begin("glLightxv");
1889         arg("light", getLightName(light));
1890         arg("pname", getLightPName(pname));
1891         arg("params", getLightParamCount(pname), params, offset);
1892         arg("offset", offset);
1893         end();
1894 
1895         mgl.glLightxv(light, pname, params, offset);
1896         checkError();
1897     }
1898 
glLightxv(int light, int pname, IntBuffer params)1899     public void glLightxv(int light, int pname, IntBuffer params) {
1900         begin("glLightxv");
1901         arg("light", getLightName(light));
1902         arg("pname", getLightPName(pname));
1903         arg("params", getLightParamCount(pname), params);
1904         end();
1905 
1906         mgl.glLightxv(light, pname, params);
1907         checkError();
1908     }
1909 
glLineWidth(float width)1910     public void glLineWidth(float width) {
1911         begin("glLineWidth");
1912         arg("width", width);
1913         end();
1914 
1915         mgl.glLineWidth(width);
1916         checkError();
1917     }
1918 
glLineWidthx(int width)1919     public void glLineWidthx(int width) {
1920         begin("glLineWidthx");
1921         arg("width", width);
1922         end();
1923 
1924         mgl.glLineWidthx(width);
1925         checkError();
1926     }
1927 
glLoadIdentity()1928     public void glLoadIdentity() {
1929         begin("glLoadIdentity");
1930         end();
1931 
1932         mgl.glLoadIdentity();
1933         checkError();
1934     }
1935 
glLoadMatrixf(float[] m, int offset)1936     public void glLoadMatrixf(float[] m, int offset) {
1937         begin("glLoadMatrixf");
1938         arg("m", 16, m, offset);
1939         arg("offset", offset);
1940         end();
1941 
1942         mgl.glLoadMatrixf(m, offset);
1943         checkError();
1944     }
1945 
glLoadMatrixf(FloatBuffer m)1946     public void glLoadMatrixf(FloatBuffer m) {
1947         begin("glLoadMatrixf");
1948         arg("m", 16, m);
1949         end();
1950 
1951         mgl.glLoadMatrixf(m);
1952         checkError();
1953     }
1954 
glLoadMatrixx(int[] m, int offset)1955     public void glLoadMatrixx(int[] m, int offset) {
1956         begin("glLoadMatrixx");
1957         arg("m", 16, m, offset);
1958         arg("offset", offset);
1959         end();
1960 
1961         mgl.glLoadMatrixx(m, offset);
1962         checkError();
1963     }
1964 
glLoadMatrixx(IntBuffer m)1965     public void glLoadMatrixx(IntBuffer m) {
1966         begin("glLoadMatrixx");
1967         arg("m", 16, m);
1968         end();
1969 
1970         mgl.glLoadMatrixx(m);
1971         checkError();
1972     }
1973 
glLogicOp(int opcode)1974     public void glLogicOp(int opcode) {
1975         begin("glLogicOp");
1976         arg("opcode", opcode);
1977         end();
1978 
1979         mgl.glLogicOp(opcode);
1980         checkError();
1981     }
1982 
glMaterialf(int face, int pname, float param)1983     public void glMaterialf(int face, int pname, float param) {
1984         begin("glMaterialf");
1985         arg("face", getFaceName(face));
1986         arg("pname", getMaterialPName(pname));
1987         arg("param", param);
1988         end();
1989 
1990         mgl.glMaterialf(face, pname, param);
1991         checkError();
1992     }
1993 
glMaterialfv(int face, int pname, float[] params, int offset)1994     public void glMaterialfv(int face, int pname, float[] params, int offset) {
1995         begin("glMaterialfv");
1996         arg("face", getFaceName(face));
1997         arg("pname", getMaterialPName(pname));
1998         arg("params", getMaterialParamCount(pname), params, offset);
1999         arg("offset", offset);
2000         end();
2001 
2002         mgl.glMaterialfv(face, pname, params, offset);
2003         checkError();
2004     }
2005 
glMaterialfv(int face, int pname, FloatBuffer params)2006     public void glMaterialfv(int face, int pname, FloatBuffer params) {
2007         begin("glMaterialfv");
2008         arg("face", getFaceName(face));
2009         arg("pname", getMaterialPName(pname));
2010         arg("params", getMaterialParamCount(pname), params);
2011         end();
2012 
2013         mgl.glMaterialfv(face, pname, params);
2014         checkError();
2015     }
2016 
glMaterialx(int face, int pname, int param)2017     public void glMaterialx(int face, int pname, int param) {
2018         begin("glMaterialx");
2019         arg("face", getFaceName(face));
2020         arg("pname", getMaterialPName(pname));
2021         arg("param", param);
2022         end();
2023 
2024         mgl.glMaterialx(face, pname, param);
2025         checkError();
2026     }
2027 
glMaterialxv(int face, int pname, int[] params, int offset)2028     public void glMaterialxv(int face, int pname, int[] params, int offset) {
2029         begin("glMaterialxv");
2030         arg("face", getFaceName(face));
2031         arg("pname", getMaterialPName(pname));
2032         arg("params", getMaterialParamCount(pname), params, offset);
2033         arg("offset", offset);
2034         end();
2035 
2036         mgl.glMaterialxv(face, pname, params, offset);
2037         checkError();
2038     }
2039 
glMaterialxv(int face, int pname, IntBuffer params)2040     public void glMaterialxv(int face, int pname, IntBuffer params) {
2041         begin("glMaterialxv");
2042         arg("face", getFaceName(face));
2043         arg("pname", getMaterialPName(pname));
2044         arg("params", getMaterialParamCount(pname), params);
2045         end();
2046 
2047         mgl.glMaterialxv(face, pname, params);
2048         checkError();
2049     }
2050 
glMatrixMode(int mode)2051     public void glMatrixMode(int mode) {
2052         begin("glMatrixMode");
2053         arg("mode", getMatrixMode(mode));
2054         end();
2055 
2056         mgl.glMatrixMode(mode);
2057         checkError();
2058     }
2059 
glMultMatrixf(float[] m, int offset)2060     public void glMultMatrixf(float[] m, int offset) {
2061         begin("glMultMatrixf");
2062         arg("m", 16, m, offset);
2063         arg("offset", offset);
2064         end();
2065 
2066         mgl.glMultMatrixf(m, offset);
2067         checkError();
2068     }
2069 
glMultMatrixf(FloatBuffer m)2070     public void glMultMatrixf(FloatBuffer m) {
2071         begin("glMultMatrixf");
2072         arg("m", 16, m);
2073         end();
2074 
2075         mgl.glMultMatrixf(m);
2076         checkError();
2077     }
2078 
glMultMatrixx(int[] m, int offset)2079     public void glMultMatrixx(int[] m, int offset) {
2080         begin("glMultMatrixx");
2081         arg("m", 16, m, offset);
2082         arg("offset", offset);
2083         end();
2084 
2085         mgl.glMultMatrixx(m, offset);
2086         checkError();
2087     }
2088 
glMultMatrixx(IntBuffer m)2089     public void glMultMatrixx(IntBuffer m) {
2090         begin("glMultMatrixx");
2091         arg("m", 16, m);
2092         end();
2093 
2094         mgl.glMultMatrixx(m);
2095         checkError();
2096     }
2097 
glMultiTexCoord4f(int target, float s, float t, float r, float q)2098     public void glMultiTexCoord4f(int target, float s, float t, float r, float q) {
2099         begin("glMultiTexCoord4f");
2100         arg("target", target);
2101         arg("s", s);
2102         arg("t", t);
2103         arg("r", r);
2104         arg("q", q);
2105         end();
2106 
2107         mgl.glMultiTexCoord4f(target, s, t, r, q);
2108         checkError();
2109     }
2110 
glMultiTexCoord4x(int target, int s, int t, int r, int q)2111     public void glMultiTexCoord4x(int target, int s, int t, int r, int q) {
2112         begin("glMultiTexCoord4x");
2113         arg("target", target);
2114         arg("s", s);
2115         arg("t", t);
2116         arg("r", r);
2117         arg("q", q);
2118         end();
2119 
2120         mgl.glMultiTexCoord4x(target, s, t, r, q);
2121         checkError();
2122     }
2123 
glNormal3f(float nx, float ny, float nz)2124     public void glNormal3f(float nx, float ny, float nz) {
2125         begin("glNormal3f");
2126         arg("nx", nx);
2127         arg("ny", ny);
2128         arg("nz", nz);
2129         end();
2130 
2131         mgl.glNormal3f(nx, ny, nz);
2132         checkError();
2133     }
2134 
glNormal3x(int nx, int ny, int nz)2135     public void glNormal3x(int nx, int ny, int nz) {
2136         begin("glNormal3x");
2137         arg("nx", nx);
2138         arg("ny", ny);
2139         arg("nz", nz);
2140         end();
2141 
2142         mgl.glNormal3x(nx, ny, nz);
2143         checkError();
2144     }
2145 
glNormalPointer(int type, int stride, Buffer pointer)2146     public void glNormalPointer(int type, int stride, Buffer pointer) {
2147         begin("glNormalPointer");
2148         arg("type", type);
2149         arg("stride", stride);
2150         arg("pointer", pointer.toString());
2151         end();
2152         mNormalPointer = new PointerInfo(3, type, stride, pointer);
2153 
2154         mgl.glNormalPointer(type, stride, pointer);
2155         checkError();
2156     }
2157 
glOrthof(float left, float right, float bottom, float top, float near, float far)2158     public void glOrthof(float left, float right, float bottom, float top,
2159             float near, float far) {
2160         begin("glOrthof");
2161         arg("left", left);
2162         arg("right", right);
2163         arg("bottom", bottom);
2164         arg("top", top);
2165         arg("near", near);
2166         arg("far", far);
2167         end();
2168 
2169         mgl.glOrthof(left, right, bottom, top, near, far);
2170         checkError();
2171     }
2172 
glOrthox(int left, int right, int bottom, int top, int near, int far)2173     public void glOrthox(int left, int right, int bottom, int top, int near,
2174             int far) {
2175         begin("glOrthox");
2176         arg("left", left);
2177         arg("right", right);
2178         arg("bottom", bottom);
2179         arg("top", top);
2180         arg("near", near);
2181         arg("far", far);
2182         end();
2183 
2184         mgl.glOrthox(left, right, bottom, top, near, far);
2185         checkError();
2186     }
2187 
glPixelStorei(int pname, int param)2188     public void glPixelStorei(int pname, int param) {
2189         begin("glPixelStorei");
2190         arg("pname", pname);
2191         arg("param", param);
2192         end();
2193 
2194         mgl.glPixelStorei(pname, param);
2195         checkError();
2196     }
2197 
glPointSize(float size)2198     public void glPointSize(float size) {
2199         begin("glPointSize");
2200         arg("size", size);
2201         end();
2202 
2203         mgl.glPointSize(size);
2204         checkError();
2205     }
2206 
glPointSizex(int size)2207     public void glPointSizex(int size) {
2208         begin("glPointSizex");
2209         arg("size", size);
2210         end();
2211 
2212         mgl.glPointSizex(size);
2213         checkError();
2214     }
2215 
glPolygonOffset(float factor, float units)2216     public void glPolygonOffset(float factor, float units) {
2217         begin("glPolygonOffset");
2218         arg("factor", factor);
2219         arg("units", units);
2220         end();
2221         mgl.glPolygonOffset(factor, units);
2222         checkError();
2223     }
2224 
glPolygonOffsetx(int factor, int units)2225     public void glPolygonOffsetx(int factor, int units) {
2226         begin("glPolygonOffsetx");
2227         arg("factor", factor);
2228         arg("units", units);
2229         end();
2230 
2231         mgl.glPolygonOffsetx(factor, units);
2232         checkError();
2233     }
2234 
glPopMatrix()2235     public void glPopMatrix() {
2236         begin("glPopMatrix");
2237         end();
2238 
2239         mgl.glPopMatrix();
2240         checkError();
2241     }
2242 
glPushMatrix()2243     public void glPushMatrix() {
2244         begin("glPushMatrix");
2245         end();
2246 
2247         mgl.glPushMatrix();
2248         checkError();
2249     }
2250 
glReadPixels(int x, int y, int width, int height, int format, int type, Buffer pixels)2251     public void glReadPixels(int x, int y, int width, int height, int format,
2252             int type, Buffer pixels) {
2253         begin("glReadPixels");
2254         arg("x", x);
2255         arg("y", y);
2256         arg("width", width);
2257         arg("height", height);
2258         arg("format", format);
2259         arg("type", type);
2260         arg("pixels", pixels.toString());
2261         end();
2262 
2263         mgl.glReadPixels(x, y, width, height, format, type, pixels);
2264         checkError();
2265     }
2266 
glRotatef(float angle, float x, float y, float z)2267     public void glRotatef(float angle, float x, float y, float z) {
2268         begin("glRotatef");
2269         arg("angle", angle);
2270         arg("x", x);
2271         arg("y", y);
2272         arg("z", z);
2273         end();
2274 
2275         mgl.glRotatef(angle, x, y, z);
2276         checkError();
2277     }
2278 
glRotatex(int angle, int x, int y, int z)2279     public void glRotatex(int angle, int x, int y, int z) {
2280         begin("glRotatex");
2281         arg("angle", angle);
2282         arg("x", x);
2283         arg("y", y);
2284         arg("z", z);
2285         end();
2286 
2287         mgl.glRotatex(angle, x, y, z);
2288         checkError();
2289     }
2290 
glSampleCoverage(float value, boolean invert)2291     public void glSampleCoverage(float value, boolean invert) {
2292         begin("glSampleCoveragex");
2293         arg("value", value);
2294         arg("invert", invert);
2295         end();
2296 
2297         mgl.glSampleCoverage(value, invert);
2298         checkError();
2299     }
2300 
glSampleCoveragex(int value, boolean invert)2301     public void glSampleCoveragex(int value, boolean invert) {
2302         begin("glSampleCoveragex");
2303         arg("value", value);
2304         arg("invert", invert);
2305         end();
2306 
2307         mgl.glSampleCoveragex(value, invert);
2308         checkError();
2309     }
2310 
glScalef(float x, float y, float z)2311     public void glScalef(float x, float y, float z) {
2312         begin("glScalef");
2313         arg("x", x);
2314         arg("y", y);
2315         arg("z", z);
2316         end();
2317 
2318         mgl.glScalef(x, y, z);
2319         checkError();
2320     }
2321 
glScalex(int x, int y, int z)2322     public void glScalex(int x, int y, int z) {
2323         begin("glScalex");
2324         arg("x", x);
2325         arg("y", y);
2326         arg("z", z);
2327         end();
2328 
2329         mgl.glScalex(x, y, z);
2330         checkError();
2331     }
2332 
glScissor(int x, int y, int width, int height)2333     public void glScissor(int x, int y, int width, int height) {
2334         begin("glScissor");
2335         arg("x", x);
2336         arg("y", y);
2337         arg("width", width);
2338         arg("height", height);
2339         end();
2340 
2341         mgl.glScissor(x, y, width, height);
2342         checkError();
2343     }
2344 
glShadeModel(int mode)2345     public void glShadeModel(int mode) {
2346         begin("glShadeModel");
2347         arg("mode", getShadeModel(mode));
2348         end();
2349 
2350         mgl.glShadeModel(mode);
2351         checkError();
2352     }
2353 
glStencilFunc(int func, int ref, int mask)2354     public void glStencilFunc(int func, int ref, int mask) {
2355         begin("glStencilFunc");
2356         arg("func", func);
2357         arg("ref", ref);
2358         arg("mask", mask);
2359         end();
2360 
2361         mgl.glStencilFunc(func, ref, mask);
2362         checkError();
2363     }
2364 
glStencilMask(int mask)2365     public void glStencilMask(int mask) {
2366         begin("glStencilMask");
2367         arg("mask", mask);
2368         end();
2369 
2370         mgl.glStencilMask(mask);
2371         checkError();
2372     }
2373 
glStencilOp(int fail, int zfail, int zpass)2374     public void glStencilOp(int fail, int zfail, int zpass) {
2375         begin("glStencilOp");
2376         arg("fail", fail);
2377         arg("zfail", zfail);
2378         arg("zpass", zpass);
2379         end();
2380 
2381         mgl.glStencilOp(fail, zfail, zpass);
2382         checkError();
2383     }
2384 
glTexCoordPointer(int size, int type, int stride, Buffer pointer)2385     public void glTexCoordPointer(int size, int type, int stride, Buffer pointer) {
2386         begin("glTexCoordPointer");
2387         argPointer(size, type, stride, pointer);
2388         end();
2389         mTexCoordPointer = new PointerInfo(size, type, stride, pointer);
2390 
2391         mgl.glTexCoordPointer(size, type, stride, pointer);
2392         checkError();
2393     }
2394 
glTexEnvf(int target, int pname, float param)2395     public void glTexEnvf(int target, int pname, float param) {
2396         begin("glTexEnvf");
2397         arg("target", getTextureEnvTarget(target));
2398         arg("pname", getTextureEnvPName(pname));
2399         arg("param", getTextureEnvParamName(param));
2400         end();
2401 
2402         mgl.glTexEnvf(target, pname, param);
2403         checkError();
2404     }
2405 
glTexEnvfv(int target, int pname, float[] params, int offset)2406     public void glTexEnvfv(int target, int pname, float[] params, int offset) {
2407         begin("glTexEnvfv");
2408         arg("target", getTextureEnvTarget(target));
2409         arg("pname", getTextureEnvPName(pname));
2410         arg("params", getTextureEnvParamCount(pname), params, offset);
2411         arg("offset", offset);
2412         end();
2413 
2414         mgl.glTexEnvfv(target, pname, params, offset);
2415         checkError();
2416     }
2417 
glTexEnvfv(int target, int pname, FloatBuffer params)2418     public void glTexEnvfv(int target, int pname, FloatBuffer params) {
2419         begin("glTexEnvfv");
2420         arg("target", getTextureEnvTarget(target));
2421         arg("pname", getTextureEnvPName(pname));
2422         arg("params", getTextureEnvParamCount(pname), params);
2423         end();
2424 
2425         mgl.glTexEnvfv(target, pname, params);
2426         checkError();
2427     }
2428 
glTexEnvx(int target, int pname, int param)2429     public void glTexEnvx(int target, int pname, int param) {
2430         begin("glTexEnvx");
2431         arg("target", getTextureEnvTarget(target));
2432         arg("pname", getTextureEnvPName(pname));
2433         arg("param", param);
2434         end();
2435 
2436         mgl.glTexEnvx(target, pname, param);
2437         checkError();
2438     }
2439 
glTexEnvxv(int target, int pname, int[] params, int offset)2440     public void glTexEnvxv(int target, int pname, int[] params, int offset) {
2441         begin("glTexEnvxv");
2442         arg("target", getTextureEnvTarget(target));
2443         arg("pname", getTextureEnvPName(pname));
2444         arg("params", getTextureEnvParamCount(pname), params, offset);
2445         arg("offset", offset);
2446         end();
2447 
2448         mgl.glTexEnvxv(target, pname, params, offset);
2449         checkError();
2450     }
2451 
glTexEnvxv(int target, int pname, IntBuffer params)2452     public void glTexEnvxv(int target, int pname, IntBuffer params) {
2453         begin("glTexEnvxv");
2454         arg("target", getTextureEnvTarget(target));
2455         arg("pname", getTextureEnvPName(pname));
2456         arg("params", getTextureEnvParamCount(pname), params);
2457         end();
2458 
2459         mgl.glTexEnvxv(target, pname, params);
2460         checkError();
2461     }
2462 
glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels)2463     public void glTexImage2D(int target, int level, int internalformat,
2464             int width, int height, int border, int format, int type,
2465             Buffer pixels) {
2466         begin("glTexImage2D");
2467         arg("target", target);
2468         arg("level", level);
2469         arg("internalformat", internalformat);
2470         arg("width", width);
2471         arg("height", height);
2472         arg("border", border);
2473         arg("format", format);
2474         arg("type", type);
2475         arg("pixels", pixels.toString());
2476         end();
2477 
2478         mgl.glTexImage2D(target, level, internalformat, width, height, border,
2479                 format, type, pixels);
2480         checkError();
2481     }
2482 
glTexParameterf(int target, int pname, float param)2483     public void glTexParameterf(int target, int pname, float param) {
2484         begin("glTexParameterf");
2485         arg("target", getTextureTarget(target));
2486         arg("pname", getTexturePName(pname));
2487         arg("param", getTextureParamName(param));
2488         end();
2489 
2490         mgl.glTexParameterf(target, pname, param);
2491         checkError();
2492     }
2493 
glTexParameterx(int target, int pname, int param)2494     public void glTexParameterx(int target, int pname, int param) {
2495         begin("glTexParameterx");
2496         arg("target", getTextureTarget(target));
2497         arg("pname", getTexturePName(pname));
2498         arg("param", param);
2499         end();
2500 
2501         mgl.glTexParameterx(target, pname, param);
2502         checkError();
2503     }
2504 
glTexParameteriv(int target, int pname, int[] params, int offset)2505     public void glTexParameteriv(int target, int pname, int[] params, int offset) {
2506         begin("glTexParameteriv");
2507         arg("target", getTextureTarget(target));
2508         arg("pname", getTexturePName(pname));
2509         arg("params", 4, params, offset);
2510         end();
2511 
2512         mgl11.glTexParameteriv(target, pname, params, offset);
2513         checkError();
2514     }
2515 
glTexParameteriv(int target, int pname, IntBuffer params)2516     public void glTexParameteriv(int target, int pname, IntBuffer params) {
2517         begin("glTexParameteriv");
2518         arg("target", getTextureTarget(target));
2519         arg("pname", getTexturePName(pname));
2520         arg("params", 4, params);
2521         end();
2522 
2523         mgl11.glTexParameteriv(target, pname, params);
2524         checkError();
2525     }
2526 
glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels)2527     public void glTexSubImage2D(int target, int level, int xoffset,
2528             int yoffset, int width, int height, int format, int type,
2529             Buffer pixels) {
2530         begin("glTexSubImage2D");
2531         arg("target", getTextureTarget(target));
2532         arg("level", level);
2533         arg("xoffset", xoffset);
2534         arg("yoffset", yoffset);
2535         arg("width", width);
2536         arg("height", height);
2537         arg("format", format);
2538         arg("type", type);
2539         arg("pixels", pixels.toString());
2540         end();
2541         mgl.glTexSubImage2D(target, level, xoffset, yoffset, width, height,
2542                 format, type, pixels);
2543         checkError();
2544     }
2545 
glTranslatef(float x, float y, float z)2546     public void glTranslatef(float x, float y, float z) {
2547         begin("glTranslatef");
2548         arg("x", x);
2549         arg("y", y);
2550         arg("z", z);
2551         end();
2552         mgl.glTranslatef(x, y, z);
2553         checkError();
2554     }
2555 
glTranslatex(int x, int y, int z)2556     public void glTranslatex(int x, int y, int z) {
2557         begin("glTranslatex");
2558         arg("x", x);
2559         arg("y", y);
2560         arg("z", z);
2561         end();
2562         mgl.glTranslatex(x, y, z);
2563         checkError();
2564     }
2565 
glVertexPointer(int size, int type, int stride, Buffer pointer)2566     public void glVertexPointer(int size, int type, int stride, Buffer pointer) {
2567         begin("glVertexPointer");
2568         argPointer(size, type, stride, pointer);
2569         end();
2570         mVertexPointer = new PointerInfo(size, type, stride, pointer);
2571         mgl.glVertexPointer(size, type, stride, pointer);
2572         checkError();
2573     }
2574 
glViewport(int x, int y, int width, int height)2575     public void glViewport(int x, int y, int width, int height) {
2576         begin("glViewport");
2577         arg("x", x);
2578         arg("y", y);
2579         arg("width", width);
2580         arg("height", height);
2581         end();
2582         mgl.glViewport(x, y, width, height);
2583         checkError();
2584     }
2585 
glClipPlanef(int plane, float[] equation, int offset)2586     public void glClipPlanef(int plane, float[] equation, int offset) {
2587         begin("glClipPlanef");
2588         arg("plane", plane);
2589         arg("equation", 4, equation, offset);
2590         arg("offset", offset);
2591         end();
2592         mgl11.glClipPlanef(plane, equation, offset);
2593         checkError();
2594     }
2595 
glClipPlanef(int plane, FloatBuffer equation)2596     public void glClipPlanef(int plane, FloatBuffer equation) {
2597         begin("glClipPlanef");
2598         arg("plane", plane);
2599         arg("equation", 4, equation);
2600         end();
2601         mgl11.glClipPlanef(plane, equation);
2602         checkError();
2603     }
2604 
glClipPlanex(int plane, int[] equation, int offset)2605     public void glClipPlanex(int plane, int[] equation, int offset) {
2606         begin("glClipPlanex");
2607         arg("plane", plane);
2608         arg("equation", 4, equation, offset);
2609         arg("offset", offset);
2610         end();
2611         mgl11.glClipPlanex(plane, equation, offset);
2612         checkError();
2613     }
2614 
glClipPlanex(int plane, IntBuffer equation)2615     public void glClipPlanex(int plane, IntBuffer equation) {
2616         begin("glClipPlanef");
2617         arg("plane", plane);
2618         arg("equation", 4, equation);
2619         end();
2620         mgl11.glClipPlanex(plane, equation);
2621         checkError();
2622     }
2623 
2624     // Draw Texture Extension
2625 
glDrawTexfOES(float x, float y, float z, float width, float height)2626     public void glDrawTexfOES(float x, float y, float z,
2627         float width, float height) {
2628         begin("glDrawTexfOES");
2629         arg("x", x);
2630         arg("y", y);
2631         arg("z", z);
2632         arg("width", width);
2633         arg("height", height);
2634         end();
2635         mgl11Ext.glDrawTexfOES(x, y, z, width, height);
2636         checkError();
2637     }
2638 
glDrawTexfvOES(float[] coords, int offset)2639     public void glDrawTexfvOES(float[] coords, int offset) {
2640         begin("glDrawTexfvOES");
2641         arg("coords", 5, coords, offset);
2642         arg("offset", offset);
2643         end();
2644         mgl11Ext.glDrawTexfvOES(coords, offset);
2645         checkError();
2646     }
2647 
glDrawTexfvOES(FloatBuffer coords)2648     public void glDrawTexfvOES(FloatBuffer coords) {
2649         begin("glDrawTexfvOES");
2650         arg("coords", 5, coords);
2651         end();
2652         mgl11Ext.glDrawTexfvOES(coords);
2653         checkError();
2654     }
2655 
glDrawTexiOES(int x, int y, int z, int width, int height)2656     public void glDrawTexiOES(int x, int y, int z, int width, int height) {
2657         begin("glDrawTexiOES");
2658         arg("x", x);
2659         arg("y", y);
2660         arg("z", z);
2661         arg("width", width);
2662         arg("height", height);
2663         end();
2664         mgl11Ext.glDrawTexiOES(x, y, z, width, height);
2665         checkError();
2666     }
2667 
glDrawTexivOES(int[] coords, int offset)2668     public void glDrawTexivOES(int[] coords, int offset) {
2669         begin("glDrawTexivOES");
2670         arg("coords", 5, coords, offset);
2671         arg("offset", offset);
2672         end();
2673         mgl11Ext.glDrawTexivOES(coords, offset);
2674         checkError();
2675     }
2676 
glDrawTexivOES(IntBuffer coords)2677     public void glDrawTexivOES(IntBuffer coords) {
2678         begin("glDrawTexivOES");
2679         arg("coords", 5, coords);
2680         end();
2681         mgl11Ext.glDrawTexivOES(coords);
2682         checkError();
2683     }
2684 
glDrawTexsOES(short x, short y, short z, short width, short height)2685     public void glDrawTexsOES(short x, short y, short z,
2686         short width, short height) {
2687         begin("glDrawTexsOES");
2688         arg("x", x);
2689         arg("y", y);
2690         arg("z", z);
2691         arg("width", width);
2692         arg("height", height);
2693         end();
2694         mgl11Ext.glDrawTexsOES(x, y, z, width, height);
2695         checkError();
2696     }
2697 
glDrawTexsvOES(short[] coords, int offset)2698     public void glDrawTexsvOES(short[] coords, int offset) {
2699         begin("glDrawTexsvOES");
2700         arg("coords", 5, coords, offset);
2701         arg("offset", offset);
2702         end();
2703         mgl11Ext.glDrawTexsvOES(coords, offset);
2704         checkError();
2705     }
2706 
glDrawTexsvOES(ShortBuffer coords)2707     public void glDrawTexsvOES(ShortBuffer coords) {
2708         begin("glDrawTexsvOES");
2709         arg("coords", 5, coords);
2710         end();
2711         mgl11Ext.glDrawTexsvOES(coords);
2712         checkError();
2713     }
2714 
glDrawTexxOES(int x, int y, int z, int width, int height)2715     public void glDrawTexxOES(int x, int y, int z, int width, int height) {
2716         begin("glDrawTexxOES");
2717         arg("x", x);
2718         arg("y", y);
2719         arg("z", z);
2720         arg("width", width);
2721         arg("height", height);
2722         end();
2723         mgl11Ext.glDrawTexxOES(x, y, z, width, height);
2724         checkError();
2725     }
2726 
glDrawTexxvOES(int[] coords, int offset)2727     public void glDrawTexxvOES(int[] coords, int offset) {
2728         begin("glDrawTexxvOES");
2729         arg("coords", 5, coords, offset);
2730         arg("offset", offset);
2731         end();
2732         mgl11Ext.glDrawTexxvOES(coords, offset);
2733         checkError();
2734     }
2735 
glDrawTexxvOES(IntBuffer coords)2736     public void glDrawTexxvOES(IntBuffer coords) {
2737         begin("glDrawTexxvOES");
2738         arg("coords", 5, coords);
2739         end();
2740         mgl11Ext.glDrawTexxvOES(coords);
2741         checkError();
2742     }
2743 
glQueryMatrixxOES(int[] mantissa, int mantissaOffset, int[] exponent, int exponentOffset)2744     public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset,
2745         int[] exponent, int exponentOffset) {
2746         begin("glQueryMatrixxOES");
2747         arg("mantissa", Arrays.toString(mantissa));
2748         arg("exponent", Arrays.toString(exponent));
2749         end();
2750         int valid = mgl10Ext.glQueryMatrixxOES(mantissa, mantissaOffset,
2751             exponent, exponentOffset);
2752         returns(toString(16, FORMAT_FIXED, mantissa, mantissaOffset));
2753         returns(toString(16, FORMAT_INT, exponent, exponentOffset));
2754         checkError();
2755         return valid;
2756     }
2757 
glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent)2758     public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent) {
2759         begin("glQueryMatrixxOES");
2760         arg("mantissa", mantissa.toString());
2761         arg("exponent", exponent.toString());
2762         end();
2763         int valid = mgl10Ext.glQueryMatrixxOES(mantissa, exponent);
2764         returns(toString(16, FORMAT_FIXED, mantissa));
2765         returns(toString(16, FORMAT_INT, exponent));
2766         checkError();
2767         return valid;
2768     }
2769 
glBindBuffer(int target, int buffer)2770     public void glBindBuffer(int target, int buffer) {
2771         begin("glBindBuffer");
2772         arg("target", target);
2773         arg("buffer", buffer);
2774         end();
2775         mgl11.glBindBuffer(target, buffer);
2776         checkError();
2777     }
2778 
glBufferData(int target, int size, Buffer data, int usage)2779     public void glBufferData(int target, int size, Buffer data, int usage) {
2780         begin("glBufferData");
2781         arg("target", target);
2782         arg("size", size);
2783         arg("data", data.toString());
2784         arg("usage", usage);
2785         end();
2786         mgl11.glBufferData(target, size, data, usage);
2787         checkError();
2788     }
2789 
glBufferSubData(int target, int offset, int size, Buffer data)2790     public void glBufferSubData(int target, int offset, int size, Buffer data) {
2791         begin("glBufferSubData");
2792         arg("target", target);
2793         arg("offset", offset);
2794         arg("size", size);
2795         arg("data", data.toString());
2796         end();
2797         mgl11.glBufferSubData(target, offset, size, data);
2798         checkError();
2799     }
2800 
glColor4ub(byte red, byte green, byte blue, byte alpha)2801     public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
2802         begin("glColor4ub");
2803         arg("red", red);
2804         arg("green", green);
2805         arg("blue", blue);
2806         arg("alpha", alpha);
2807         end();
2808         mgl11.glColor4ub(red, green, blue, alpha);
2809         checkError();
2810     }
2811 
glDeleteBuffers(int n, int[] buffers, int offset)2812     public void glDeleteBuffers(int n, int[] buffers, int offset) {
2813         begin("glDeleteBuffers");
2814         arg("n", n);
2815         arg("buffers", buffers.toString());
2816         arg("offset", offset);
2817         end();
2818         mgl11.glDeleteBuffers(n, buffers, offset);
2819         checkError();
2820     }
2821 
glDeleteBuffers(int n, IntBuffer buffers)2822     public void glDeleteBuffers(int n, IntBuffer buffers) {
2823         begin("glDeleteBuffers");
2824         arg("n", n);
2825         arg("buffers", buffers.toString());
2826         end();
2827         mgl11.glDeleteBuffers(n, buffers);
2828         checkError();
2829     }
2830 
glGenBuffers(int n, int[] buffers, int offset)2831     public void glGenBuffers(int n, int[] buffers, int offset) {
2832         begin("glGenBuffers");
2833         arg("n", n);
2834         arg("buffers", buffers.toString());
2835         arg("offset", offset);
2836         end();
2837         mgl11.glGenBuffers(n, buffers, offset);
2838         checkError();
2839     }
2840 
glGenBuffers(int n, IntBuffer buffers)2841     public void glGenBuffers(int n, IntBuffer buffers) {
2842         begin("glGenBuffers");
2843         arg("n", n);
2844         arg("buffers", buffers.toString());
2845         end();
2846         mgl11.glGenBuffers(n, buffers);
2847         checkError();
2848     }
2849 
glGetBooleanv(int pname, boolean[] params, int offset)2850     public void glGetBooleanv(int pname, boolean[] params, int offset) {
2851         begin("glGetBooleanv");
2852         arg("pname", pname);
2853         arg("params", params.toString());
2854         arg("offset", offset);
2855         end();
2856         mgl11.glGetBooleanv(pname, params, offset);
2857         checkError();
2858     }
2859 
glGetBooleanv(int pname, IntBuffer params)2860     public void glGetBooleanv(int pname, IntBuffer params) {
2861         begin("glGetBooleanv");
2862         arg("pname", pname);
2863         arg("params", params.toString());
2864         end();
2865         mgl11.glGetBooleanv(pname, params);
2866         checkError();
2867     }
2868 
glGetBufferParameteriv(int target, int pname, int[] params, int offset)2869     public void glGetBufferParameteriv(int target, int pname, int[] params,
2870             int offset) {
2871         begin("glGetBufferParameteriv");
2872         arg("target", target);
2873         arg("pname", pname);
2874         arg("params", params.toString());
2875         arg("offset", offset);
2876         end();
2877         mgl11.glGetBufferParameteriv(target, pname, params, offset);
2878         checkError();
2879     }
2880 
glGetBufferParameteriv(int target, int pname, IntBuffer params)2881     public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
2882         begin("glGetBufferParameteriv");
2883         arg("target", target);
2884         arg("pname", pname);
2885         arg("params", params.toString());
2886         end();
2887         mgl11.glGetBufferParameteriv(target, pname, params);
2888         checkError();
2889     }
2890 
glGetClipPlanef(int pname, float[] eqn, int offset)2891     public void glGetClipPlanef(int pname, float[] eqn, int offset) {
2892         begin("glGetClipPlanef");
2893         arg("pname", pname);
2894         arg("eqn", eqn.toString());
2895         arg("offset", offset);
2896         end();
2897         mgl11.glGetClipPlanef(pname, eqn, offset);
2898         checkError();
2899     }
2900 
glGetClipPlanef(int pname, FloatBuffer eqn)2901     public void glGetClipPlanef(int pname, FloatBuffer eqn) {
2902         begin("glGetClipPlanef");
2903         arg("pname", pname);
2904         arg("eqn", eqn.toString());
2905         end();
2906         mgl11.glGetClipPlanef(pname, eqn);
2907         checkError();
2908     }
2909 
glGetClipPlanex(int pname, int[] eqn, int offset)2910     public void glGetClipPlanex(int pname, int[] eqn, int offset) {
2911         begin("glGetClipPlanex");
2912         arg("pname", pname);
2913         arg("eqn", eqn.toString());
2914         arg("offset", offset);
2915         end();
2916         mgl11.glGetClipPlanex(pname, eqn, offset);
2917     }
2918 
glGetClipPlanex(int pname, IntBuffer eqn)2919     public void glGetClipPlanex(int pname, IntBuffer eqn) {
2920         begin("glGetClipPlanex");
2921         arg("pname", pname);
2922         arg("eqn", eqn.toString());
2923         end();
2924         mgl11.glGetClipPlanex(pname, eqn);
2925         checkError();
2926     }
2927 
glGetFixedv(int pname, int[] params, int offset)2928     public void glGetFixedv(int pname, int[] params, int offset) {
2929         begin("glGetFixedv");
2930         arg("pname", pname);
2931         arg("params", params.toString());
2932         arg("offset", offset);
2933         end();
2934         mgl11.glGetFixedv(pname, params, offset);
2935     }
2936 
glGetFixedv(int pname, IntBuffer params)2937     public void glGetFixedv(int pname, IntBuffer params) {
2938         begin("glGetFixedv");
2939         arg("pname", pname);
2940         arg("params", params.toString());
2941         end();
2942         mgl11.glGetFixedv(pname, params);
2943         checkError();
2944     }
2945 
glGetFloatv(int pname, float[] params, int offset)2946     public void glGetFloatv(int pname, float[] params, int offset) {
2947         begin("glGetFloatv");
2948         arg("pname", pname);
2949         arg("params", params.toString());
2950         arg("offset", offset);
2951         end();
2952         mgl11.glGetFloatv(pname, params, offset);
2953     }
2954 
glGetFloatv(int pname, FloatBuffer params)2955     public void glGetFloatv(int pname, FloatBuffer params) {
2956         begin("glGetFloatv");
2957         arg("pname", pname);
2958         arg("params", params.toString());
2959         end();
2960         mgl11.glGetFloatv(pname, params);
2961         checkError();
2962     }
2963 
glGetLightfv(int light, int pname, float[] params, int offset)2964     public void glGetLightfv(int light, int pname, float[] params, int offset) {
2965         begin("glGetLightfv");
2966         arg("light", light);
2967         arg("pname", pname);
2968         arg("params", params.toString());
2969         arg("offset", offset);
2970         end();
2971         mgl11.glGetLightfv(light, pname, params, offset);
2972         checkError();
2973     }
2974 
glGetLightfv(int light, int pname, FloatBuffer params)2975     public void glGetLightfv(int light, int pname, FloatBuffer params) {
2976         begin("glGetLightfv");
2977         arg("light", light);
2978         arg("pname", pname);
2979         arg("params", params.toString());
2980         end();
2981         mgl11.glGetLightfv(light, pname, params);
2982         checkError();
2983     }
2984 
glGetLightxv(int light, int pname, int[] params, int offset)2985     public void glGetLightxv(int light, int pname, int[] params, int offset) {
2986         begin("glGetLightxv");
2987         arg("light", light);
2988         arg("pname", pname);
2989         arg("params", params.toString());
2990         arg("offset", offset);
2991         end();
2992         mgl11.glGetLightxv(light, pname, params, offset);
2993         checkError();
2994     }
2995 
glGetLightxv(int light, int pname, IntBuffer params)2996     public void glGetLightxv(int light, int pname, IntBuffer params) {
2997         begin("glGetLightxv");
2998         arg("light", light);
2999         arg("pname", pname);
3000         arg("params", params.toString());
3001         end();
3002         mgl11.glGetLightxv(light, pname, params);
3003         checkError();
3004     }
3005 
glGetMaterialfv(int face, int pname, float[] params, int offset)3006     public void glGetMaterialfv(int face, int pname, float[] params,
3007             int offset) {
3008         begin("glGetMaterialfv");
3009         arg("face", face);
3010         arg("pname", pname);
3011         arg("params", params.toString());
3012         arg("offset", offset);
3013         end();
3014         mgl11.glGetMaterialfv(face, pname, params, offset);
3015         checkError();
3016     }
3017 
glGetMaterialfv(int face, int pname, FloatBuffer params)3018     public void glGetMaterialfv(int face, int pname, FloatBuffer params) {
3019         begin("glGetMaterialfv");
3020         arg("face", face);
3021         arg("pname", pname);
3022         arg("params", params.toString());
3023         end();
3024         mgl11.glGetMaterialfv(face, pname, params);
3025         checkError();
3026     }
3027 
glGetMaterialxv(int face, int pname, int[] params, int offset)3028     public void glGetMaterialxv(int face, int pname, int[] params, int offset) {
3029         begin("glGetMaterialxv");
3030         arg("face", face);
3031         arg("pname", pname);
3032         arg("params", params.toString());
3033         arg("offset", offset);
3034         end();
3035         mgl11.glGetMaterialxv(face, pname, params, offset);
3036         checkError();
3037     }
3038 
glGetMaterialxv(int face, int pname, IntBuffer params)3039     public void glGetMaterialxv(int face, int pname, IntBuffer params) {
3040         begin("glGetMaterialxv");
3041         arg("face", face);
3042         arg("pname", pname);
3043         arg("params", params.toString());
3044         end();
3045         mgl11.glGetMaterialxv(face, pname, params);
3046         checkError();
3047     }
3048 
glGetTexEnviv(int env, int pname, int[] params, int offset)3049     public void glGetTexEnviv(int env, int pname, int[] params, int offset) {
3050         begin("glGetTexEnviv");
3051         arg("env", env);
3052         arg("pname", pname);
3053         arg("params", params.toString());
3054         arg("offset", offset);
3055         end();
3056         mgl11.glGetTexEnviv(env, pname, params, offset);
3057         checkError();
3058     }
3059 
glGetTexEnviv(int env, int pname, IntBuffer params)3060     public void glGetTexEnviv(int env, int pname, IntBuffer params) {
3061         begin("glGetTexEnviv");
3062         arg("env", env);
3063         arg("pname", pname);
3064         arg("params", params.toString());
3065         end();
3066         mgl11.glGetTexEnviv(env, pname, params);
3067         checkError();
3068     }
3069 
glGetTexEnvxv(int env, int pname, int[] params, int offset)3070     public void glGetTexEnvxv(int env, int pname, int[] params, int offset) {
3071         begin("glGetTexEnviv");
3072         arg("env", env);
3073         arg("pname", pname);
3074         arg("params", params.toString());
3075         arg("offset", offset);
3076         end();
3077         mgl11.glGetTexEnviv(env, pname, params, offset);
3078         checkError();
3079     }
3080 
glGetTexEnvxv(int env, int pname, IntBuffer params)3081     public void glGetTexEnvxv(int env, int pname, IntBuffer params) {
3082         begin("glGetTexEnviv");
3083         arg("env", env);
3084         arg("pname", pname);
3085         arg("params", params.toString());
3086         end();
3087         mgl11.glGetTexEnvxv(env, pname, params);
3088         checkError();
3089     }
3090 
glGetTexParameterfv(int target, int pname, float[] params, int offset)3091     public void glGetTexParameterfv(int target, int pname, float[] params, int offset) {
3092         begin("glGetTexParameterfv");
3093         arg("target", target);
3094         arg("pname", pname);
3095         arg("params", params.toString());
3096         arg("offset", offset);
3097         end();
3098         mgl11.glGetTexParameterfv(target, pname, params, offset);
3099         checkError();
3100     }
3101 
glGetTexParameterfv(int target, int pname, FloatBuffer params)3102     public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
3103         begin("glGetTexParameterfv");
3104         arg("target", target);
3105         arg("pname", pname);
3106         arg("params", params.toString());
3107         end();
3108         mgl11.glGetTexParameterfv(target, pname, params);
3109         checkError();
3110     }
3111 
glGetTexParameteriv(int target, int pname, int[] params, int offset)3112     public void glGetTexParameteriv(int target, int pname, int[] params, int offset) {
3113         begin("glGetTexParameteriv");
3114         arg("target", target);
3115         arg("pname", pname);
3116         arg("params", params.toString());
3117         arg("offset", offset);
3118         end();
3119         mgl11.glGetTexEnviv(target, pname, params, offset);
3120         checkError();
3121     }
3122 
glGetTexParameteriv(int target, int pname, IntBuffer params)3123     public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
3124         begin("glGetTexParameteriv");
3125         arg("target", target);
3126         arg("pname", pname);
3127         arg("params", params.toString());
3128         end();
3129         mgl11.glGetTexParameteriv(target, pname, params);
3130         checkError();
3131     }
3132 
glGetTexParameterxv(int target, int pname, int[] params, int offset)3133     public void glGetTexParameterxv(int target, int pname, int[] params,
3134             int offset) {
3135         begin("glGetTexParameterxv");
3136         arg("target", target);
3137         arg("pname", pname);
3138         arg("params", params.toString());
3139         arg("offset", offset);
3140         end();
3141         mgl11.glGetTexParameterxv(target, pname, params, offset);
3142         checkError();
3143     }
3144 
glGetTexParameterxv(int target, int pname, IntBuffer params)3145     public void glGetTexParameterxv(int target, int pname, IntBuffer params) {
3146         begin("glGetTexParameterxv");
3147         arg("target", target);
3148         arg("pname", pname);
3149         arg("params", params.toString());
3150         end();
3151         mgl11.glGetTexParameterxv(target, pname, params);
3152         checkError();
3153     }
3154 
glIsBuffer(int buffer)3155     public boolean glIsBuffer(int buffer) {
3156         begin("glIsBuffer");
3157         arg("buffer", buffer);
3158         end();
3159         boolean result = mgl11.glIsBuffer(buffer);
3160         checkError();
3161         return result;
3162     }
3163 
glIsEnabled(int cap)3164     public boolean glIsEnabled(int cap) {
3165         begin("glIsEnabled");
3166         arg("cap", cap);
3167         end();
3168         boolean result = mgl11.glIsEnabled(cap);
3169         checkError();
3170         return result;
3171     }
3172 
glIsTexture(int texture)3173     public boolean glIsTexture(int texture) {
3174         begin("glIsTexture");
3175         arg("texture", texture);
3176         end();
3177         boolean result = mgl11.glIsTexture(texture);
3178         checkError();
3179         return result;
3180     }
3181 
glPointParameterf(int pname, float param)3182     public void glPointParameterf(int pname, float param) {
3183         begin("glPointParameterf");
3184         arg("pname", pname);
3185         arg("param", param);
3186         end();
3187         mgl11.glPointParameterf( pname, param);
3188         checkError();
3189     }
3190 
glPointParameterfv(int pname, float[] params, int offset)3191     public void glPointParameterfv(int pname, float[] params, int offset) {
3192         begin("glPointParameterfv");
3193         arg("pname", pname);
3194         arg("params", params.toString());
3195         arg("offset", offset);
3196         end();
3197         mgl11.glPointParameterfv(pname, params, offset);
3198         checkError();
3199     }
3200 
glPointParameterfv(int pname, FloatBuffer params)3201     public void glPointParameterfv(int pname, FloatBuffer params) {
3202         begin("glPointParameterfv");
3203         arg("pname", pname);
3204         arg("params", params.toString());
3205         end();
3206         mgl11.glPointParameterfv(pname, params);
3207         checkError();
3208     }
3209 
glPointParameterx(int pname, int param)3210     public void glPointParameterx(int pname, int param) {
3211         begin("glPointParameterfv");
3212         arg("pname", pname);
3213         arg("param", param);
3214         end();
3215         mgl11.glPointParameterx( pname, param);
3216         checkError();
3217     }
3218 
glPointParameterxv(int pname, int[] params, int offset)3219     public void glPointParameterxv(int pname, int[] params, int offset) {
3220         begin("glPointParameterxv");
3221         arg("pname", pname);
3222         arg("params", params.toString());
3223         arg("offset", offset);
3224         end();
3225         mgl11.glPointParameterxv(pname, params, offset);
3226         checkError();
3227     }
3228 
glPointParameterxv(int pname, IntBuffer params)3229     public void glPointParameterxv(int pname, IntBuffer params) {
3230         begin("glPointParameterxv");
3231         arg("pname", pname);
3232         arg("params", params.toString());
3233         end();
3234         mgl11.glPointParameterxv( pname, params);
3235         checkError();
3236     }
3237 
glPointSizePointerOES(int type, int stride, Buffer pointer)3238     public void glPointSizePointerOES(int type, int stride, Buffer pointer) {
3239         begin("glPointSizePointerOES");
3240         arg("type", type);
3241         arg("stride", stride);
3242         arg("params", pointer.toString());
3243         end();
3244         mgl11.glPointSizePointerOES( type, stride, pointer);
3245         checkError();
3246     }
3247 
glTexEnvi(int target, int pname, int param)3248     public void glTexEnvi(int target, int pname, int param) {
3249         begin("glTexEnvi");
3250         arg("target", target);
3251         arg("pname", pname);
3252         arg("param", param);
3253         end();
3254         mgl11.glTexEnvi(target, pname, param);
3255         checkError();
3256     }
3257 
glTexEnviv(int target, int pname, int[] params, int offset)3258     public void glTexEnviv(int target, int pname, int[] params, int offset) {
3259         begin("glTexEnviv");
3260         arg("target", target);
3261         arg("pname", pname);
3262         arg("params", params.toString());
3263         arg("offset", offset);
3264         end();
3265         mgl11.glTexEnviv(target, pname, params, offset);
3266         checkError();
3267     }
3268 
glTexEnviv(int target, int pname, IntBuffer params)3269     public void glTexEnviv(int target, int pname, IntBuffer params) {
3270         begin("glTexEnviv");
3271         arg("target", target);
3272         arg("pname", pname);
3273         arg("params", params.toString());
3274         end();
3275         mgl11.glTexEnviv( target, pname, params);
3276         checkError();
3277     }
3278 
glTexParameterfv(int target, int pname, float[] params, int offset)3279     public void glTexParameterfv(int target, int pname, float[] params,
3280             int offset) {
3281         begin("glTexParameterfv");
3282         arg("target", target);
3283         arg("pname", pname);
3284         arg("params", params.toString());
3285         arg("offset", offset);
3286         end();
3287         mgl11.glTexParameterfv( target, pname, params, offset);
3288         checkError();
3289     }
3290 
glTexParameterfv(int target, int pname, FloatBuffer params)3291     public void glTexParameterfv(int target, int pname, FloatBuffer params) {
3292         begin("glTexParameterfv");
3293         arg("target", target);
3294         arg("pname", pname);
3295         arg("params", params.toString());
3296         end();
3297         mgl11.glTexParameterfv(target, pname, params);
3298         checkError();
3299     }
3300 
glTexParameteri(int target, int pname, int param)3301     public void glTexParameteri(int target, int pname, int param) {
3302         begin("glTexParameterxv");
3303         arg("target", target);
3304         arg("pname", pname);
3305         arg("param", param);
3306         end();
3307         mgl11.glTexParameteri(target, pname, param);
3308         checkError();
3309     }
3310 
glTexParameterxv(int target, int pname, int[] params, int offset)3311     public void glTexParameterxv(int target, int pname, int[] params,
3312             int offset) {
3313         begin("glTexParameterxv");
3314         arg("target", target);
3315         arg("pname", pname);
3316         arg("params", params.toString());
3317         arg("offset", offset);
3318         end();
3319         mgl11.glTexParameterxv(target, pname, params, offset);
3320         checkError();
3321     }
3322 
glTexParameterxv(int target, int pname, IntBuffer params)3323     public void glTexParameterxv(int target, int pname, IntBuffer params) {
3324         begin("glTexParameterxv");
3325         arg("target", target);
3326         arg("pname", pname);
3327         arg("params", params.toString());
3328         end();
3329         mgl11.glTexParameterxv(target, pname, params);
3330         checkError();
3331     }
3332 
3333 
glColorPointer(int size, int type, int stride, int offset)3334     public void glColorPointer(int size, int type, int stride, int offset) {
3335         begin("glColorPointer");
3336         arg("size", size);
3337         arg("type", type);
3338         arg("stride", stride);
3339         arg("offset", offset);
3340         end();
3341         mgl11.glColorPointer(size, type, stride, offset);
3342         checkError();
3343     }
3344 
glDrawElements(int mode, int count, int type, int offset)3345     public void glDrawElements(int mode, int count, int type, int offset) {
3346         begin("glDrawElements");
3347         arg("mode", mode);
3348         arg("count", count);
3349         arg("type", type);
3350         arg("offset", offset);
3351         end();
3352         mgl11.glDrawElements(mode, count, type, offset);
3353         checkError();
3354     }
3355 
glGetPointerv(int pname, Buffer[] params)3356     public void glGetPointerv(int pname, Buffer[] params) {
3357         begin("glGetPointerv");
3358         arg("pname", pname);
3359         arg("params", params.toString());
3360         end();
3361         mgl11.glGetPointerv(pname, params);
3362         checkError();
3363     }
3364 
glNormalPointer(int type, int stride, int offset)3365     public void glNormalPointer(int type, int stride, int offset) {
3366         begin("glNormalPointer");
3367         arg("type", type);
3368         arg("stride", stride);
3369         arg("offset", offset);
3370         end();
3371         mgl11.glNormalPointer(type, stride, offset);
3372     }
3373 
glTexCoordPointer(int size, int type, int stride, int offset)3374     public void glTexCoordPointer(int size, int type, int stride, int offset) {
3375         begin("glTexCoordPointer");
3376         arg("size", size);
3377         arg("type", type);
3378         arg("stride", stride);
3379         arg("offset", offset);
3380         end();
3381         mgl11.glTexCoordPointer(size, type, stride, offset);
3382     }
3383 
glVertexPointer(int size, int type, int stride, int offset)3384     public void glVertexPointer(int size, int type, int stride, int offset) {
3385         begin("glVertexPointer");
3386         arg("size", size);
3387         arg("type", type);
3388         arg("stride", stride);
3389         arg("offset", offset);
3390         end();
3391         mgl11.glVertexPointer(size, type, stride, offset);
3392     }
3393 
glCurrentPaletteMatrixOES(int matrixpaletteindex)3394     public void glCurrentPaletteMatrixOES(int matrixpaletteindex) {
3395         begin("glCurrentPaletteMatrixOES");
3396         arg("matrixpaletteindex", matrixpaletteindex);
3397         end();
3398         mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex);
3399         checkError();
3400     }
3401 
glLoadPaletteFromModelViewMatrixOES()3402     public void glLoadPaletteFromModelViewMatrixOES() {
3403         begin("glLoadPaletteFromModelViewMatrixOES");
3404         end();
3405         mgl11Ext.glLoadPaletteFromModelViewMatrixOES();
3406         checkError();
3407     }
3408 
glMatrixIndexPointerOES(int size, int type, int stride, Buffer pointer)3409     public void glMatrixIndexPointerOES(int size, int type, int stride,
3410             Buffer pointer) {
3411         begin("glMatrixIndexPointerOES");
3412         argPointer(size, type, stride, pointer);
3413         end();
3414         mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer);
3415         checkError();
3416     }
3417 
glMatrixIndexPointerOES(int size, int type, int stride, int offset)3418     public void glMatrixIndexPointerOES(int size, int type, int stride,
3419             int offset) {
3420         begin("glMatrixIndexPointerOES");
3421         arg("size", size);
3422         arg("type", type);
3423         arg("stride", stride);
3424         arg("offset", offset);
3425         end();
3426         mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset);
3427         checkError();
3428     }
3429 
glWeightPointerOES(int size, int type, int stride, Buffer pointer)3430     public void glWeightPointerOES(int size, int type, int stride,
3431             Buffer pointer) {
3432         begin("glWeightPointerOES");
3433         argPointer(size, type, stride, pointer);
3434         end();
3435         mgl11Ext.glWeightPointerOES(size, type, stride, pointer);
3436         checkError();
3437     }
3438 
glWeightPointerOES(int size, int type, int stride, int offset)3439     public void glWeightPointerOES(int size, int type, int stride, int offset) {
3440         begin("glWeightPointerOES");
3441         arg("size", size);
3442         arg("type", type);
3443         arg("stride", stride);
3444         arg("offset", offset);
3445         end();
3446         mgl11Ext.glWeightPointerOES(size, type, stride, offset);
3447         checkError();
3448     }
3449 
3450     @Override
glBindFramebufferOES(int target, int framebuffer)3451     public void glBindFramebufferOES(int target, int framebuffer) {
3452         begin("glBindFramebufferOES");
3453         arg("target", target);
3454         arg("framebuffer", framebuffer);
3455         end();
3456         mgl11ExtensionPack.glBindFramebufferOES(target, framebuffer);
3457         checkError();
3458     }
3459 
3460     @Override
glBindRenderbufferOES(int target, int renderbuffer)3461     public void glBindRenderbufferOES(int target, int renderbuffer) {
3462         begin("glBindRenderbufferOES");
3463         arg("target", target);
3464         arg("renderbuffer", renderbuffer);
3465         end();
3466         mgl11ExtensionPack.glBindRenderbufferOES(target, renderbuffer);
3467         checkError();
3468     }
3469 
3470     @Override
glBlendEquation(int mode)3471     public void glBlendEquation(int mode) {
3472         begin("glBlendEquation");
3473         arg("mode", mode);
3474         end();
3475         mgl11ExtensionPack.glBlendEquation(mode);
3476         checkError();
3477     }
3478 
3479     @Override
glBlendEquationSeparate(int modeRGB, int modeAlpha)3480     public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
3481         begin("glBlendEquationSeparate");
3482         arg("modeRGB", modeRGB);
3483         arg("modeAlpha", modeAlpha);
3484         end();
3485         mgl11ExtensionPack.glBlendEquationSeparate(modeRGB, modeAlpha);
3486         checkError();
3487     }
3488 
3489     @Override
glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)3490     public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha,
3491             int dstAlpha) {
3492         begin("glBlendFuncSeparate");
3493         arg("srcRGB", srcRGB);
3494         arg("dstRGB", dstRGB);
3495         arg("srcAlpha", srcAlpha);
3496         arg("dstAlpha", dstAlpha);
3497         end();
3498         mgl11ExtensionPack.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
3499         checkError();
3500     }
3501 
3502     @Override
glCheckFramebufferStatusOES(int target)3503     public int glCheckFramebufferStatusOES(int target) {
3504         begin("glCheckFramebufferStatusOES");
3505         arg("target", target);
3506         end();
3507         int result = mgl11ExtensionPack.glCheckFramebufferStatusOES(target);
3508         checkError();
3509         return result;
3510     }
3511 
3512     @Override
glDeleteFramebuffersOES(int n, int[] framebuffers, int offset)3513     public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) {
3514         begin("glDeleteFramebuffersOES");
3515         arg("n", n);
3516         arg("framebuffers", framebuffers.toString());
3517         arg("offset", offset);
3518         end();
3519         mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers, offset);
3520         checkError();
3521     }
3522 
3523     @Override
glDeleteFramebuffersOES(int n, IntBuffer framebuffers)3524     public void glDeleteFramebuffersOES(int n, IntBuffer framebuffers) {
3525         begin("glDeleteFramebuffersOES");
3526         arg("n", n);
3527         arg("framebuffers", framebuffers.toString());
3528         end();
3529         mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers);
3530         checkError();
3531     }
3532 
3533     @Override
glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset)3534     public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) {
3535         begin("glDeleteRenderbuffersOES");
3536         arg("n", n);
3537         arg("renderbuffers", renderbuffers.toString());
3538         arg("offset", offset);
3539         end();
3540         mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
3541         checkError();
3542     }
3543 
3544     @Override
glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers)3545     public void glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers) {
3546         begin("glDeleteRenderbuffersOES");
3547         arg("n", n);
3548         arg("renderbuffers", renderbuffers.toString());
3549         end();
3550         mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers);
3551         checkError();
3552     }
3553 
3554     @Override
glFramebufferRenderbufferOES(int target, int attachment, int renderbuffertarget, int renderbuffer)3555     public void glFramebufferRenderbufferOES(int target, int attachment,
3556             int renderbuffertarget, int renderbuffer) {
3557         begin("glFramebufferRenderbufferOES");
3558         arg("target", target);
3559         arg("attachment", attachment);
3560         arg("renderbuffertarget", renderbuffertarget);
3561         arg("renderbuffer", renderbuffer);
3562         end();
3563         mgl11ExtensionPack.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
3564         checkError();
3565     }
3566 
3567     @Override
glFramebufferTexture2DOES(int target, int attachment, int textarget, int texture, int level)3568     public void glFramebufferTexture2DOES(int target, int attachment,
3569             int textarget, int texture, int level) {
3570         begin("glFramebufferTexture2DOES");
3571         arg("target", target);
3572         arg("attachment", attachment);
3573         arg("textarget", textarget);
3574         arg("texture", texture);
3575         arg("level", level);
3576         end();
3577         mgl11ExtensionPack.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
3578         checkError();
3579     }
3580 
3581     @Override
glGenerateMipmapOES(int target)3582     public void glGenerateMipmapOES(int target) {
3583         begin("glGenerateMipmapOES");
3584         arg("target", target);
3585         end();
3586         mgl11ExtensionPack.glGenerateMipmapOES(target);
3587         checkError();
3588     }
3589 
3590     @Override
glGenFramebuffersOES(int n, int[] framebuffers, int offset)3591     public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) {
3592         begin("glGenFramebuffersOES");
3593         arg("n", n);
3594         arg("framebuffers", framebuffers.toString());
3595         arg("offset", offset);
3596         end();
3597         mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers, offset);
3598         checkError();
3599     }
3600 
3601     @Override
glGenFramebuffersOES(int n, IntBuffer framebuffers)3602     public void glGenFramebuffersOES(int n, IntBuffer framebuffers) {
3603         begin("glGenFramebuffersOES");
3604         arg("n", n);
3605         arg("framebuffers", framebuffers.toString());
3606         end();
3607         mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers);
3608         checkError();
3609     }
3610 
3611     @Override
glGenRenderbuffersOES(int n, int[] renderbuffers, int offset)3612     public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) {
3613         begin("glGenRenderbuffersOES");
3614         arg("n", n);
3615         arg("renderbuffers", renderbuffers.toString());
3616         arg("offset", offset);
3617         end();
3618         mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers, offset);
3619         checkError();
3620     }
3621 
3622     @Override
glGenRenderbuffersOES(int n, IntBuffer renderbuffers)3623     public void glGenRenderbuffersOES(int n, IntBuffer renderbuffers) {
3624         begin("glGenRenderbuffersOES");
3625         arg("n", n);
3626         arg("renderbuffers", renderbuffers.toString());
3627         end();
3628         mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers);
3629         checkError();
3630     }
3631 
3632     @Override
glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, int[] params, int offset)3633     public void glGetFramebufferAttachmentParameterivOES(int target,
3634             int attachment, int pname, int[] params, int offset) {
3635         begin("glGetFramebufferAttachmentParameterivOES");
3636         arg("target", target);
3637         arg("attachment", attachment);
3638         arg("pname", pname);
3639         arg("params", params.toString());
3640         arg("offset", offset);
3641         end();
3642         mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
3643         checkError();
3644     }
3645 
3646     @Override
glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, IntBuffer params)3647     public void glGetFramebufferAttachmentParameterivOES(int target,
3648             int attachment, int pname, IntBuffer params) {
3649         begin("glGetFramebufferAttachmentParameterivOES");
3650         arg("target", target);
3651         arg("attachment", attachment);
3652         arg("pname", pname);
3653         arg("params", params.toString());
3654         end();
3655         mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
3656         checkError();
3657     }
3658 
3659     @Override
glGetRenderbufferParameterivOES(int target, int pname, int[] params, int offset)3660     public void glGetRenderbufferParameterivOES(int target, int pname,
3661             int[] params, int offset) {
3662         begin("glGetRenderbufferParameterivOES");
3663         arg("target", target);
3664         arg("pname", pname);
3665         arg("params", params.toString());
3666         arg("offset", offset);
3667         end();
3668         mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
3669         checkError();
3670     }
3671 
3672     @Override
glGetRenderbufferParameterivOES(int target, int pname, IntBuffer params)3673     public void glGetRenderbufferParameterivOES(int target, int pname,
3674             IntBuffer params) {
3675         begin("glGetRenderbufferParameterivOES");
3676         arg("target", target);
3677         arg("pname", pname);
3678         arg("params", params.toString());
3679         end();
3680         mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params);
3681         checkError();
3682     }
3683 
3684     @Override
glGetTexGenfv(int coord, int pname, float[] params, int offset)3685     public void glGetTexGenfv(int coord, int pname, float[] params, int offset) {
3686         begin("glGetTexGenfv");
3687         arg("coord", coord);
3688         arg("pname", pname);
3689         arg("params", params.toString());
3690         arg("offset", offset);
3691         end();
3692         mgl11ExtensionPack.glGetTexGenfv(coord, pname, params, offset);
3693         checkError();
3694     }
3695 
3696     @Override
glGetTexGenfv(int coord, int pname, FloatBuffer params)3697     public void glGetTexGenfv(int coord, int pname, FloatBuffer params) {
3698         begin("glGetTexGenfv");
3699         arg("coord", coord);
3700         arg("pname", pname);
3701         arg("params", params.toString());
3702         end();
3703         mgl11ExtensionPack.glGetTexGenfv(coord, pname, params);
3704         checkError();
3705     }
3706 
3707     @Override
glGetTexGeniv(int coord, int pname, int[] params, int offset)3708     public void glGetTexGeniv(int coord, int pname, int[] params, int offset) {
3709         begin("glGetTexGeniv");
3710         arg("coord", coord);
3711         arg("pname", pname);
3712         arg("params", params.toString());
3713         arg("offset", offset);
3714         end();
3715         mgl11ExtensionPack.glGetTexGeniv(coord, pname, params, offset);
3716         checkError();
3717     }
3718 
3719     @Override
glGetTexGeniv(int coord, int pname, IntBuffer params)3720     public void glGetTexGeniv(int coord, int pname, IntBuffer params) {
3721         begin("glGetTexGeniv");
3722         arg("coord", coord);
3723         arg("pname", pname);
3724         arg("params", params.toString());
3725         end();
3726         mgl11ExtensionPack.glGetTexGeniv(coord, pname, params);
3727         checkError();
3728     }
3729 
3730     @Override
glGetTexGenxv(int coord, int pname, int[] params, int offset)3731     public void glGetTexGenxv(int coord, int pname, int[] params, int offset) {
3732         begin("glGetTexGenxv");
3733         arg("coord", coord);
3734         arg("pname", pname);
3735         arg("params", params.toString());
3736         arg("offset", offset);
3737         end();
3738         mgl11ExtensionPack.glGetTexGenxv(coord, pname, params, offset);
3739         checkError();
3740     }
3741 
3742     @Override
glGetTexGenxv(int coord, int pname, IntBuffer params)3743     public void glGetTexGenxv(int coord, int pname, IntBuffer params) {
3744         begin("glGetTexGenxv");
3745         arg("coord", coord);
3746         arg("pname", pname);
3747         arg("params", params.toString());
3748         end();
3749         mgl11ExtensionPack.glGetTexGenxv(coord, pname, params);
3750         checkError();
3751     }
3752 
3753     @Override
glIsFramebufferOES(int framebuffer)3754     public boolean glIsFramebufferOES(int framebuffer) {
3755         begin("glIsFramebufferOES");
3756         arg("framebuffer", framebuffer);
3757         end();
3758         boolean result = mgl11ExtensionPack.glIsFramebufferOES(framebuffer);
3759         checkError();
3760         return result;
3761     }
3762 
3763     @Override
glIsRenderbufferOES(int renderbuffer)3764     public boolean glIsRenderbufferOES(int renderbuffer) {
3765         begin("glIsRenderbufferOES");
3766         arg("renderbuffer", renderbuffer);
3767         end();
3768         mgl11ExtensionPack.glIsRenderbufferOES(renderbuffer);
3769         checkError();
3770         return false;
3771     }
3772 
3773     @Override
glRenderbufferStorageOES(int target, int internalformat, int width, int height)3774     public void glRenderbufferStorageOES(int target, int internalformat,
3775             int width, int height) {
3776         begin("glRenderbufferStorageOES");
3777         arg("target", target);
3778         arg("internalformat", internalformat);
3779         arg("width", width);
3780         arg("height", height);
3781         end();
3782         mgl11ExtensionPack.glRenderbufferStorageOES(target, internalformat, width, height);
3783         checkError();
3784     }
3785 
3786     @Override
glTexGenf(int coord, int pname, float param)3787     public void glTexGenf(int coord, int pname, float param) {
3788         begin("glTexGenf");
3789         arg("coord", coord);
3790         arg("pname", pname);
3791         arg("param", param);
3792         end();
3793         mgl11ExtensionPack.glTexGenf(coord, pname, param);
3794         checkError();
3795     }
3796 
3797     @Override
glTexGenfv(int coord, int pname, float[] params, int offset)3798     public void glTexGenfv(int coord, int pname, float[] params, int offset) {
3799         begin("glTexGenfv");
3800         arg("coord", coord);
3801         arg("pname", pname);
3802         arg("params", params.toString());
3803         arg("offset", offset);
3804         end();
3805         mgl11ExtensionPack.glTexGenfv(coord, pname, params, offset);
3806         checkError();
3807     }
3808 
3809     @Override
glTexGenfv(int coord, int pname, FloatBuffer params)3810     public void glTexGenfv(int coord, int pname, FloatBuffer params) {
3811         begin("glTexGenfv");
3812         arg("coord", coord);
3813         arg("pname", pname);
3814         arg("params", params.toString());
3815         end();
3816         mgl11ExtensionPack.glTexGenfv(coord, pname, params);
3817         checkError();
3818     }
3819 
3820     @Override
glTexGeni(int coord, int pname, int param)3821     public void glTexGeni(int coord, int pname, int param) {
3822         begin("glTexGeni");
3823         arg("coord", coord);
3824         arg("pname", pname);
3825         arg("param", param);
3826         end();
3827         mgl11ExtensionPack.glTexGeni(coord, pname, param);
3828         checkError();
3829     }
3830 
3831     @Override
glTexGeniv(int coord, int pname, int[] params, int offset)3832     public void glTexGeniv(int coord, int pname, int[] params, int offset) {
3833         begin("glTexGeniv");
3834         arg("coord", coord);
3835         arg("pname", pname);
3836         arg("params", params.toString());
3837         arg("offset", offset);
3838         end();
3839         mgl11ExtensionPack.glTexGeniv(coord, pname, params, offset);
3840         checkError();
3841     }
3842 
3843     @Override
glTexGeniv(int coord, int pname, IntBuffer params)3844     public void glTexGeniv(int coord, int pname, IntBuffer params) {
3845         begin("glTexGeniv");
3846         arg("coord", coord);
3847         arg("pname", pname);
3848         arg("params", params.toString());
3849         end();
3850         mgl11ExtensionPack.glTexGeniv(coord, pname, params);
3851         checkError();
3852     }
3853 
3854     @Override
glTexGenx(int coord, int pname, int param)3855     public void glTexGenx(int coord, int pname, int param) {
3856         begin("glTexGenx");
3857         arg("coord", coord);
3858         arg("pname", pname);
3859         arg("param", param);
3860         end();
3861         mgl11ExtensionPack.glTexGenx(coord, pname, param);
3862         checkError();
3863     }
3864 
3865     @Override
glTexGenxv(int coord, int pname, int[] params, int offset)3866     public void glTexGenxv(int coord, int pname, int[] params, int offset) {
3867         begin("glTexGenxv");
3868         arg("coord", coord);
3869         arg("pname", pname);
3870         arg("params", params.toString());
3871         arg("offset", offset);
3872         end();
3873         mgl11ExtensionPack.glTexGenxv(coord, pname, params, offset);
3874         checkError();
3875     }
3876 
3877     @Override
glTexGenxv(int coord, int pname, IntBuffer params)3878     public void glTexGenxv(int coord, int pname, IntBuffer params) {
3879         begin("glTexGenxv");
3880         arg("coord", coord);
3881         arg("pname", pname);
3882         arg("params", params.toString());
3883         end();
3884         mgl11ExtensionPack.glTexGenxv(coord, pname, params);
3885         checkError();
3886     }
3887 
3888     private class PointerInfo {
3889         /**
3890          * The number of coordinates per vertex. 1..4
3891          */
3892         public int mSize;
3893         /**
3894          * The type of each coordinate.
3895          */
3896         public int mType;
3897         /**
3898          * The byte offset between consecutive vertices. 0 means mSize *
3899          * sizeof(mType)
3900          */
3901         public int mStride;
3902         public Buffer mPointer;
3903         public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls
3904 
PointerInfo()3905         public PointerInfo() {
3906         }
3907 
PointerInfo(int size, int type, int stride, Buffer pointer)3908         public PointerInfo(int size, int type, int stride, Buffer pointer) {
3909             mSize = size;
3910             mType = type;
3911             mStride = stride;
3912             mPointer = pointer;
3913         }
3914 
sizeof(int type)3915         public int sizeof(int type) {
3916             switch (type) {
3917             case GL_UNSIGNED_BYTE:
3918                 return 1;
3919             case GL_BYTE:
3920                 return 1;
3921             case GL_SHORT:
3922                 return 2;
3923             case GL_FIXED:
3924                 return 4;
3925             case GL_FLOAT:
3926                 return 4;
3927             default:
3928                 return 0;
3929             }
3930         }
3931 
getStride()3932         public int getStride() {
3933             return mStride > 0 ? mStride : sizeof(mType) * mSize;
3934         }
3935 
bindByteBuffer()3936         public void bindByteBuffer() {
3937             mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer);
3938         }
3939 
unbindByteBuffer()3940         public void unbindByteBuffer() {
3941             mTempByteBuffer = null;
3942         }
3943     }
3944 
3945     private Writer mLog;
3946     private boolean mLogArgumentNames;
3947     private int mArgCount;
3948 
3949     private PointerInfo mColorPointer = new PointerInfo();
3950     private PointerInfo mNormalPointer = new PointerInfo();
3951     private PointerInfo mTexCoordPointer = new PointerInfo();
3952     private PointerInfo mVertexPointer = new PointerInfo();
3953 
3954     boolean mColorArrayEnabled;
3955     boolean mNormalArrayEnabled;
3956     boolean mTextureCoordArrayEnabled;
3957     boolean mVertexArrayEnabled;
3958 
3959     StringBuilder mStringBuilder;
3960 }
3961