Glxinfo opengl version

I’m trying to figure out my OpenGL version. I’m running a Fedora 29 vmware guest in win10 host. If I use software rendering (through Mesa), I get

$ LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVE=softpipe glxinfo | grep OpenGL
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 7.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.3.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 18.3.6
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

Why are two versions, 3.3 (core) and 3.1, reported? Does it mean when requested for a 3.3 context, the only possible profile is core profile while if I request for 3.1, it can be either core or compatibility profile? But when I tested with code (using freeglut) and requesting for 3.3 (core profile), I can only get 3.1. I’ve tested the code with softpipe and llvmpipe. Furthermore the profile returned in the code below is always 0.

glutInitContextVersion(3, 3); 
glutInitContextProfile(GLUT_CORE_PROFILE);   
std::cout << "OpenGL version: " << glGetString(GL_VERSION) << '\n';
std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION)
          << '\n';
int major = 0;
int minor = 0;
int profile = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
std::cout << "major:" << major << '\n'
          << "minor:" << minor << '\n'
          << "profile:" << profile << '\n';

So why is glxinfo reporting 3.3 (core)? Or am I reading glxinfo wrongly?

There are two OpenGL profiles being referred to here. The first is the “OpenGL Core Profile” version (3.3), and the second is the “OpenGL Compatibility Profile” version (3.1).

Yes.

That’s strange. It calls into question whether you and the GLUT you are using are properly trying to create a core profile.

Profiles weren’t introduced until 3.2. 3.1 is effectively core profile only. 3.1 was the version where Khronos decided that they could discard all of the legacy stuff, a decision which was walked back in 3.2 with the introduction of profiles.

You shouldn’t be calling any OpenGL functions until you’ve created a window.