Part of the Khronos Group

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.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Dec 2012

    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.


    Which way should I set v?

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


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

    Thanks in advance!


  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    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
    Thanks for your great help!

    Best regards,


Posting Permissions

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