Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a gvec4?

Tags:

opengl

As mentioned here, https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/imageLoad.xhtml, there is supposed to exist a gvec4-type. But i can't find anything about it. What is that datatype?

like image 992
user2762996 Avatar asked Jul 22 '17 14:07

user2762996


1 Answers

The term gvec4 is used as a catch-all for all vector types: floats, signed integers, unsigned integers, and doubles. The "g" is replaced in the actual type by:

  • Nothing, for floats. (vec4)
  • i for signed ints. (ivec4)
  • u for unsigned ints. (uvec4)
  • d for doubles. (dvec4)

In this case, imageLoad will return different vector types based on the type of the image. The "g" in the image type will match the "g" in the return type. Floating-point image types (like image2d) make imageLoad return vec4. Signed integer image types (like iimage2d) make imageLoad return ivec4. And so on.

like image 61
Nicol Bolas Avatar answered Nov 12 '22 14:11

Nicol Bolas