how to use logic operation for color index rendering

I am a new user of opengl.
I want to draw a vector which moving in a certain path. I set 2 point to draw the line .
the follow is my step:

  1. draw the vector in p1(point1).
  2. draw a line from p1 to p2(point2).
  3. draw the same vector in p1 in XOR method
  4. draw the vector in p2.
  5. send p2 valve to p1
    6.get new valve and send it to p2
    redo and redo step2-6.
    The effect is like i draw a line in the paper using a pen,and i can see the pen is moving.
    The quesitin is how can i achieve step 3,and treat me as a 3year old and teel me step by step.
    thank you very much!

Hi,is me again .
I just saw some document maybe can slove this problem.But i still don’t understand what those document says.

the follow is the document.
The other approach is to render with logic op enabled and set to XOR mode. Assuming you’re rendering into an RGBA window, your code needs to look like:


Set the color to white and render your lines. Where your lines are drawn, the contents of the framebuffer will be inverted. When you render the lines a second time, the contents of the framebuffer will be restored.

The logic op command for RGBA windows is only available with OpenGL 1.1. Under 1.0, you can only enable logic op in color index windows, and GL_LOGIC_OP is passed as the parameter to glEnable().
anybody can do a sample ?