Java Code Examples for android.opengl.GLES30#glGetError()

The following examples show how to use android.opengl.GLES30#glGetError() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlUtil.java    From ShapesInOpenGLES2.0 with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 2
Source File: GlUtil.java    From cineio-broadcast-android with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 3
Source File: GlUtil.java    From AndroidPlayground with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 4
Source File: GlUtil.java    From pause-resume-video-recording with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 5
Source File: GlUtil.java    From MockCamera with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 6
Source File: GlUtil.java    From grafika with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 7
Source File: GlUtil.java    From LiveVideoBroadcaster with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 8
Source File: GlUtil.java    From VIA-AI with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 9
Source File: GLUtils.java    From Fatigue-Detection with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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 (CHECK_GLES30) {
        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);
        }
    }
}
 
Example 10
Source File: GlUtil.java    From kickflip-android-sdk with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 11
Source File: GLUtils.java    From In77Camera with MIT License 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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 (CHECK_GLES30) {
        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);
        }
    }
}
 
Example 12
Source File: GlUtil.java    From RtmpPublisher with Apache License 2.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 13
Source File: GlUtil.java    From mobile-ar-sensor-logger with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Writes GL version info to the log.
 */
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);
        }
    }
}
 
Example 14
Source File: GlUtil.java    From sealrtc-android with MIT License 5 votes vote down vote up
/** Writes GL version info to the log. */
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));

    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, "glVersion: " + majorVersion + "." + minorVersion);
    }
}
 
Example 15
Source File: GLHelper.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
	 * OpenGL|ESのエラーをチェックしてlogCatに出力する
	 * @param op
	 */
    public static void checkGlError(final String op) {
        final int error = GLES30.glGetError();
        if (error != GLES30.GL_NO_ERROR) {
            final String msg = op + ": glError 0x" + Integer.toHexString(error);
			Log.e(TAG, msg);
			Stacktrace.print();
//         	if (DEBUG) {
//	            throw new RuntimeException(msg);
//       	}
        }
    }
 
Example 16
Source File: GLContext.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * 対応するOpenGL|ESのバージョンを取得する
 * @return 0以下なら何らかの理由でバージョンを取得できなかった
 * 			それ以外は整数部: メジャーバージョン, 小数部: マイナーバージョン
 */
@SuppressLint("InlinedApi")
public static float supportedGLESVersion() {
	float result = 0.0f;

	if (BuildCheck.isAndroid4_3()) {
		final int[] values = new int[1];
		GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
		final int majorVersion = values[0];
		GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
		final int minorVersion = values[0];
		if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
			result = majorVersion + minorVersion * 0.1f;
		}
	}
	if (result <= 0.0f) {
		// バージョンを取得できなかったときは
		// ro.opengles.versionプロパティからの読み込みを試みる
		final String openGLESVersionString
			= SysPropReader.read("ro.opengles.version");
		if (!TextUtils.isEmpty(openGLESVersionString)) {
			try {
				final int openGLESVersion = Integer.parseInt(openGLESVersionString);
				result = ((openGLESVersion & 0xffff0000) >> 16)
					+ 0.1f * (openGLESVersion & 0x0000ffff);
			} catch (final NumberFormatException e) {
				if (DEBUG) Log.w(TAG, e);
			}
		} else {
			if (DEBUG) Log.v(TAG, "supportedGLESVersion:has no ro.opengles.version value");
		}
	}
	return result;
}
 
Example 17
Source File: VideoRecorder.java    From VideoRecorder with Apache License 2.0 4 votes vote down vote up
/**
     * 渲染一帧
     *
     * @param renderer
     * @param windowSurface
     * @return swapBuffers
     */
    @Override
    public synchronized boolean onDrawFrame(CameraGLRenderer renderer, EglSurfaceBase windowSurface) {
        boolean swapBuffers;
        long startTime = System.currentTimeMillis();
        //使用mSync同步锁将导致录制开始的时候卡顿一下
//        && !mRequestStart && !mRequestStop
        if (mInputWindowSurface != null && mVideoEncoder != null && mRecordEnabled && mMuxerRunning && mPreviewState) {
            if (GLUtil.GL_VERSION >= 3) {

                windowSurface.makeCurrent();
                renderer.onDrawFrame();
                mInputWindowSurface.makeCurrentReadFrom(windowSurface);
                mVideoEncoder.frameAvailableSoon();
                GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
                GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
                GLUtil.checkGlError("before glBlitFramebuffer");
                GLES30.glBlitFramebuffer(
                        0, 0, windowSurface.getWidth(), windowSurface.getHeight(),
                        0, 0, windowSurface.getWidth(), windowSurface.getHeight(),
                        GLES30.GL_COLOR_BUFFER_BIT, GLES30.GL_NEAREST);

                int err;
                if ((err = GLES30.glGetError()) != GLES30.GL_NO_ERROR) {
                    LogUtil.logw("ERROR: glBlitFramebuffer failed: 0x" + Integer.toHexString(err));
                }
                mInputWindowSurface.swapBuffers();
                windowSurface.makeCurrent();
                swapBuffers = windowSurface.swapBuffers();
            } else {
                windowSurface.makeCurrent();
                renderer.onDrawFrame();
                swapBuffers = windowSurface.swapBuffers();

                mInputWindowSurface.makeCurrent();
                mVideoEncoder.frameAvailableSoon();
                renderer.onDrawFrame();
                mInputWindowSurface.swapBuffers();
            }
        } else {
            windowSurface.makeCurrent();
            renderer.onDrawFrame();
            swapBuffers = windowSurface.swapBuffers();
        }
        LogUtil.logv("onDrawFrame ----> " + (System.currentTimeMillis() - startTime) + "ms");

        if (mByteBuffer != null && mTakePicture) {
            mByteBuffer.rewind();
            GLES20.glReadPixels(0, 0, mSize.getWidth(), mSize.getHeight(), GLES30.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, mByteBuffer);
            new SaveFrameTask(mSize.getWidth(), mSize.getHeight(), mPictureCallback).execute(mByteBuffer);
            mTakePicture = false;
            mPictureCallback = null;
            mByteBuffer = null;
        }
        return swapBuffers;
    }
 
Example 18
Source File: myRenderer.java    From opengl with Apache License 2.0 3 votes vote down vote up
/**
 * Utility method for debugging OpenGL calls. Provide the name of the call
 * just after making it:
 *
 * <pre>
 * mColorHandle = GLES30.glGetUniformLocation(mProgram, "vColor");
 * MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
 *
 * If the operation is not successful, the check throws an error.
 *
 * @param glOperation - Name of the OpenGL call to check.
 */
public static void checkGlError(String glOperation) {
    int error;
    while ((error = GLES30.glGetError()) != GLES30.GL_NO_ERROR) {
        Log.e(TAG, glOperation + ": glError " + error);
        throw new RuntimeException(glOperation + ": glError " + error);
    }
}
 
Example 19
Source File: myRenderer.java    From opengl with Apache License 2.0 3 votes vote down vote up
/**
 * Utility method for debugging OpenGL calls. Provide the name of the call
 * just after making it:
 *
 * <pre>
 * mColorHandle = GLES30.glGetUniformLocation(mProgram, "vColor");
 * MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
 *
 * If the operation is not successful, the check throws an error.
 *
 * @param glOperation - Name of the OpenGL call to check.
 */
public static void checkGlError(String glOperation) {
    int error;
    while ((error = GLES30.glGetError()) != GLES30.GL_NO_ERROR) {
        Log.e(TAG, glOperation + ": glError " + error);
        throw new RuntimeException(glOperation + ": glError " + error);
    }
}
 
Example 20
Source File: MyGLRenderer.java    From opengl with Apache License 2.0 3 votes vote down vote up
/**
* Utility method for debugging OpenGL calls. Provide the name of the call
* just after making it:
*
* <pre>
* mColorHandle = GLES30.glGetUniformLocation(mProgram, "vColor");
* MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
*
* If the operation is not successful, the check throws an error.
*
* @param glOperation - Name of the OpenGL call to check.
*/
public static void checkGlError(String glOperation) {
    int error;
    while ((error = GLES30.glGetError()) != GLES30.GL_NO_ERROR) {
        Log.e(TAG, glOperation + ": glError " + error);
        throw new RuntimeException(glOperation + ": glError " + error);
    }
}