Im trying to start using opengl I’m running into some problems.
After running this code
#include "glad/glad.h"
#include <GLFW/glfw3.h>
#include <iostream>
static void glfwError(int id, const char* description) {
std::cout << description << std::endl;
}
int main() {
glfwSetErrorCallback(&glfwError);
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGl", NULL, NULL );
if (window == NULL) {
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
glViewport(0, 0, 800, 600);
while (!glfwWindowShouldClose(window)) {
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
compiling with
g++ hello_window.cpp glad.c -o prova -lGL -lglfw3
I get this output launching the executable:
Context profiles are only defined for OpenGL version 3.2 and above
It seems to mean that I don’t have access to OpenGl 3.2 and above but running
inxi -b | grep API
results in the output
API: OpenGL v: 4.6.0 vendor: nvidia v: 565.77
Thanks to anyone that can help me.