Garbled 1D-texturing on lines due to if-else??

Hi, I’m working in JOGL on an ATI Mobility Radeon X1300. The card supports OpenGL 2 and GLSL 1.10–barely enough for shaders, but enough! I’ve made a bunch of prototypes that work fine, but maybe you can help me with this one. I’m drawing line strips with a 1D texture on them. While trying to use an if-else switch in my vertex shader to choose one of two ways to calculate the texture vertex, I produce crazy garbling that smells like a hardware bug. But I’m new to GLSL so maybe I’m doing something wrong. Here’s a simplified example.

This snippet produces expected, orderly results:

float textureScale_ = 4.0;
gl_TexCoord[0].x = startingTextureCoordinate;

When I replace the above with this, each vertex appears to get a random texture coordinate every frame, with chaotic results:

float textureScale_ = 4.0;
if (textureScale_ > 0.0)
gl_TexCoord[0].x = startingTextureCoordinate;
else
gl_TexCoord[0].x = startingTextureCoordinate;

(A ternary operator seems to have the same effect, too.)

Extra crazy: When I close the program, return to the first snippet, and run the program again, the texturing continues to be incorrect, even though the same version of the program worked before–either every vertex goes on getting random texture coordinates like before, or they all seemingly get 0 rather than startingTextureCoordinate (which is a uniform float that I set each frame, and that slowly increases).

Running a different one of my OpenGL prototypes somehow clears this error state; if I then return to the first version of the code, texturing works correctly again.

I’ve already hacked around this problem, but my hack adds a few extra multiplications for each vertex, and may prevent me from further developing my texturing algorithm in the future, so naturally I’d prefer to remove it. Can you explain what’s happening?

Thanks for any help!