Check if there is a current context before generating textures/FBOs.
This avoids silent failures where the generated identifiers are 0. PiperOrigin-RevId: 437775689
This commit is contained in:
parent
d2a9419ad3
commit
0724e2b99f
@ -371,6 +371,9 @@ public final class GlUtil {
|
|||||||
* GLES11Ext#GL_TEXTURE_EXTERNAL_OES} for an external texture.
|
* GLES11Ext#GL_TEXTURE_EXTERNAL_OES} for an external texture.
|
||||||
*/
|
*/
|
||||||
private static int generateAndBindTexture(int textureTarget) {
|
private static int generateAndBindTexture(int textureTarget) {
|
||||||
|
checkEglException(
|
||||||
|
!Util.areEqual(EGL14.eglGetCurrentContext(), EGL14.EGL_NO_CONTEXT), "No current context");
|
||||||
|
|
||||||
int[] texId = new int[1];
|
int[] texId = new int[1];
|
||||||
GLES20.glGenTextures(/* n= */ 1, texId, /* offset= */ 0);
|
GLES20.glGenTextures(/* n= */ 1, texId, /* offset= */ 0);
|
||||||
checkGlError();
|
checkGlError();
|
||||||
@ -391,6 +394,9 @@ public final class GlUtil {
|
|||||||
* @param texId The identifier of the texture to attach to the framebuffer.
|
* @param texId The identifier of the texture to attach to the framebuffer.
|
||||||
*/
|
*/
|
||||||
public static int createFboForTexture(int texId) {
|
public static int createFboForTexture(int texId) {
|
||||||
|
checkEglException(
|
||||||
|
!Util.areEqual(EGL14.eglGetCurrentContext(), EGL14.EGL_NO_CONTEXT), "No current context");
|
||||||
|
|
||||||
int[] fboId = new int[1];
|
int[] fboId = new int[1];
|
||||||
GLES20.glGenFramebuffers(/* n= */ 1, fboId, /* offset= */ 0);
|
GLES20.glGenFramebuffers(/* n= */ 1, fboId, /* offset= */ 0);
|
||||||
checkGlError();
|
checkGlError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user