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 2 of 2

Thread: Access glm::vec3 component by argument?

  1. #1
    Intern Contributor
    Join Date
    Dec 2010

    Access glm::vec3 component by argument?

    Is there a way to access one component of a glm vector by argument?


    Code :
    bool greaterThan( const glm::vec3& lhs, const glm::vec3& rhs, const Axis axis )
        return lhs.component( axis ) > rhs.component( axis );
    Last edited by PrestoChung; 07-29-2013 at 03:07 PM.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Yes. You use [] with an integer. As in `lhs[axis]`, where `axis` is an integer.

Posting Permissions

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