Martin Dressler wrote: > I wan to draw lines in instruments layer. I made a new subclass of > FGInstrumentLayer and in draw method I do > glDisable ( GL_TEXTURE_2D ); > glBegin(GL_LINES); > glVertex2f(-100,0); > glVertex2f(100,0); > glEnd(); > > but it doesn't draw anything. But when I draw something with GL_POLYGON it > draw fine. > > What I should to change, please?
Is this on the 3D panel or 2D? In 3D, the texture layers are drawn with GL_POLYGON_OFFSET, which by default does not apply to lines. For reasons having to do with a metaphor collision (lines are "thick" in screenspace, while polygons aren't) lines don't work well with glPolygonOffset() -- you have to play with the factor argument. Try using glVertex3f() and specifying a Z coordinate of about 0.01 or so; that might work. But are you actually sure you want to be drawing lines? Lines are not the natural medium for 3D hardware -- they don't antialias well (if at all), don't have an easy way to associate their "size" with the world around them, and don't behave nicely under changes of perspective. Almost always, you'll get better results by using a 1D texture to draw your lines. Picture a 4x1 GL_LUMINANCE_ALPHA texture that looks like this: 0 0 0 255 255 0 0 0 Set your line color with glColor, and draw the line in world-space coordinates as a "thicker" (4x as wide as the intended line) quad modulated by the texture. Now, the line will be nicely antialiased, will look correct when viewed at funny angles, and will be less likely to excercise slow paths and funny behavior in the OpenGL driver. You'll send about twice as many vertices to the driver, but that's not likely to be significant when compared with the terrain complexity. Andy -- Andrew J. Ross NextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel