PDA

View Full Version : "If" with Vertex shader



greg2
09-13-2004, 11:18 PM
If i have understood the documentations, it seems to be impossible to use "if","else"... with the ARB_Vertex_program extension (?)

Do i have to use GLSL if i want to use "if" in a vertex shader ? (using ARB extension only)

Thanks.

dorbie
09-14-2004, 06:06 PM
Often you can multiply the result of a code segment by 1 or 0 where that operand is derived from the parameter you want to branch on.

greg2
09-15-2004, 07:07 AM
Ok.
Thanks.

vincoof
09-20-2004, 09:42 AM
Yes, when it comes about math you can emulate branching by using SGE and SLT instructions combined with things like x*1=x and x*0=0.

And if you want more advanced branching, you can take a look at the GL_NV_vertex_program2_option (only supported on NVIDIA hardware for now).