我想複製教程(精靈渲染),使用OpenGL版本> = 3.3。如何使用不同的OpenGL配置文件?
例如幾何着色器3.2中引入的,我得到這個錯誤:
error: ‘GL_GEOMETRY_SHADER’ was not declared in this scope
我更新了我的檯面驅動程序到最新;我不太瞭解,但在C++編譯/鏈接時如何選擇更新版本的OpenGL:
➜glxinfo | grep -i「版本」
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
Version: 17.1.4
Max core profile version: 4.5
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.1
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.1.4
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 17.1.4
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 17.1.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
我不能真正理解這一點,但它說有某種核心配置文件使用4.5版。我如何利用這個配置文件?
我初始化GL上下文在我的代碼是這樣的:
if(!glfwInit()) e_glfw_init();
m_window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE.c_str(), nullptr, nullptr);
if(m_window == nullptr) e_window_context();
glfwMakeContextCurrent(m_window);
glewExperimental = true;
if(glewInit() != GLEW_OK) e_glew_init();
你如何初始化你的上下文? – BDL
你使用的是什麼OpenGL頭文件/加載庫? –
@NicolBolas我包括這些標題: 'GL/glew.h' 'GLFW/glfw3.h' 'GLM/glm.hpp' 'GL/glu.h' 'GLM/GTC/type_ptr .hpp' –