Reputation: 61
I'm running: FreeBSD 12.2-RELEASE and I have a ThinkPad x230 which I think it has an Intel HD 4000 GPU. I'm trying to run GLSL 4.20 with the core profile. When I run my program (written in C) I get:
Error - 0:1(10): error: GLSL 4.20 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES
However if I run the glxinfo
command I get (among other information) this:
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile
OpenGL core profile version string: 4.2 (Core Profile) Mesa 19.0.8
OpenGL core profile shading language version string: 4.20
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
GL_3DFX_texture_compression_FXT1, GL_AMD_conservative_depth,
GL_AMD_draw_buffers_blend, GL_AMD_multi_draw_indirect,
GL_AMD_seamless_cubemap_per_texture, GL_AMD_shader_trinary_minmax,
GL_AMD_texture_texture4, GL_AMD_vertex_shader_layer,
GL_AMD_vertex_shader_viewport_index, GL_ANGLE_texture_compression_dxt3,
GL_ANGLE_texture_compression_dxt5, GL_APPLE_object_purgeable,
GL_ARB_ES2_compatibility, GL_ARB_ES3_compatibility,
...
I've trimmed the above output as it is very extense. Moreover this Wikipedia link also asserts that OpenGL 4.20 is indeed supported by the GPU (though it refers only to GNU/Linux and Windows platforms). So I'm really puzzled if OpenGL 4.20 is supported or not in my system. Am I missing something or glxinfo
is not being accurate?
Also when I run glxgears -info
I get (full output also trimmed):
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER = Mesa DRI Intel(R) Ivybridge Mobile
GL_VERSION = 3.0 Mesa 19.0.8
GL_VENDOR = Intel Open Source Technology Center
...
And then if I set #version 300 core
both in my vertex and fragment shaders the same error pops up:
Error - 0:1(10): error: GLSL 3.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES
This error pops up when I'm compiling my shaders in the program. I'm using OpenGL through GLFW3
with GLAD
set to OpenGL version 4.20 and core profile from here. Any suggestions are more than welcome.
I'm editing my question adding the initialization code that I'm running:
struct GameContext* new_game_context(size_t width, size_t height) {
printf("[GameContext] new_game_context.\n");
struct GameContext* game_context = calloc(1, sizeof(struct GameContext));
abort_on(&null_pointer, (void*) game_context, GAME_CONTEXT_INSUFFICIENT_MEMORY);
game_context->keyboard = new_keyboard();
game_context->window = 0;
game_context->quit_game = false;
glfwInit();
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
game_context->window = glfwCreateWindow(width, height, "Test", 0, 0);
abort_on(&null_pointer, (void*) game_context->window, GAME_CONTEXT_GLFW_WINDOW_ERROR);
glfwMakeContextCurrent(game_context->window);
if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
abort_on(&always, NULL, GAME_CONTEXT_GLAD_ERROR);
glfwSwapInterval(1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glLineWidth(GAME_CONTEXT_LINE_WIDTH);
glfwSetKeyCallback(game_context->window, (GLFWkeyfun) handle_keyboard_event);
glfwSetWindowUserPointer(game_context->window, (void*) game_context->keyboard);
game_context->game_objects = create_game_objects();
return game_context;
}
Upvotes: 1
Views: 507
Reputation: 52084
Mesa's generally going to give you a GL 2.1 or 3.0 context unless you ask for something higher.
Use glfwWindowHint()
before glfwCreateWindow()
to set the GL version and Core-ness to request:
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 2 );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
Upvotes: 2