diff --git a/Libraries/LibWeb/WebGL/OpenGLContext.cpp b/Libraries/LibWeb/WebGL/OpenGLContext.cpp index 702f45a0dc8..e33241f6457 100644 --- a/Libraries/LibWeb/WebGL/OpenGLContext.cpp +++ b/Libraries/LibWeb/WebGL/OpenGLContext.cpp @@ -194,22 +194,19 @@ void OpenGLContext::allocate_painting_surface_if_needed() eglMakeCurrent(m_impl->display, m_impl->surface, m_impl->surface, m_impl->context); - // This extension is not enabled by default in WebGL compatibility mode, so we need to request it. - glRequestExtensionANGLE("GL_ANGLE_texture_rectangle"); - - EGLint texture_target_angle = 0; - eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_TARGET_ANGLE, &texture_target_angle); - VERIFY(texture_target_angle == EGL_TEXTURE_RECTANGLE_ANGLE); + EGLint texture_target_name = 0; + eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_TARGET_ANGLE, &texture_target_name); + VERIFY(texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE || texture_target_name == EGL_TEXTURE_2D); GLuint texture = 0; glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_RECTANGLE_ANGLE, texture); + glBindTexture(texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE ? GL_TEXTURE_RECTANGLE_ANGLE : GL_TEXTURE_2D, texture); auto result = eglBindTexImage(display, m_impl->surface, EGL_BACK_BUFFER); VERIFY(result == EGL_TRUE); glGenFramebuffers(1, &m_impl->framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, m_impl->framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, texture, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture_target_name == EGL_TEXTURE_RECTANGLE_ANGLE ? GL_TEXTURE_RECTANGLE_ANGLE : GL_TEXTURE_2D, texture, 0); // NOTE: ANGLE doesn't allocate depth buffer for us, so we need to do it manually // FIXME: Depth buffer only needs to be allocated if it's configured in WebGL context attributes