| Summary: | Fails create context for OpenGL 3.2 and above with glew | ||
|---|---|---|---|
| Product: | SDL | Reporter: | lemanyk <lemanyk> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED ABANDONED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | CC: | amaranth72, gabomdq, suds |
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
code sample
Minimum code to reproduce the problem |
||
|
Description
lemanyk
2013-10-10 13:10:08 UTC
Does your system and drivers have support for OpenGL 3.2+ compatibility profile contexts? You should check whether SDL_GL_CreateContext returns NULL. The MESA driver does not support compatibility profile contexts for OpenGL 3.x+, only core profile (and right now it doesn't support OpenGL 3.2, only 3.1.) If you're getting the error from glGetError, that's probably GLEW's fault, not SDL's or your code's. You will probably be able to ignore it (semi-) safely. Created attachment 1362 [details]
code sample
Does glew fail with an error, or does glGetError() just return an error status? If it's the latter, it just means that glew tried to query something that wasn't supported, and it's fine. glGetError() return an error status. My system support OpenGL4.3. I use glew 1.10, sdl2.0 and nvidia 325.15 driver I don't know why, but GLUT+GLEW works fine, eg this code running normal https://code.google.com/p/openglbook-samples/source/browse/trunk/Chapter%202/OpenGL%203.3/Chapter%202.4.c GLEW developers accept this bug https://github.com/nigels-com/glew/issues/3#issuecomment-26086063 Created attachment 1400 [details]
Minimum code to reproduce the problem
I'm having the same issue. I can create and use an OpenGL 2.1 context just fine. However anything higher than that fails to create. the SDL_GetError() simply says "Could not create GL context". I am able to get a higher version context using glfw with the same version of glew as I'm trying to use with SDL.
- glew version is 1.10.0
- SDL2 version is 2.0.1
Running that function gives me this output:
[Pass] l(54) f(src/Engine/GameManager.cpp): SDL initialised.
[Pass] l(69) f(src/Engine/GameManager.cpp): SDL_Window created.
[Error] l(75) f(src/Engine/GameManager.cpp): Could not create GL context
Changing nothing but the requested version number to 2, 1 gives this (and the context works as expected from there - but for this project I need a 3.x context):
[Pass] l(54) f(src/Engine/GameManager.cpp): SDL initialised.
[Pass] l(69) f(src/Engine/GameManager.cpp): SDL_Window created.
[Pass] l(79) f(src/Engine/GameManager.cpp): GL_Context created.
[Log] l(84) f(src/Engine/GameManager.cpp): OpenGL context version: 2.1.2 NVIDIA 304.108
This is my glxinfo from terminal:
glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 690/PCIe/SSE2
OpenGL core profile version string: 4.2.0 NVIDIA 304.108
OpenGL core profile shading language version string: 4.20 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.2.0 NVIDIA 304.108
OpenGL shading language version string: 4.20 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
glxinfo | grep -i opengl OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GTX 570/PCIe/SSE2 OpenGL core profile version string: 4.3.0 NVIDIA 319.60 OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.3.0 NVIDIA 319.60 OpenGL shading language version string: 4.30 NVIDIA via Cg compiler OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions: On my system, using testgl2 as a base, I can create a context up to 4.3 with no error AFAICT. The output is black if I use anything higher than 3.1 though, but I assume this is due to the test using the legacy GL functions to draw. One thing I did notice is that we are probably querying the extensions wrong for contexts >= 3.2 The flags I'm adding to testgl2 are: state->gl_major_version = 4; state->gl_minor_version = 3; state->gl_profile_mask = SDL_GL_CONTEXT_PROFILE_CORE; With these on, I get: INFO: Screen BPP : 24 INFO: Swap Interval : 0 INFO: Window Size : 640,480 INFO: Draw Size : 640,480 INFO: INFO: Vendor : NVIDIA Corporation INFO: Renderer : GeForce GTX 570/PCIe/SSE2 INFO: Version : 4.3.0 NVIDIA 319.60 INFO: Extensions : (null) INFO: ERROR: Failed to get SDL_GL_RED_SIZE: OpenGL error: GL_INVALID_ENUM ERROR: Failed to get SDL_GL_GREEN_SIZE: OpenGL error: GL_INVALID_ENUM ERROR: Failed to get SDL_GL_BLUE_SIZE: OpenGL error: GL_INVALID_ENUM ERROR: Failed to get SDL_GL_DEPTH_SIZE: OpenGL error: GL_INVALID_ENUM INFO: 29162.79 frames per second Requesting a 3.1 context: INFO: Screen BPP : 24 INFO: Swap Interval : 0 INFO: Window Size : 640,480 INFO: Draw Size : 640,480 INFO: INFO: Vendor : NVIDIA Corporation INFO: Renderer : GeForce GTX 570/PCIe/SSE2 INFO: Version : 3.1.0 NVIDIA 319.60 INFO: Extensions : GL_AMD_multi_draw_indirect GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_clear_buffer_object GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_compute_shader GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_robust_buffer_access_behavior GL_ARB_robustness GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_stencil_texturing GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transform_feedback_instanced GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXTX_framebuffer_mixed_formats GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separ INFO: INFO: SDL_GL_RED_SIZE: requested 5, got 8 INFO: SDL_GL_GREEN_SIZE: requested 5, got 8 INFO: SDL_GL_BLUE_SIZE: requested 5, got 8 INFO: SDL_GL_DEPTH_SIZE: requested 16, got 24 Updating my nvidia drivers to 319.32 solved this for me. I also switched to GL3/gl3.h from glew. Although, the context creation was failing before glew touched anything earlier. Hey Ryan, can you take a quick look at this when you review the context creation stuff? Hello, and sorry if you're getting dozens of copies of this message by email. We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc. Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report. So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues. (please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!) Thanks, --ryan. |