don't pass GL_INTENSITY for <format> to glTexImage2D - it's illegal
diff --git a/progs/demos/texenv.c b/progs/demos/texenv.c
index d64ae2e..590867b 100644
--- a/progs/demos/texenv.c
+++ b/progs/demos/texenv.c
@@ -354,7 +354,8 @@
       break;
    case GL_INTENSITY:
       luminanceSize = 1;
-      textureFormat = GL_INTENSITY;
+      /* Note: format=GL_INTENSITY for glTexImage is not legal */
+      textureFormat = GL_LUMINANCE;
       break;
    case GL_ALPHA:
       alphaSize = 1;