   OpenGL Uniform variables [SOLVED]
  Hi,I have a problem with setting shader uniforms. I have a shader uniform Time0_X, which my prog should write and supposedly (verified by debugging) does write on every frame. Now everything works fine if I'm only drawing one screen aligned quad with the shader enabled. Then when and if I call glUseProgram(0) to get back to fixed function absolutely anywhere in my drawing loop, my uniforms stop updating. Namely, Time0_X is constantly the same. Okay, I'm sure my code is right in some way because the the value keeps updating completely normally if I keep glUseProgram(0) omitted. Did I understand something wrong about using the programs, and do you have any ideas how I could further debug what's wrong?Thanks[Edited by - Shinpou on May 12, 2009 3:15:08 PM]
  which compiler are you using? i know that some compilers will perform optimizations on compile time. for example, you are not using the uniform value when the shader is not attached and running. its possible your program is not updating the uniform since its not being used at that point in time. try keeping a shader attached and see if the uniform value is getting updated.   ;Quote:Original post by adam17which compiler are you using?I'm using MSVC08 compiler.Quote:Original post by adam17try keeping a shader attached and see if the uniform value is getting updated.Yeah, it's getting updated when there is no glUseProgram(0) anywhere, it's just that line. If it's called anywhere once, that's the end of updating the variables on that frame.Here's a test I made:if (SDL_GetTicks() < 10000) {   glUseProgram(0);}That runs for 10000 ticks, and when that stops executing, the fragment shader variables start updating normally.It's not only this machine either.   ;  Yeah mate, it was exactly what you said. I was inconspicuously glUseProgramming in the wrong part of the code. So I was actually accidentally calling glUseProgram only after setting my time variable. My bad :)Thanks a lot mate.   