Results 1 to 3 of 3

Thread: Are uniform values saved when switching shaders?

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    23

    Are uniform values saved when switching shaders?

    Lets say I have 2 shader programs, A & B, and do the following:

    1) Use program A
    2) Set uniforms for program A
    3) Render something
    4) Use program B
    5) Set uniforms for program B
    6) Render something else

    If I now want to render something with program A again, do I need to re-set all the uniforms it uses, or will the uniforms be restored automatically? The GL ES 2.0 spec doesn't mention it at all and the GL 2.0 spec only mentions that uniform values are stored as part of the program state (in section 2.15.5 - Required State).

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: Are uniform values saved when switching shaders?

    Yes, uniform values are part of the program state. A uniform of a program will keep its value until you change it.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    6

    Re: Are uniform values saved when switching shaders?

    Great, thanks a lot for that question!

Similar Threads

  1. Replies: 4
    Last Post: 01-30-2013, 04:45 AM
  2. What is the precision of a uniform mat4's float values?
    By xman84 in forum WebGL - General
    Replies: 0
    Last Post: 08-15-2011, 04:56 PM
  3. glDrawPixels equivalent - how to load a saved buffer
    By hypertext in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 07-04-2010, 07:40 AM

Posting Permissions

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