• Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at \$59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

# How do you use bvecs (GLSL) ?

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1TysonJ  Members   -  Reputation: 145

Like
0Likes
Like

Posted 02 November 2012 - 10:10 AM

I'm confused about bvecs. What can you do with them? Is their only use in the expressions if (any(bvec)) and if (all(bvec))?

I would like to efficiently generate a vector B from another vector A, where B.n is 1. if n is the largest component of A, and 0. otherwise.
so {0.1, 0.2, 0.8., 0.} -> {0., 0., 1., 0.}

I would like to do something like (greaterThan(A, A.yzwx) & greaterThan(A, A.zwxy) & greaterThan(A, A.wxyz)).ToFVec()... but of course it doesn't work that way...

Edited by TysonJ, 02 November 2012 - 10:11 AM.

### #2swiftcoder  Senior Moderators   -  Reputation: 10399

Like
0Likes
Like

Posted 02 November 2012 - 11:11 AM

Given a vector, V,

bvec3 Result = greaterThan(V.xyz, greaterThan(V.yzx, V.zxy));

Or am I missing something?

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]

### #3TysonJ  Members   -  Reputation: 145

Like
0Likes
Like

Posted 02 November 2012 - 11:53 AM

That doesn't work because the first greaterThan is mixing a vec and a bvec, and in any case I want a vec out of it, not a bvec.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS