Check OpenGL GPU Limitations

I was wondering if there is an easy way to request (programmatically) the limits of the OpenGL GPU for the following functions:
- maximum size of a 2D texture
- maximum 3D texture size
- maximum number of vertex shader attributes
- maximum number of different floats
- the number of units of the texture image (in the vertex shader and in the fragment shader)
- maximum number of drawing buffers

I need to know these numbers in advance before writing my GPU research project.

+4
source share
2 answers

glGet () is your friend:

  • GL_MAX_3D_TEXTURE_SIZE
  • GL_MAX_TEXTURE_SIZE
  • GL_MAX_VERTEX_ATTRIBS
  • GL_MAX_VARYING_FLOATS
  • GL_MAX_TEXTURE_UNITS
  • GL_MAX_DRAW_BUFFERS

eg:.

 GLint result; glGetIntegerv(GL_MAX_VARYING_FLOATS, &result); 

I'm not quite sure what your project is going to achieve, but OpenCL may be of interest to you if this is a general calculation and you did not know about it. In particular, Cl / GL interop , if there is a graphic element, and your equipment supports it.

As Damon noted in the comments in practice, it can be more complex than that for texture sizes. Problems arise because rendering can be distracted from hardware to software for some texture sizes, and also because the size of the texture depends on the pixel format used. To get around this, you can use GL_PROXY_TEXTURE_ * with glTexImage * .

+11
source

In addition to what "awoodland" was said, and if you still don't know ... I think you should take a look at GLEW ...

GLEW provides effective runtime mechanisms to determine which OpenGL extensions are supported on the target platform.

http://glew.sourceforge.net/

+1
source

Source: https://habr.com/ru/post/1339813/


All Articles