PDA

View Full Version : arb vertex program question



tellaman
01-13-2003, 02:07 PM
my question follows:
is it possible to differentiate between vertices belonging to the same mesh in arb programs?
i mean, i would like to do different ops on different areas of my mesh
i've been looking for some CMP function in arb progs to identify vertices by their position but found nothing
shall i create 2 or more different meshes?
thanks for your time

[This message has been edited by tellaman (edited 01-13-2003).]

OneSadCookie
01-13-2003, 03:22 PM
OpenGL has no concept of a "mesh"; how would it know if two vertices belong to the same one?

Sounds like you want to draw each part of your mesh separately and with a different vertex program.

tellaman
01-13-2003, 03:23 PM
ya i'd better call it display list
is it possible anyway?

pbrown
01-13-2003, 04:39 PM
The standard way in ARB_vertex_program to execute a command like the following from ARB_fragment_program:

CMP dst, src0, src1, src2

is a sequence like the following:

SGE tmp, src0, 0; # tmp = 1 if src0>=0, 0 otherwise
SUB tmp2, src2, src1; # tmp2 = src2-src1
MAD dst, tmp, tmp2, src2;

This should yield either src1 or src2 as appropriate.

It's probably worth adding this as an example in the spec, since it's fairly commonly used.

bakery2k
01-13-2003, 05:01 PM
I could be wrong, but I think you mean:

SGE tmp, src0, 0; # tmp = 1 if src0>=0, 0 otherwise
SUB tmp2, src2, src1; # tmp2 = src2-src1
MAD dst, tmp, tmp2, src1;

Paul

[This message has been edited by bakery2k (edited 01-13-2003).]

tellaman
01-13-2003, 09:00 PM
thanks a lot that's exactly what i was looking for

pbrown
01-14-2003, 05:17 PM
Originally posted by bakery2k:
I could be wrong, but I think you mean:

SGE tmp, src0, 0; # tmp = 1 if src0>=0, 0 otherwise
SUB tmp2, src2, src1; # tmp2 = src2-src1
MAD dst, tmp, tmp2, src1;

Paul

[This message has been edited by bakery2k (edited 01-13-2003).]

Yes, you are correct. I wrote it one way, then reversed the order in mid-stream since it seemed more intutive. Didn't fix it all, though.