Create the GL texture id at texture-binding time.
diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c
index 4e4f575..fbdb344 100644
--- a/dlls/ddraw/d3ddevice/mesa.c
+++ b/dlls/ddraw/d3ddevice/mesa.c
@@ -2257,7 +2257,7 @@
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
} else {
- GLenum tex_name = ((IDirect3DTextureGLImpl *) surf_ptr->tex_private)->tex_name;
+ GLenum tex_name = gltex_get_tex_name(surf_ptr);
unit = GL_TEXTURE0_WINE + stage;
if (unit != glThis->current_active_tex_unit) {