View Full Version : glUniform1f need to be called every time?
11-09-2011, 01:31 PM
On my current hardware if I set variables with glUniform1f once, then disable the shader and re-enable it elsewhere in the drawing loop the settings are still there. My question is if this is standard use or should I set the variables again when I change shaders?
11-09-2011, 02:00 PM
Uniforms are stored within their program objects. Much like textures are stored in texture objects. So you only need to reset a particular uniform within a program if you want to change the current value.
11-09-2011, 03:38 PM
Usually when one use an uniform variable wants to change its value at least every rendering call, thats why you are going to see uniforms being set every time. If one does not want to change its value, it will be possibly be stored as a constant. Obviously that, in certain cases you do not want to change the uniform every time, but I think that it is the most common.
11-11-2011, 08:31 AM
Ok thanks for the help. I have a uniform that needs to be set at the beginning of the loop however I need to turn it on and off a few times during rendering for objects that don't need it and are in between depth.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.