GLWrapperBase.java revision d70213e70ed4b2648d696a554a0ba7dac4c32757
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
17package android.opengl;
18
19import javax.microedition.khronos.opengles.GL;
20import javax.microedition.khronos.opengles.GL10;
21import javax.microedition.khronos.opengles.GL10Ext;
22import javax.microedition.khronos.opengles.GL11;
23import javax.microedition.khronos.opengles.GL11Ext;
24import javax.microedition.khronos.opengles.GL11ExtensionPack;
25
26/**
27 * The abstract base class for a GL wrapper. Provides
28 * some convenient instance variables and default implementations.
29 */
30abstract class GLWrapperBase
31    implements GL, GL10, GL10Ext, GL11, GL11Ext {
32    public GLWrapperBase(GL gl) {
33        mgl = (GL10) gl;
34        if (gl instanceof GL10Ext) {
35            mgl10Ext = (GL10Ext) gl;
36        }
37        if (gl instanceof GL11) {
38            mgl11 = (GL11) gl;
39        }
40        if (gl instanceof GL11Ext) {
41            mgl11Ext = (GL11Ext) gl;
42        }
43        if (gl instanceof GL11ExtensionPack) {
44            mgl11ExtensionPack = (GL11ExtensionPack) gl;
45        }
46    }
47
48    protected GL10 mgl;
49    protected GL10Ext mgl10Ext;
50    protected GL11 mgl11;
51    protected GL11Ext mgl11Ext;
52    protected GL11ExtensionPack mgl11ExtensionPack;
53}
54