简体   繁体   English

我怎么知道源代码使用哪个版本的OpenGL?

[英]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. 我有一个代码,但我不知道它使用哪个版本的OpenGl。

There were no #version pragma in the code, so I find it difficult to figure out. 代码中没有#version编译指示,因此我很难弄清楚。

How do I know which version of OpenGl is it designed for? 我怎么知道它是为哪个版本的OpenGl设计的?

Additional Info: 附加信息:

It got shader and there were vec2 , vec3 , vec4 它具有shader并且有vec2vec3vec4

If you look at the OpenGL reference pages, for every function there's a list indicating in which version it appeared. 如果您查看OpenGL参考页,那么对于每个功能,都有一个列表,指出了它出现在哪个版本中。 The list starts at OpenGL-2.0, but that's really the lowest version you have to care about, these days. 列表从OpenGL-2.0开始,但是实际上,这确实是您现在要关心的最低版本。

Anyway, here's a set of heuristics to determine the OpenGL version used: 无论如何,这是一组启发式方法来确定所使用的OpenGL版本:

  • makes use of buffer objects, ie calls to glBufferData are made → v >= 1.5 利用缓冲区对象,即调用glBufferData →v> = 1.5

  • makes use of GLSL shaders → v >= 2.0 利用GLSL着色器→v> = 2.0

  • GLSL code uses keywords varying and uniform → v < 3 GLSL代码使用varyinguniform关键字→v <3

  • makes use of framebuffer objects, ie calls to glBindFramebuffer are made → v >= 3.0 利用帧缓冲区对象,即调用glBindFramebuffer →v> = 3.0

  • makes use of vertex array objects, ie calls to glBindVertexArray are made → v >= 3.3 core profile 利用顶点数组对象,即调用glBindVertexArray →v> = 3.3核心配置文件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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