简体   繁体   中英

How do I know what version of OpenGL does a source code use?

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

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, ie 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, ie calls to glBindFramebuffer are made → v >= 3.0

  • makes use of vertex array objects, ie calls to glBindVertexArray are made → v >= 3.3 core profile

  • makes use of glTextureStorage… / glTexStorage… → v >= 4.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM