user2762996
user2762996

Reputation: 626

What is a gvec4?

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?

Upvotes: 12

Views: 5074

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473407

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.

Upvotes: 20

Related Questions