Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: About the usage of glUniform{2|3|4}iv.

  1. #1
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74

    Wink About the usage of glUniform{2|3|4}iv.

    As clarified in the reference, the glUniform{2|3|4}iv takes three parameters, location, count and v. But when count is greater than 1, what is the structure of v?
    Suppose I call it as the following.

    glUniform2iv(loc,2,v);

    Which way should I set v?

    Code :
    int v={{somevalue,somevalue},{somevalue,somevalue}};

    or

    Code :
    int v={somevalue,somevalue,somevalue,somevalue};

    Thanks in advance!

    :devilish:

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    The count parameter is the number of elements in the array you're modifying, or 1 if you're not modifying an array. The number in the function name is the size of an element. 1 means scalar (float, int, uint, etc). 2 means 2-element vector (vec2, ivec2, uvec2, etc). And so on.

    If you're modifying a single vec2, you use glUniform2fv(..., 1, <array of two floats>);. If you're modifying a `vec2[3]`, then you use glUniform2fv(..., 3, <array of 2 * 3 floats>);

  3. #3
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Thanks for your great help!


    Best regards,

    newbiecow

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •