Example usage for android.opengl GLES20 glGetString

List of usage examples for android.opengl GLES20 glGetString

Introduction

In this page you can find the example usage for android.opengl GLES20 glGetString.

Prototype

public static native String glGetString(int name);

Source Link

Usage

From source file:Main.java

public static String[] getExtensions() {
    if (null == sExtenions) {
        sExtenions = GLES20.glGetString(GLES20.GL_EXTENSIONS).split("\\s");
    }//from  w  w w. j  a v  a2 s  . c  om
    return sExtenions;
}

From source file:Main.java

public static void PrintGLstring(String name, int s) {
    Log.i(TAG, String.format("GL %s = %s\n", name, GLES20.glGetString(s)));
}

From source file:Main.java

/**
 * Checks the GL_EXTENSIONS String for the given "extension". This method must only be called when a valid context
 * and surface is valid.//from   w  ww. ja v  a2 s.c o m
 *
 * @param extension
 * @return boolean
 */
public static boolean hasExtension(String extension) {
    String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);

    boolean foundExtension = false;

    if (extensions != null) {
        foundExtension = extensions.toLowerCase().contains(extension.toLowerCase());
    }

    return foundExtension;
}

From source file:Main.java

/**
 * Writes GL version info to the log./*  w  ww .  j av a2  s  .co m*/
 */
public static void logVersionInfo() {
    Log.i(TAG, "vendor  : " + GLES20.glGetString(GLES20.GL_VENDOR));
    Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
    Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));

    if (false) {
        int[] values = new int[1];
        GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
        int majorVersion = values[0];
        GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
        int minorVersion = values[0];
        if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
            Log.i(TAG, "iversion: " + majorVersion + "." + minorVersion);
        }
    }
}

From source file:com.github.javiersantos.piracychecker.LibraryUtils.java

/**
 * 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.//from  w w  w.j  a  va2s  . c o m
 *
 * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net)
 */
static boolean isInEmulator(boolean deepCheck) {
    int ratingCheckEmulator = 0;

    if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy")
            || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk")
            || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox")
            || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google")
            || Build.PRODUCT.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion")
            || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT")
            || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) {
        ratingCheckEmulator++;
    }

    if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM")
            || Build.BRAND.contains("Andy")) {
        ratingCheckEmulator++;
    }

    if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86")
            || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon")
            || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox")
            || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X")
            || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy")
            || Build.MODEL.equals("Android SDK built for x86_64")
            || Build.MODEL.equals("Android SDK built for x86")) {
        ratingCheckEmulator++;
    }

    if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox")
            || Build.HARDWARE.contains("ttVM_x86")) {
        ratingCheckEmulator++;
    }

    if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic")
            || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86")
            || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon")
            || Build.FINGERPRINT.contains("generic_x86_64")
            || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p")
            || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) {
        ratingCheckEmulator++;
    }

    if (deepCheck) {
        try {
            String opengl = GLES20.glGetString(GLES20.GL_RENDERER);
            if (opengl != null) {
                if (opengl.contains("Bluestacks") || opengl.contains("Translator"))
                    ratingCheckEmulator += 10;
            }
        } catch (Exception ignored) {
        }

        try {
            File sharedFolder = new File(Environment.getExternalStorageDirectory().toString()
                    + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder");
            if (sharedFolder.exists())
                ratingCheckEmulator += 10;
        } catch (Exception ignored) {
        }
    }

    return ratingCheckEmulator > 3;
}

From source file:com.example.patrycja.wikitudeapp.AbstractArchitectCamActivity.java

/**
 * helper to check if video-drawables are supported by this device. recommended to check before launching ARchitect Worlds with videodrawables
 * @return true if AR.VideoDrawables are supported, false if fallback rendering would apply (= show video fullscreen)
 *///from w  w  w .ja va2 s . c  om
public static final boolean isVideoDrawablesSupported() {
    String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
    return extensions != null && extensions.contains("GL_OES_EGL_image_external")
            && android.os.Build.VERSION.SDK_INT >= 14;
}

From source file:com.wikitude.samples.AbstractArchitectCamActivity.java

/**
 * helper to check if video-drawables are supported by this device. recommended to check before launching ARchitect Worlds with videodrawables
 * @return true if AR.VideoDrawables are supported, false if fallback rendering would apply (= show video fullscreen)
 *//* w  ww .  java  2s . c o  m*/
public static final boolean isVideoDrawablesSupported() {
    String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
    return extensions != null && extensions.contains("GL_OES_EGL_image_external");
}

From source file:at.kropf.curriculumvitae.augmented.AbstractArchitectCamActivity.java

/**
 * helper to check if video-drawables are supported by this device. recommended to check before launching ARchitect Worlds with videodrawables
 * @return true if AR.VideoDrawables are supported, false if fallback rendering would apply (= show video fullscreen)
 *//*w w w  .  java  2s  .c o m*/
public static final boolean isVideoDrawablesSupported() {
    String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
    return extensions != null && extensions.contains("GL_OES_EGL_image_external")
            && Build.VERSION.SDK_INT >= 14;
}

From source file:com.wikitude.virtualhome.AugmentedActivity.java

public static final boolean isVideoDrawablesSupported() {
    String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
    return extensions != null && extensions.contains("GL_OES_EGL_image_external")
            && android.os.Build.VERSION.SDK_INT >= 14;
}