ArViewer  Android Version
Arvos - Augmented reality viewer open source
 All Classes Namespaces Files Functions Variables
MatrixTrackingGL.java
Go to the documentation of this file.
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 com.mission_base.arviewer_android.viewer.utilities;
18 
19 import android.util.Log;
20 
21 import java.nio.Buffer;
22 import java.nio.ByteBuffer;
23 import java.nio.ByteOrder;
24 import java.nio.FloatBuffer;
25 import java.nio.IntBuffer;
26 import java.nio.ShortBuffer;
27 
28 import javax.microedition.khronos.opengles.GL;
29 import javax.microedition.khronos.opengles.GL10;
30 import javax.microedition.khronos.opengles.GL10Ext;
31 import javax.microedition.khronos.opengles.GL11;
32 import javax.microedition.khronos.opengles.GL11Ext;
33 
34 
44 public class MatrixTrackingGL implements GL, GL10, GL10Ext, GL11, GL11Ext {
45  private GL10 mgl;
46  private GL10Ext mgl10Ext;
47  private GL11 mgl11;
48  private GL11Ext mgl11Ext;
49  private int mMatrixMode;
50  private MatrixStack mCurrent;
51  private MatrixStack mModelView;
52  private MatrixStack mTexture;
53  private MatrixStack mProjection;
54 
55  private final static boolean _check = false;
56  ByteBuffer mByteBuffer;
57  FloatBuffer mFloatBuffer;
58  float[] mCheckA;
59  float[] mCheckB;
60 
61  public MatrixTrackingGL(GL gl) {
62  mgl = (GL10) gl;
63  if (gl instanceof GL10Ext) {
64  mgl10Ext = (GL10Ext) gl;
65  }
66  if (gl instanceof GL11) {
67  mgl11 = (GL11) gl;
68  }
69  if (gl instanceof GL11Ext) {
70  mgl11Ext = (GL11Ext) gl;
71  }
72  mModelView = new MatrixStack();
73  mProjection = new MatrixStack();
74  mTexture = new MatrixStack();
75  mCurrent = mModelView;
76  mMatrixMode = GL10.GL_MODELVIEW;
77  }
78 
79  // ---------------------------------------------------------------------
80  // GL10 methods:
81 
82  public void glActiveTexture(int texture) {
83  mgl.glActiveTexture(texture);
84  }
85 
86  public void glAlphaFunc(int func, float ref) {
87  mgl.glAlphaFunc(func, ref);
88  }
89 
90  public void glAlphaFuncx(int func, int ref) {
91  mgl.glAlphaFuncx(func, ref);
92  }
93 
94  public void glBindTexture(int target, int texture) {
95  mgl.glBindTexture(target, texture);
96  }
97 
98  public void glBlendFunc(int sfactor, int dfactor) {
99  mgl.glBlendFunc(sfactor, dfactor);
100  }
101 
102  public void glClear(int mask) {
103  mgl.glClear(mask);
104  }
105 
106  public void glClearColor(float red, float green, float blue, float alpha) {
107  mgl.glClearColor(red, green, blue, alpha);
108  }
109 
110  public void glClearColorx(int red, int green, int blue, int alpha) {
111  mgl.glClearColorx(red, green, blue, alpha);
112  }
113 
114  public void glClearDepthf(float depth) {
115  mgl.glClearDepthf(depth);
116  }
117 
118  public void glClearDepthx(int depth) {
119  mgl.glClearDepthx(depth);
120  }
121 
122  public void glClearStencil(int s) {
123  mgl.glClearStencil(s);
124  }
125 
126  public void glClientActiveTexture(int texture) {
127  mgl.glClientActiveTexture(texture);
128  }
129 
130  public void glColor4f(float red, float green, float blue, float alpha) {
131  mgl.glColor4f(red, green, blue, alpha);
132  }
133 
134  public void glColor4x(int red, int green, int blue, int alpha) {
135  mgl.glColor4x(red, green, blue, alpha);
136  }
137 
138  public void glColorMask(boolean red, boolean green, boolean blue,
139  boolean alpha) {
140  mgl.glColorMask(red, green, blue, alpha);
141  }
142 
143  public void glColorPointer(int size, int type, int stride, Buffer pointer) {
144  mgl.glColorPointer(size, type, stride, pointer);
145  }
146 
147  public void glCompressedTexImage2D(int target, int level,
148  int internalformat, int width, int height, int border,
149  int imageSize, Buffer data) {
150  mgl.glCompressedTexImage2D(target, level, internalformat, width,
151  height, border, imageSize, data);
152  }
153 
154  public void glCompressedTexSubImage2D(int target, int level, int xoffset,
155  int yoffset, int width, int height, int format, int imageSize,
156  Buffer data) {
157  mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width,
158  height, format, imageSize, data);
159  }
160 
161  public void glCopyTexImage2D(int target, int level, int internalformat,
162  int x, int y, int width, int height, int border) {
163  mgl.glCopyTexImage2D(target, level, internalformat, x, y, width,
164  height, border);
165  }
166 
167  public void glCopyTexSubImage2D(int target, int level, int xoffset,
168  int yoffset, int x, int y, int width, int height) {
169  mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
170  height);
171  }
172 
173  public void glCullFace(int mode) {
174  mgl.glCullFace(mode);
175  }
176 
177  public void glDeleteTextures(int n, int[] textures, int offset) {
178  mgl.glDeleteTextures(n, textures, offset);
179  }
180 
181  public void glDeleteTextures(int n, IntBuffer textures) {
182  mgl.glDeleteTextures(n, textures);
183  }
184 
185  public void glDepthFunc(int func) {
186  mgl.glDepthFunc(func);
187  }
188 
189  public void glDepthMask(boolean flag) {
190  mgl.glDepthMask(flag);
191  }
192 
193  public void glDepthRangef(float near, float far) {
194  mgl.glDepthRangef(near, far);
195  }
196 
197  public void glDepthRangex(int near, int far) {
198  mgl.glDepthRangex(near, far);
199  }
200 
201  public void glDisable(int cap) {
202  mgl.glDisable(cap);
203  }
204 
205  public void glDisableClientState(int array) {
206  mgl.glDisableClientState(array);
207  }
208 
209  public void glDrawArrays(int mode, int first, int count) {
210  mgl.glDrawArrays(mode, first, count);
211  }
212 
213  public void glDrawElements(int mode, int count, int type, Buffer indices) {
214  mgl.glDrawElements(mode, count, type, indices);
215  }
216 
217  public void glEnable(int cap) {
218  mgl.glEnable(cap);
219  }
220 
221  public void glEnableClientState(int array) {
222  mgl.glEnableClientState(array);
223  }
224 
225  public void glFinish() {
226  mgl.glFinish();
227  }
228 
229  public void glFlush() {
230  mgl.glFlush();
231  }
232 
233  public void glFogf(int pname, float param) {
234  mgl.glFogf(pname, param);
235  }
236 
237  public void glFogfv(int pname, float[] params, int offset) {
238  mgl.glFogfv(pname, params, offset);
239  }
240 
241  public void glFogfv(int pname, FloatBuffer params) {
242  mgl.glFogfv(pname, params);
243  }
244 
245  public void glFogx(int pname, int param) {
246  mgl.glFogx(pname, param);
247  }
248 
249  public void glFogxv(int pname, int[] params, int offset) {
250  mgl.glFogxv(pname, params, offset);
251  }
252 
253  public void glFogxv(int pname, IntBuffer params) {
254  mgl.glFogxv(pname, params);
255  }
256 
257  public void glFrontFace(int mode) {
258  mgl.glFrontFace(mode);
259  }
260 
261  public void glFrustumf(float left, float right, float bottom, float top,
262  float near, float far) {
263  mCurrent.glFrustumf(left, right, bottom, top, near, far);
264  mgl.glFrustumf(left, right, bottom, top, near, far);
265  if ( _check) check();
266  }
267 
268  public void glFrustumx(int left, int right, int bottom, int top, int near,
269  int far) {
270  mCurrent.glFrustumx(left, right, bottom, top, near, far);
271  mgl.glFrustumx(left, right, bottom, top, near, far);
272  if ( _check) check();
273  }
274 
275  public void glGenTextures(int n, int[] textures, int offset) {
276  mgl.glGenTextures(n, textures, offset);
277  }
278 
279  public void glGenTextures(int n, IntBuffer textures) {
280  mgl.glGenTextures(n, textures);
281  }
282 
283  public int glGetError() {
284  int result = mgl.glGetError();
285  return result;
286  }
287 
288  public void glGetIntegerv(int pname, int[] params, int offset) {
289  mgl.glGetIntegerv(pname, params, offset);
290  }
291 
292  public void glGetIntegerv(int pname, IntBuffer params) {
293  mgl.glGetIntegerv(pname, params);
294  }
295 
296  public String glGetString(int name) {
297  String result = mgl.glGetString(name);
298  return result;
299  }
300 
301  public void glHint(int target, int mode) {
302  mgl.glHint(target, mode);
303  }
304 
305  public void glLightModelf(int pname, float param) {
306  mgl.glLightModelf(pname, param);
307  }
308 
309  public void glLightModelfv(int pname, float[] params, int offset) {
310  mgl.glLightModelfv(pname, params, offset);
311  }
312 
313  public void glLightModelfv(int pname, FloatBuffer params) {
314  mgl.glLightModelfv(pname, params);
315  }
316 
317  public void glLightModelx(int pname, int param) {
318  mgl.glLightModelx(pname, param);
319  }
320 
321  public void glLightModelxv(int pname, int[] params, int offset) {
322  mgl.glLightModelxv(pname, params, offset);
323  }
324 
325  public void glLightModelxv(int pname, IntBuffer params) {
326  mgl.glLightModelxv(pname, params);
327  }
328 
329  public void glLightf(int light, int pname, float param) {
330  mgl.glLightf(light, pname, param);
331  }
332 
333  public void glLightfv(int light, int pname, float[] params, int offset) {
334  mgl.glLightfv(light, pname, params, offset);
335  }
336 
337  public void glLightfv(int light, int pname, FloatBuffer params) {
338  mgl.glLightfv(light, pname, params);
339  }
340 
341  public void glLightx(int light, int pname, int param) {
342  mgl.glLightx(light, pname, param);
343  }
344 
345  public void glLightxv(int light, int pname, int[] params, int offset) {
346  mgl.glLightxv(light, pname, params, offset);
347  }
348 
349  public void glLightxv(int light, int pname, IntBuffer params) {
350  mgl.glLightxv(light, pname, params);
351  }
352 
353  public void glLineWidth(float width) {
354  mgl.glLineWidth(width);
355  }
356 
357  public void glLineWidthx(int width) {
358  mgl.glLineWidthx(width);
359  }
360 
361  public void glLoadIdentity() {
362  mCurrent.glLoadIdentity();
363  mgl.glLoadIdentity();
364  if ( _check) check();
365  }
366 
367  public void glLoadMatrixf(float[] m, int offset) {
368  mCurrent.glLoadMatrixf(m, offset);
369  mgl.glLoadMatrixf(m, offset);
370  if ( _check) check();
371  }
372 
373  public void glLoadMatrixf(FloatBuffer m) {
374  int position = m.position();
375  mCurrent.glLoadMatrixf(m);
376  m.position(position);
377  mgl.glLoadMatrixf(m);
378  if ( _check) check();
379  }
380 
381  public void glLoadMatrixx(int[] m, int offset) {
382  mCurrent.glLoadMatrixx(m, offset);
383  mgl.glLoadMatrixx(m, offset);
384  if ( _check) check();
385  }
386 
387  public void glLoadMatrixx(IntBuffer m) {
388  int position = m.position();
389  mCurrent.glLoadMatrixx(m);
390  m.position(position);
391  mgl.glLoadMatrixx(m);
392  if ( _check) check();
393  }
394 
395  public void glLogicOp(int opcode) {
396  mgl.glLogicOp(opcode);
397  }
398 
399  public void glMaterialf(int face, int pname, float param) {
400  mgl.glMaterialf(face, pname, param);
401  }
402 
403  public void glMaterialfv(int face, int pname, float[] params, int offset) {
404  mgl.glMaterialfv(face, pname, params, offset);
405  }
406 
407  public void glMaterialfv(int face, int pname, FloatBuffer params) {
408  mgl.glMaterialfv(face, pname, params);
409  }
410 
411  public void glMaterialx(int face, int pname, int param) {
412  mgl.glMaterialx(face, pname, param);
413  }
414 
415  public void glMaterialxv(int face, int pname, int[] params, int offset) {
416  mgl.glMaterialxv(face, pname, params, offset);
417  }
418 
419  public void glMaterialxv(int face, int pname, IntBuffer params) {
420  mgl.glMaterialxv(face, pname, params);
421  }
422 
423  public void glMatrixMode(int mode) {
424  switch (mode) {
425  case GL10.GL_MODELVIEW:
426  mCurrent = mModelView;
427  break;
428  case GL10.GL_TEXTURE:
429  mCurrent = mTexture;
430  break;
431  case GL10.GL_PROJECTION:
432  mCurrent = mProjection;
433  break;
434  default:
435  throw new IllegalArgumentException("Unknown matrix mode: " + mode);
436  }
437  mgl.glMatrixMode(mode);
438  mMatrixMode = mode;
439  if ( _check) check();
440  }
441 
442  public void glMultMatrixf(float[] m, int offset) {
443  mCurrent.glMultMatrixf(m, offset);
444  mgl.glMultMatrixf(m, offset);
445  if ( _check) check();
446  }
447 
448  public void glMultMatrixf(FloatBuffer m) {
449  int position = m.position();
450  mCurrent.glMultMatrixf(m);
451  m.position(position);
452  mgl.glMultMatrixf(m);
453  if ( _check) check();
454  }
455 
456  public void glMultMatrixx(int[] m, int offset) {
457  mCurrent.glMultMatrixx(m, offset);
458  mgl.glMultMatrixx(m, offset);
459  if ( _check) check();
460  }
461 
462  public void glMultMatrixx(IntBuffer m) {
463  int position = m.position();
464  mCurrent.glMultMatrixx(m);
465  m.position(position);
466  mgl.glMultMatrixx(m);
467  if ( _check) check();
468  }
469 
470  public void glMultiTexCoord4f(int target,
471  float s, float t, float r, float q) {
472  mgl.glMultiTexCoord4f(target, s, t, r, q);
473  }
474 
475  public void glMultiTexCoord4x(int target, int s, int t, int r, int q) {
476  mgl.glMultiTexCoord4x(target, s, t, r, q);
477  }
478 
479  public void glNormal3f(float nx, float ny, float nz) {
480  mgl.glNormal3f(nx, ny, nz);
481  }
482 
483  public void glNormal3x(int nx, int ny, int nz) {
484  mgl.glNormal3x(nx, ny, nz);
485  }
486 
487  public void glNormalPointer(int type, int stride, Buffer pointer) {
488  mgl.glNormalPointer(type, stride, pointer);
489  }
490 
491  public void glOrthof(float left, float right, float bottom, float top,
492  float near, float far) {
493  mCurrent.glOrthof(left, right, bottom, top, near, far);
494  mgl.glOrthof(left, right, bottom, top, near, far);
495  if ( _check) check();
496  }
497 
498  public void glOrthox(int left, int right, int bottom, int top, int near,
499  int far) {
500  mCurrent.glOrthox(left, right, bottom, top, near, far);
501  mgl.glOrthox(left, right, bottom, top, near, far);
502  if ( _check) check();
503  }
504 
505  public void glPixelStorei(int pname, int param) {
506  mgl.glPixelStorei(pname, param);
507  }
508 
509  public void glPointSize(float size) {
510  mgl.glPointSize(size);
511  }
512 
513  public void glPointSizex(int size) {
514  mgl.glPointSizex(size);
515  }
516 
517  public void glPolygonOffset(float factor, float units) {
518  mgl.glPolygonOffset(factor, units);
519  }
520 
521  public void glPolygonOffsetx(int factor, int units) {
522  mgl.glPolygonOffsetx(factor, units);
523  }
524 
525  public void glPopMatrix() {
526  mCurrent.glPopMatrix();
527  mgl.glPopMatrix();
528  if ( _check) check();
529  }
530 
531  public void glPushMatrix() {
532  mCurrent.glPushMatrix();
533  mgl.glPushMatrix();
534  if ( _check) check();
535  }
536 
537  public void glReadPixels(int x, int y, int width, int height, int format,
538  int type, Buffer pixels) {
539  mgl.glReadPixels(x, y, width, height, format, type, pixels);
540  }
541 
542  public void glRotatef(float angle, float x, float y, float z) {
543  mCurrent.glRotatef(angle, x, y, z);
544  mgl.glRotatef(angle, x, y, z);
545  if ( _check) check();
546  }
547 
548  public void glRotatex(int angle, int x, int y, int z) {
549  mCurrent.glRotatex(angle, x, y, z);
550  mgl.glRotatex(angle, x, y, z);
551  if ( _check) check();
552  }
553 
554  public void glSampleCoverage(float value, boolean invert) {
555  mgl.glSampleCoverage(value, invert);
556  }
557 
558  public void glSampleCoveragex(int value, boolean invert) {
559  mgl.glSampleCoveragex(value, invert);
560  }
561 
562  public void glScalef(float x, float y, float z) {
563  mCurrent.glScalef(x, y, z);
564  mgl.glScalef(x, y, z);
565  if ( _check) check();
566  }
567 
568  public void glScalex(int x, int y, int z) {
569  mCurrent.glScalex(x, y, z);
570  mgl.glScalex(x, y, z);
571  if ( _check) check();
572  }
573 
574  public void glScissor(int x, int y, int width, int height) {
575  mgl.glScissor(x, y, width, height);
576  }
577 
578  public void glShadeModel(int mode) {
579  mgl.glShadeModel(mode);
580  }
581 
582  public void glStencilFunc(int func, int ref, int mask) {
583  mgl.glStencilFunc(func, ref, mask);
584  }
585 
586  public void glStencilMask(int mask) {
587  mgl.glStencilMask(mask);
588  }
589 
590  public void glStencilOp(int fail, int zfail, int zpass) {
591  mgl.glStencilOp(fail, zfail, zpass);
592  }
593 
594  public void glTexCoordPointer(int size, int type,
595  int stride, Buffer pointer) {
596  mgl.glTexCoordPointer(size, type, stride, pointer);
597  }
598 
599  public void glTexEnvf(int target, int pname, float param) {
600  mgl.glTexEnvf(target, pname, param);
601  }
602 
603  public void glTexEnvfv(int target, int pname, float[] params, int offset) {
604  mgl.glTexEnvfv(target, pname, params, offset);
605  }
606 
607  public void glTexEnvfv(int target, int pname, FloatBuffer params) {
608  mgl.glTexEnvfv(target, pname, params);
609  }
610 
611  public void glTexEnvx(int target, int pname, int param) {
612  mgl.glTexEnvx(target, pname, param);
613  }
614 
615  public void glTexEnvxv(int target, int pname, int[] params, int offset) {
616  mgl.glTexEnvxv(target, pname, params, offset);
617  }
618 
619  public void glTexEnvxv(int target, int pname, IntBuffer params) {
620  mgl.glTexEnvxv(target, pname, params);
621  }
622 
623  public void glTexImage2D(int target, int level, int internalformat,
624  int width, int height, int border, int format, int type,
625  Buffer pixels) {
626  mgl.glTexImage2D(target, level, internalformat, width, height, border,
627  format, type, pixels);
628  }
629 
630  public void glTexParameterf(int target, int pname, float param) {
631  mgl.glTexParameterf(target, pname, param);
632  }
633 
634  public void glTexParameterx(int target, int pname, int param) {
635  mgl.glTexParameterx(target, pname, param);
636  }
637 
638  public void glTexParameteriv(int target, int pname, int[] params, int offset) {
639  mgl11.glTexParameteriv(target, pname, params, offset);
640  }
641 
642  public void glTexParameteriv(int target, int pname, IntBuffer params) {
643  mgl11.glTexParameteriv(target, pname, params);
644  }
645 
646  public void glTexSubImage2D(int target, int level, int xoffset,
647  int yoffset, int width, int height, int format, int type,
648  Buffer pixels) {
649  mgl.glTexSubImage2D(target, level, xoffset, yoffset, width, height,
650  format, type, pixels);
651  }
652 
653  public void glTranslatef(float x, float y, float z) {
654  mCurrent.glTranslatef(x, y, z);
655  mgl.glTranslatef(x, y, z);
656  if ( _check) check();
657  }
658 
659  public void glTranslatex(int x, int y, int z) {
660  mCurrent.glTranslatex(x, y, z);
661  mgl.glTranslatex(x, y, z);
662  if ( _check) check();
663  }
664 
665  public void glVertexPointer(int size, int type,
666  int stride, Buffer pointer) {
667  mgl.glVertexPointer(size, type, stride, pointer);
668  }
669 
670  public void glViewport(int x, int y, int width, int height) {
671  mgl.glViewport(x, y, width, height);
672  }
673 
674  public void glClipPlanef(int plane, float[] equation, int offset) {
675  mgl11.glClipPlanef(plane, equation, offset);
676  }
677 
678  public void glClipPlanef(int plane, FloatBuffer equation) {
679  mgl11.glClipPlanef(plane, equation);
680  }
681 
682  public void glClipPlanex(int plane, int[] equation, int offset) {
683  mgl11.glClipPlanex(plane, equation, offset);
684  }
685 
686  public void glClipPlanex(int plane, IntBuffer equation) {
687  mgl11.glClipPlanex(plane, equation);
688  }
689 
690  // Draw Texture Extension
691 
692  public void glDrawTexfOES(float x, float y, float z,
693  float width, float height) {
694  mgl11Ext.glDrawTexfOES(x, y, z, width, height);
695  }
696 
697  public void glDrawTexfvOES(float[] coords, int offset) {
698  mgl11Ext.glDrawTexfvOES(coords, offset);
699  }
700 
701  public void glDrawTexfvOES(FloatBuffer coords) {
702  mgl11Ext.glDrawTexfvOES(coords);
703  }
704 
705  public void glDrawTexiOES(int x, int y, int z, int width, int height) {
706  mgl11Ext.glDrawTexiOES(x, y, z, width, height);
707  }
708 
709  public void glDrawTexivOES(int[] coords, int offset) {
710  mgl11Ext.glDrawTexivOES(coords, offset);
711  }
712 
713  public void glDrawTexivOES(IntBuffer coords) {
714  mgl11Ext.glDrawTexivOES(coords);
715  }
716 
717  public void glDrawTexsOES(short x, short y, short z,
718  short width, short height) {
719  mgl11Ext.glDrawTexsOES(x, y, z, width, height);
720  }
721 
722  public void glDrawTexsvOES(short[] coords, int offset) {
723  mgl11Ext.glDrawTexsvOES(coords, offset);
724  }
725 
726  public void glDrawTexsvOES(ShortBuffer coords) {
727  mgl11Ext.glDrawTexsvOES(coords);
728  }
729 
730  public void glDrawTexxOES(int x, int y, int z, int width, int height) {
731  mgl11Ext.glDrawTexxOES(x, y, z, width, height);
732  }
733 
734  public void glDrawTexxvOES(int[] coords, int offset) {
735  mgl11Ext.glDrawTexxvOES(coords, offset);
736  }
737 
738  public void glDrawTexxvOES(IntBuffer coords) {
739  mgl11Ext.glDrawTexxvOES(coords);
740  }
741 
742  public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset,
743  int[] exponent, int exponentOffset) {
744  return mgl10Ext.glQueryMatrixxOES(mantissa, mantissaOffset,
745  exponent, exponentOffset);
746  }
747 
748  public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent) {
749  return mgl10Ext.glQueryMatrixxOES(mantissa, exponent);
750  }
751 
752  // Unsupported GL11 methods
753 
754  public void glBindBuffer(int target, int buffer) {
755  throw new UnsupportedOperationException();
756  }
757 
758  public void glBufferData(int target, int size, Buffer data, int usage) {
759  throw new UnsupportedOperationException();
760  }
761 
762  public void glBufferSubData(int target, int offset, int size, Buffer data) {
763  throw new UnsupportedOperationException();
764  }
765 
766  public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
767  throw new UnsupportedOperationException();
768  }
769 
770  public void glDeleteBuffers(int n, int[] buffers, int offset) {
771  throw new UnsupportedOperationException();
772  }
773 
774  public void glDeleteBuffers(int n, IntBuffer buffers) {
775  throw new UnsupportedOperationException();
776  }
777 
778  public void glGenBuffers(int n, int[] buffers, int offset) {
779  throw new UnsupportedOperationException();
780  }
781 
782  public void glGenBuffers(int n, IntBuffer buffers) {
783  throw new UnsupportedOperationException();
784  }
785 
786  public void glGetBooleanv(int pname, boolean[] params, int offset) {
787  throw new UnsupportedOperationException();
788  }
789 
790  public void glGetBooleanv(int pname, IntBuffer params) {
791  throw new UnsupportedOperationException();
792  }
793 
794  public void glGetBufferParameteriv(int target, int pname, int[] params, int offset) {
795  throw new UnsupportedOperationException();
796  }
797 
798  public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
799  throw new UnsupportedOperationException();
800  }
801 
802  public void glGetClipPlanef(int pname, float[] eqn, int offset) {
803  throw new UnsupportedOperationException();
804  }
805 
806  public void glGetClipPlanef(int pname, FloatBuffer eqn) {
807  throw new UnsupportedOperationException();
808  }
809 
810  public void glGetClipPlanex(int pname, int[] eqn, int offset) {
811  throw new UnsupportedOperationException();
812  }
813 
814  public void glGetClipPlanex(int pname, IntBuffer eqn) {
815  throw new UnsupportedOperationException();
816  }
817 
818  public void glGetFixedv(int pname, int[] params, int offset) {
819  throw new UnsupportedOperationException();
820  }
821 
822  public void glGetFixedv(int pname, IntBuffer params) {
823  throw new UnsupportedOperationException();
824  }
825 
826  public void glGetFloatv(int pname, float[] params, int offset) {
827  throw new UnsupportedOperationException();
828  }
829 
830  public void glGetFloatv(int pname, FloatBuffer params) {
831  throw new UnsupportedOperationException();
832  }
833 
834  public void glGetLightfv(int light, int pname, float[] params, int offset) {
835  throw new UnsupportedOperationException();
836  }
837 
838  public void glGetLightfv(int light, int pname, FloatBuffer params) {
839  throw new UnsupportedOperationException();
840  }
841 
842  public void glGetLightxv(int light, int pname, int[] params, int offset) {
843  throw new UnsupportedOperationException();
844  }
845 
846  public void glGetLightxv(int light, int pname, IntBuffer params) {
847  throw new UnsupportedOperationException();
848  }
849 
850  public void glGetMaterialfv(int face, int pname, float[] params, int offset) {
851  throw new UnsupportedOperationException();
852  }
853 
854  public void glGetMaterialfv(int face, int pname, FloatBuffer params) {
855  throw new UnsupportedOperationException();
856  }
857 
858  public void glGetMaterialxv(int face, int pname, int[] params, int offset) {
859  throw new UnsupportedOperationException();
860  }
861 
862  public void glGetMaterialxv(int face, int pname, IntBuffer params) {
863  throw new UnsupportedOperationException();
864  }
865 
866  public void glGetTexEnviv(int env, int pname, int[] params, int offset) {
867  throw new UnsupportedOperationException();
868  }
869 
870  public void glGetTexEnviv(int env, int pname, IntBuffer params) {
871  throw new UnsupportedOperationException();
872  }
873 
874  public void glGetTexEnvxv(int env, int pname, int[] params, int offset) {
875  throw new UnsupportedOperationException();
876  }
877 
878  public void glGetTexEnvxv(int env, int pname, IntBuffer params) {
879  throw new UnsupportedOperationException();
880  }
881 
882  public void glGetTexParameterfv(int target, int pname, float[] params, int offset) {
883  throw new UnsupportedOperationException();
884  }
885 
886  public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
887  throw new UnsupportedOperationException();
888  }
889 
890  public void glGetTexParameteriv(int target, int pname, int[] params, int offset) {
891  throw new UnsupportedOperationException();
892  }
893 
894  public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
895  throw new UnsupportedOperationException();
896  }
897 
898  public void glGetTexParameterxv(int target, int pname, int[] params, int offset) {
899  throw new UnsupportedOperationException();
900  }
901 
902  public void glGetTexParameterxv(int target, int pname, IntBuffer params) {
903  throw new UnsupportedOperationException();
904  }
905 
906  public boolean glIsBuffer(int buffer) {
907  throw new UnsupportedOperationException();
908  }
909 
910  public boolean glIsEnabled(int cap) {
911  throw new UnsupportedOperationException();
912  }
913 
914  public boolean glIsTexture(int texture) {
915  throw new UnsupportedOperationException();
916  }
917 
918  public void glPointParameterf(int pname, float param) {
919  throw new UnsupportedOperationException();
920  }
921 
922  public void glPointParameterfv(int pname, float[] params, int offset) {
923  throw new UnsupportedOperationException();
924  }
925 
926  public void glPointParameterfv(int pname, FloatBuffer params) {
927  throw new UnsupportedOperationException();
928  }
929 
930  public void glPointParameterx(int pname, int param) {
931  throw new UnsupportedOperationException();
932  }
933 
934  public void glPointParameterxv(int pname, int[] params, int offset) {
935  throw new UnsupportedOperationException();
936  }
937 
938  public void glPointParameterxv(int pname, IntBuffer params) {
939  throw new UnsupportedOperationException();
940  }
941 
942  public void glPointSizePointerOES(int type, int stride, Buffer pointer) {
943  throw new UnsupportedOperationException();
944  }
945 
946  public void glTexEnvi(int target, int pname, int param) {
947  throw new UnsupportedOperationException();
948  }
949 
950  public void glTexEnviv(int target, int pname, int[] params, int offset) {
951  throw new UnsupportedOperationException();
952  }
953 
954  public void glTexEnviv(int target, int pname, IntBuffer params) {
955  throw new UnsupportedOperationException();
956  }
957 
958  public void glTexParameterfv(int target, int pname, float[] params, int offset) {
959  throw new UnsupportedOperationException();
960  }
961 
962  public void glTexParameterfv(int target, int pname, FloatBuffer params) {
963  throw new UnsupportedOperationException();
964  }
965 
966  public void glTexParameteri(int target, int pname, int param) {
967  throw new UnsupportedOperationException();
968  }
969 
970  public void glTexParameterxv(int target, int pname, int[] params, int offset) {
971  throw new UnsupportedOperationException();
972  }
973 
974  public void glTexParameterxv(int target, int pname, IntBuffer params) {
975  throw new UnsupportedOperationException();
976  }
977 
978  public void glColorPointer(int size, int type, int stride, int offset) {
979  throw new UnsupportedOperationException();
980  }
981 
982  public void glDrawElements(int mode, int count, int type, int offset) {
983  throw new UnsupportedOperationException();
984  }
985 
986  public void glGetPointerv(int pname, Buffer[] params) {
987  throw new UnsupportedOperationException();
988  }
989 
990  public void glNormalPointer(int type, int stride, int offset) {
991  throw new UnsupportedOperationException();
992  }
993 
994  public void glTexCoordPointer(int size, int type, int stride, int offset) {
995  throw new UnsupportedOperationException();
996  }
997 
998  public void glVertexPointer(int size, int type, int stride, int offset) {
999  throw new UnsupportedOperationException();
1000  }
1001 
1002  public void glCurrentPaletteMatrixOES(int matrixpaletteindex) {
1003  throw new UnsupportedOperationException();
1004  }
1005 
1007  throw new UnsupportedOperationException();
1008  }
1009 
1010  public void glMatrixIndexPointerOES(int size, int type, int stride,
1011  Buffer pointer) {
1012  throw new UnsupportedOperationException();
1013  }
1014 
1015  public void glMatrixIndexPointerOES(int size, int type, int stride,
1016  int offset) {
1017  throw new UnsupportedOperationException();
1018  }
1019 
1020  public void glWeightPointerOES(int size, int type, int stride,
1021  Buffer pointer) {
1022  throw new UnsupportedOperationException();
1023  }
1024 
1025  public void glWeightPointerOES(int size, int type, int stride, int offset) {
1026  throw new UnsupportedOperationException();
1027  }
1028 
1033  public void getMatrix(float[] m, int offset) {
1034  mCurrent.getMatrix(m, offset);
1035  }
1036 
1041  public int getMatrixMode() {
1042  return mMatrixMode;
1043  }
1044 
1045  private void check() {
1046  int oesMode;
1047  switch (mMatrixMode) {
1048  case GL_MODELVIEW:
1049  oesMode = GL11.GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES;
1050  break;
1051  case GL_PROJECTION:
1052  oesMode = GL11.GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES;
1053  break;
1054  case GL_TEXTURE:
1055  oesMode = GL11.GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES;
1056  break;
1057  default:
1058  throw new IllegalArgumentException("Unknown matrix mode");
1059  }
1060 
1061  if ( mByteBuffer == null) {
1062  mCheckA = new float[16];
1063  mCheckB = new float[16];
1064  mByteBuffer = ByteBuffer.allocateDirect(64);
1065  mByteBuffer.order(ByteOrder.nativeOrder());
1066  mFloatBuffer = mByteBuffer.asFloatBuffer();
1067  }
1068  mgl.glGetIntegerv(oesMode, mByteBuffer.asIntBuffer());
1069  for(int i = 0; i < 16; i++) {
1070  mCheckB[i] = mFloatBuffer.get(i);
1071  }
1072  mCurrent.getMatrix(mCheckA, 0);
1073 
1074  boolean fail = false;
1075  for(int i = 0; i < 16; i++) {
1076  if (mCheckA[i] != mCheckB[i]) {
1077  Log.d("GLMatWrap", "i:" + i + " a:" + mCheckA[i]
1078  + " a:" + mCheckB[i]);
1079  fail = true;
1080  }
1081  }
1082  if (fail) {
1083  throw new IllegalArgumentException("Matrix math difference.");
1084  }
1085  }
1086 
1087 }