| Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/TextureHelper.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/TextureHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/TextureHelper.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..63bcf4c3806ce61325e355ee1510e182199c2b87
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/TextureHelper.java
|
| @@ -0,0 +1,36 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser.vr_shell;
|
| +
|
| +import static android.opengl.GLES20.GL_NEAREST;
|
| +import static android.opengl.GLES20.GL_TEXTURE_MAG_FILTER;
|
| +import static android.opengl.GLES20.GL_TEXTURE_MIN_FILTER;
|
| +import static android.opengl.GLES20.glBindTexture;
|
| +import static android.opengl.GLES20.glGenTextures;
|
| +import static android.opengl.GLES20.glTexParameteri;
|
| +
|
| +import android.opengl.GLES11Ext;
|
| +
|
| +/**
|
| + * Helper class for working with OpenGL textures.
|
| + */
|
| +public class TextureHelper {
|
| + /**
|
| + * Create a new GLES11Ext.GL_TEXTURE_EXTERNAL_OES texture handle.
|
| + * @return New texture handle.
|
| + */
|
| + public static int createExternalTextureHandle() {
|
| + int[] textureDataHandle = new int[1];
|
| + glGenTextures(1, textureDataHandle, 0);
|
| + if (textureDataHandle[0] != 0) {
|
| + glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureDataHandle[0]);
|
| + glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
| + glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
| + return textureDataHandle[0];
|
| + } else {
|
| + throw new RuntimeException("Error generating texture handle.");
|
| + }
|
| + }
|
| +}
|
|
|