Hi, Anil.
What you're describing should work, as far as I can see.
You could try checking that
glPolygonMode is being called in the way you expect. For example, for you could put in code like
1 2
| gl.glPolygonMode(A, B); System.out.println("glPolygonMode " + A + " " + B); |
at every point where you call the function. Then check that the arguments change when you click the mouse.
Good luck!
Simon