Reputation: 323
I got a code, but I dont know which version of OpenGl it uses.
There were no #version pragma in the code, so I find it difficult to figure out.
How do I know which version of OpenGl is it designed for?
Additional Info:
It got shader
and there were vec2
, vec3
, vec4
Upvotes: 0
Views: 502
Reputation: 162327
If you look at the OpenGL reference pages, for every function there's a list indicating in which version it appeared. The list starts at OpenGL-2.0, but that's really the lowest version you have to care about, these days.
Anyway, here's a set of heuristics to determine the OpenGL version used:
makes use of buffer objects, i.e. calls to glBufferData
are made → v >= 1.5
makes use of GLSL shaders → v >= 2.0
GLSL code uses keywords varying
and uniform
→ v < 3
makes use of framebuffer objects, i.e. calls to glBindFramebuffer
are made → v >= 3.0
makes use of vertex array objects, i.e calls to glBindVertexArray
are made → v >= 3.3 core profile
makes use of glTextureStorage…
/ glTexStorage…
→ v >= 4.2
Upvotes: 1