Problem using GL_COLOR_ARRAY to send information to shader

I have an array of particles that I’d like to draw at once using glDrawArrays, however I would also like to dynamically set the alpha of some particles while using a shader. I came up with a method of using GL_COLOR_ARRAY to send the alpha information per point to the shader. It works fine, however after calling glDisableClientState(GL_COLOR_ARRAY); on certain graphics cards the color array stays active and modifies everything else drawn. For example:

Here is where I draw my particles:

glBindTexture(GL_TEXTURE_2D, particleTexture);
glColorPointer(4, GL_FLOAT, 0, betweenPartColorArray);
glTexCoordPointer(2, GL_FLOAT, 0,textureCoordsBetweenParticles);
glVertexPointer(3, GL_FLOAT, 0, verticesBetweenParticles);
glDrawArrays(GL_QUADS, 0, numberBetweenPartIndices);

Here is the relevant part of my shader that takes the color array and uses that to change the alpha on individual particles:


varying vec4 vertex_color;
varying vec4 verpos; // had an error with verpos for whatever reason.  If problems crop check into it
void main(void){
    vertex_color = gl_Color;
    gl_Position = ftransform();
    gl_TexCoord[0] = gl_MultiTexCoord0;
    verpos = gl_ModelViewMatrix*gl_Vertex;


varying vec4 vertex_color;
uniform sampler2D sceneTex;
void main (void) {
    vec4 finalColor = texture2D(sceneTex, gl_TexCoord[0].xy) ;
    finalColor=clamp(finalColor, 0.0, 1.0);

The problem is (on certain computers) everything drawn after this gets tinted according to the color array even though glDisableClientState(GL_COLOR_ARRAY); is called. If I were to change the red component on the color array, everything drawn after the color array is disabled has a red tint.

Is there a way to make sure GL_COLOR_ARRAY is really disabled besides what I am doing here?
Also, is there a better method to send per vertex information to a shader. I mainly need to the shader to know which vertices I want alpha modified while leaving all of the particles in the array.


Do they take the colors in the array, or the value of the last color?
In earlier OpenGL versions, the spec states

The same text applies to DrawArrays.

In recent OpenGL specs they state:

So older versions may or may not affect the current color after a draw call, but recent versions are guaranteed not to affect current values. This behavior changed in OpenGL version 4.1.

In older versions you would need to call glColor after a draw call that uses the color array and before a draw call that doesn’t use it (eg. reset the current color to (1,1,1,1)) to guarantee that the color tint doesn’t bleed over, but that’s not required if your implementation follows a newer version of the OpenGL spec.

Ahh yea, that might work. I haven’t tested it yet (need my friends computer) but I believe it is taking the last color instead of the entire array as every object after is the same tint even though some have large arrays. Thanks, I’ll try this.

Also still standing if anyone knows a better method to send per vertex information to a shader, let me know :).