I'm learning GLSL to do some computer graphics experiment now. While I tried to compile shaders from some tutorials, I ran into some problems. Here it was:
GL version: 3.0.0 - Build 8.15.10.2291
Error compiling shader type 35633: 'ERROR: 0:1: '' : Version number not support
ed by OGL driver
The video card of my laptop is GT520M, but I've already updated my video card driver to the version340.82,which is said to support OpenGL 4.5 and GLSL 4.50.
Related
I have an Intel HD4400 graphics card in my laptop. When I run glxinfo | grep "OpenGL", I get
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.0-rc5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.0.0-rc5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.0.0-rc5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
This should mean that my graphics card can support GLSL version 4.30, right? However, my shader compilation fails with the following message
error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, and 3.10 ES
In my code, I do set the context profile to core, with the following statement
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE)
after which I set the context major and minor versions to 4 and 3, respectively.
Any ideas? I am on Ubuntu 18.04. I thought it might be the graphics drivers that are not up to date, but if they are not up to date, then would glxinfo still tell me that version 4.50 is supported? It also seems like Ubuntu has the latest Intel graphics drivers installed already, and I do not want to risk installing graphics drivers that might break my display.
Additional Info:
I ran this exact code on another machine, and it worked perfectly (and I am quite sure that that machine does not support GL 4.3 compatible). I therefore do not believe that it is the way I created my context. Here is the code where I set my profile context version:
void set_gl_attribs()
{
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE))
{
cout << "Could not set core profile" << endl;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4))
{
cout << "Could not set GL major version" << endl;
}
if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3))
{
cout << "Could not set GL minor version" << endl;
}
}
And this is where I call the code (before I call any other SDL or OpenGL functions):
SDL_Init(SDL_INIT_EVERYTHING);
window = SDL_CreateWindow("Sphere", 100, 100, width, height, SDL_WINDOW_OPENGL);
gl_context = SDL_GL_CreateContext(window);
//SDL_HideWindow(window);
set_gl_attribs(); // where I set the context, as shown above
SDL_GL_SetSwapInterval(1);
glewExperimental = GL_TRUE;
GLuint glew_return = glewInit();
The setup code is incorrect. You must choose a core profile context before creating the context, changing the profile after the context exists is too late and it will not work. Also, according to the SDL2 documentation, all calls to SDL_GL_SetAttribute must be made before the window is created via SDL_CreateWindow.
Move all calls to SDL_GL_SetAtrribute so they are before SDL_CreateWindow.
The reason that this incorrect code appears to work on other machines is because different drivers provide different versions of OpenGL depending on whether you ask for a compatibility or code profile context.
Mesa will only provide 3.0 for compatibility contexts,
macOS will only provide 2.1 for compatibility contexts,
NVidia and AMD drivers on Windows will provide the latest version they support.
I'm trying to use xming to render software using OpenGl running on the same machine in WSL / windows bash.
This works fine for some really small demos, however once I try something like glmark2, it fails because it seems the OpenGl version is reported incorrectly.
glxinfo | grep OpenGL reports this:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 970M/PCIe/SSE2
OpenGL version string: 1.4 (4.5.0 NVIDIA 382.05)
If I let xming run on my internal graphics card (using a laptop), it reports
OpenGL vendor string: Intel
OpenGL renderer string: Intel(R) HD Graphics 4600
OpenGL version string: 1.4 (4.3.0 - Build 20.19.15.4568)
The weird part is the 1.4 in front of 4.5.0 NVIDIA 382.05.
The OpenGl support is definitely at least 3, because a demo using GLSL shaders which require newer OpenGl runs, but the version string is kinda garbage.
The problem you're running into is, that the GLX portion of XMing does support only up to OpenGL-1.4. The part inside the parentheses is the version string as reported by the system native OpenGL implementation. However since XMing lacks (so far) the capability to reliably pass on anything beyond OpenGL-1.4 it will simply tell you "all I guarantee you to support is OpenGL 1.4, but the system I'm running on could actually do …".
Maybe some day someone goes through the effort to implement a fully featured dynamic GLX←→WGL wrapper.
I run to a really odd problem while trying to generate vertex arrays with openGL. I am using windows 7 as platform, and I am using GLEW 1.15 and glm as the openGL libraries with SDL as the interface.
The problem was that while trying to generate the vertex arrays using
glGenVertexArrays(1, &m_vertexArrayObject);
I came across with the following access violation error
Unhandled exception at 0x7469CB49 in OpenGL.exe: 0xC0000005: Access violation executing location 0x00000000.
I am sure that I initialized GLEW correctly and set the glewExperimental as true before calling any GLEW functions
glewExperimental = GL_TRUE;
GLenum status = glewInit();
After running the getInfo.exe I found out that the genVertexArrays commmand was MISSING from GLEW I had installed to my PC. I then suspected I had a GPU or drivers problem which I chased down and found out that my PC was running with Mobile Intel(R) 4 Series Express Chipset Family Graphics card with a CPU Intel Centrinto 2 - yes my PC is old.
I tried downloading drivers that support openGL version 4.5 or older but I couldn't find any that are supported from my CPU.
Does anyone know a way to go around this problem and make use of the glgenVertexArrays command with old or unsupported hardware? Maybe a command from older versions of openGL that produces the same result as glGenVertexArrays would be a really good help !
P.S I made sure to download the latest version of openGL. glGetString(GL_VERSION) returns Version 2.1.0 - Build 8.15.10.1840, which is not the one I've installed.
I am trying to run the GS demo code of Mesa from here :
http://cgit.freedesktop.org/mesa/demos/tree/src/gs, by git cloning this:
http://cgit.freedesktop.org/mesa/demos
However, I get the error as "needs GL_ARB_geometry_shader4 extension".
I am not that up to date with how the Mesa development is going on, but it
seems that GL_ARB_geometry_shader4 extension is not available for Mesa?
As per this link:
http://lists.freedesktop.org/archives/mesa-dev/2014-August/065692.html, it
shows Geometry Shader support has been added to Intel SandyBridge platform.
I also came across this link:
http://dri.freedesktop.org/wiki/MissingFunctionality/, which indicates that
the GL_ARB_geometry_shader4 extension is a "Missing Functionality".
Considering all of this, how should I proceed to write my applications with
geometry shaders using Mesa?
I believe this extension is only supported on Nvidia GPU's which is why you can't use it
Edit : You don't need this extension to use Geometry Shaders. The example here
http://ogldev.atspace.co.uk/www/tutorial27/tutorial27.html
Should work perfectly fine on intel GPU's
I downloaded the drivers for Intel(R) HD Graphics version 8.15.10.2993 which are known to support shader 3.0. but after installation I have checked it by Geeks 3d caps viewer and calling gl.glGetString(GL2.GL_VERSION) code and showed just 2.1.0.Thanks!
GL 2.1.0 / GLSL 1.20 is fine for shader model 3. GL 3.x/GLSL >=1.30 requires shader model 4.