Change draw color

I’m making a 3D tetris game to get used to working with OpenGL. When I draw the scene (with my draw() method) I first draw all the tetris cubes on the scene. They are textured cubes of different colors. Then after I draw these cubes, I draw “gridlines,” which are lines drawn over the scene to show the “grid.”

I want these lines to be drawn in white. Here is what my code looks like:

public void draw(){
		glPushMatrix();
		
		//translate the scene
		glTranslated(-GAME_WIDTH/2 + 0.5, -GAME_DEPTH/2, -30);
		
		//draw all the tetris cubes
		for(TetrisCube tc : cubes){
			if(tc.x > -1 && tc.x < GAME_WIDTH
					&& tc.y > -1 && tc.y < GAME_HEIGHT
					&& tc.z > -1 && tc.z < GAME_DEPTH)
				tc.draw();
		}
		
		//set the color of the gridlines to white (doesn't work)
		glColor3f(1f, 1f, 1f);
		
		//draw all the gridlines
		for(DrawLine dl : gridLines){
			dl.draw();
		}
		
		glPopMatrix();
	}

However, the lines are not white. Instead, they are the color of the last block drawn, which might be red, blue, etc.
This is a little weird, because the guides I’ve read online have suggested that this would work. I probably don’t understand what the glColor3f() really does, but I don’t know what to use instead. How would I solve this problem? Thanks.

Bind a white texture after you draw all your cubes

Better yet, sample a texture region of opaque white from your currently bound texture (e.g. UI/font sheet), and render both the cubes and the lines using different calls to glColor4f to change the colours. That way you only have a single texture for your whole application!

A similar concept is discussed here:

I’ll do that for now, but is there really no other way to do it? Seems as though it should be simpler than that.

Thanks though, it does work!