diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 1728b0516b..9aa756796e 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -1765,11 +1765,15 @@ void SoftwareGLContext::gl_bind_texture(GLenum target, GLuint texture) } auto it = m_allocated_textures.find(texture); + RefPtr texture_object; - // The texture name does not exist - RETURN_WITH_ERROR_IF(it == m_allocated_textures.end(), GL_INVALID_VALUE); - - auto texture_object = it->value; + // OpenGL 1.x supports binding texture names that were not previously generated by glGenTextures. + // If there is not an allocated texture, meaning it was not previously generated by glGenTextures, + // we can keep texture_object null to both allocate and bind the texture with the passed in texture name. + // FIXME: Later OpenGL versions such as 4.x enforce that texture names being bound were previously generated + // by glGenTextures. + if (it != m_allocated_textures.end()) + texture_object = it->value; // Binding a texture to a different target than it was first bound is an invalid operation // FIXME: We only support GL_TEXTURE_2D for now