There's no reason you should call glBegin()/glEnd() that many times. OpenGL is a state machine at heart; when you call glBegin(GL_LINES) you go into...
As far as I know, the problem is that you can't glEnable(GL_LINE_STIPPLE) inside of a glBegin()/glEnd() block. In immediate mode OpenGL doesn't like...
No offense meant, fuyu, but I have to reiterate some of john's concerns. What field are you studying in? If you are "not capable to do the extraction...
If I am limited to OpenGL 3.2 at the highest (due to a binding restriction on one of my intended platforms), would it still be a good idea to step up...