luminance texture under GL3.2

I am a bit confused on how I can get luminance textures under OpenGL 3.2

In the good old days, the following would work

  
  GLuint texname;
  glGenTextures(1, &texname);
  glBindTexture (GL_TEXTURE_3D, texname);
  glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, 
                  GL_LINEAR);
  glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, 
                  GL_LINEAR);
  glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, 
                   GL_REPEAT);
  glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,   
                   GL_REPEAT);
  glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_WRAP_R,  
                   GL_REPEAT);
  glTexImage3D (GL_TEXTURE_3D, 0, GL_LUMINANCE, 64, 64, 64, 0,
                GL_LUMINANCE, GL_UNSIGNED_BYTE, texels);

That doesnt seem to go with GL3.2, is there another format that I should use or whats the trick with luminance in GL3.2?

Luminance textures are deprecated in 3.0 and removed from 3.1 core and above. You can use them directly if you create a compatibility context (or if ARB_compatibility is defined).

Otherwise, you’re going to have to use a GL_RED or GL_RG texture format. And your shader will need to replicate the components.

However, there is EXT_texture_swizzle, which provides a way to turn a GL_RED texture into the equivalent of GL_LUMINANCE.