OSDN Git Service

Add a public API that reports the supported OpenGLES API level.
authorJack Palevich <jackpal@google.com>
Wed, 22 Jul 2009 19:59:49 +0000 (12:59 -0700)
committerJack Palevich <jackpal@google.com>
Wed, 22 Jul 2009 19:59:49 +0000 (12:59 -0700)
api/current.xml
opengl/java/android/opengl/Version.java [new file with mode: 0644]

index 46969e0..a730ed0 100644 (file)
 </parameter>
 </method>
 </class>
+<class name="Version"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="Version"
+ type="android.opengl.Version"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="getOpenGLESVersion"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="OPENGLES_11"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="11"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPENGLES_20"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="20"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 <class name="Visibility"
  extends="java.lang.Object"
  abstract="false"
diff --git a/opengl/java/android/opengl/Version.java b/opengl/java/android/opengl/Version.java
new file mode 100644 (file)
index 0000000..6e89d7e
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.opengl;
+
+import android.os.SystemProperties;
+
+public final class Version {
+    /**
+     * Return the highest OpenGL ES API level supported by the current device.
+     * <p>
+     * A device that supports a given API level must also support
+     * numerically smaller API levels.
+     * <p>
+     * A device that supports a given API level may not necessarily
+     * support every feature of that API level. API-specific techniques may
+     * be used to determine whether specific features are supported.
+     *
+     * @return the highest OpenGL ES API level supported by the current device.
+     */
+    public static int getOpenGLESVersion() {
+        return SystemProperties.getInt("ro.opengles.version", OPENGLES_11);
+    }
+
+    /**
+     * The version number for OpenGL ES 1.1.
+     */
+    public final static int OPENGLES_11 = 11;
+
+    /**
+     * The version number for OpenGL ES 2.0.
+     */
+    public final static int OPENGLES_20 = 20;
+}