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

Thread: shaders parameters

  1. #1
    Intern Newbie
    Join Date
    Nov 2002
    Location
    paris, france
    Posts
    37

    shaders parameters

    Hi,

    I'm using openscenegraph to apply vertex/fragment shaders to a whole scene.
    I'm beginning to suspect an opengl misunderstanding so just a quick question to be sure :

    with the same fragment program bound,
    can I update its local parameters between
    two primitives draw?

    ie:
    updateParams();
    draw1();
    updateParams();
    draw2();

    in draw1 i get the parameters from draw2, as if the driver changes the program parameters too fast then issues draw1..
    any idea? =)

    (hw note : quadro fx with nv 4363, since 4496 and 5328 don't like me

    thanx!
    cbwan
    Sébastien Kuntz
    SNCF VR Lab

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: shaders parameters

    That's ARB_*_program, not GLslang.

    But it is possible. If you are not changing these parameters between a glBegin and a glEnd it should work!
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: shaders parameters

    You need to "use" a specific program object before setting any of its uniform parameters.

    Here's an example:

    Code :
    // set program 1 parameters
    glUseProgramObjectARB(program1);
    glUniform1f(someParam, 1.0);
     
    // set program 2 parameters 
    glUseProgramObjectARB(program2);
    glUniform1f(otherParam, 2.0);
     
    // switch back to default fixed function rendering
    glUseProgramObjectARB(0);

Posting Permissions

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