Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: "If" with Vertex shader

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Jul 2003
    Posts
    91

    "If" with Vertex shader

    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.

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: "If" with Vertex shader

    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.

  3. #3
    Intern Contributor
    Join Date
    Jul 2003
    Posts
    91

    Re: "If" with Vertex shader

    Ok.
    Thanks.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    768

    Re: "If" with Vertex shader

    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).

Posting Permissions

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