Problem with generating triangles

Hi all, I am new. The title says all. I am trying to follow the basic tutorial for generating shapes in opengl using glfw. When it comes these lines:


GLFW error 65543: Requested OpenGL version 4.4, got version 2.1
Failed to create a glfw window

Even though I use a version 2 or 3 for both major and minor context version I return an error. This things is solved if I comment those lines. However I am never able to generate any shapes exept changing background color.

Another strange thing is that: if I ask read the output of

std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;
std::cout << "Version: " << glGetString(GL_VERSION) << std::endl;
std::cout << "Shading Language: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;

I obtain:
2.1 Mesa 10.0.2 (git-675cd84)
Renderer: Gallium 0.4 on llvmpipe (LLVM 3.4, 256 bits)
Version: 2.1 Mesa 10.0.2 (git-675cd84)
Shading Language: 1.30

So it looks like I have a 2.1 of opengl. However if I use the application OpenGL Extensions Viewer I got an OpenGL version 4.3 and the information are:

Renderer: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
Vendor: NVIDIA Corporation
Version: 4.6.0 NVIDIA 512.52
Shading language version: 4.60 NVIDIA

Max texture size: 32768 x 32768
Max vertex texture image units: 32
Max texture image units: 32
Max geometry texture units: 32
Max anisotropic filtering value: 16
Max viewport size: 32768 x 32768
Max Clip Distances: 8
Max samples: 16

Where I am wrong?
Thank you all!

What operating system are you on, and do you have a CPU with an integrated GPU (if so is your PC a laptop with NVIDIA Optimus technology or similar)?

Thanks for the reply. I do have a desktop computer Intel Core i5 8400 CPU 2.8GHz, 2808Mhz,6cores,6 logic processors with Windows 10 64bit with a separated graphic card (Nvidia Geforce GTX 1050 Ti)

Are you running the application under WSL2, MSYS2 or in a Virtual Machine? Normally you shouldn’t be seeing Mesa/Gallium unless you’ve installed it yourself somehow.

Interesting point. I actually work directly on my computer. However last year I enabled a kind of virtual machina to use Ubuntu on Windows. It is a feature available on Windows 10. I hope there are no interaction between them as I have installed several graphic libraries to visualize CFD results.
Is there any way to force it to see the correct opengl version?

I repeated all using, instead of Dev C++, Visual Studio 2022 and all works sweet.
So I must have made error in using glfw library. Instead in Visual Studio I had to generate the library by myself via CMake and the thing works better.

If I have some time I will try to repeat the same passage I have done with VS2022 with Dev C++.

Thank you. Topic can be closed.