PDA

View Full Version : glLineWidth question


briandavis
1st March 2005, 03:05 AM
Hi,

I'm needing to render a scene in a 2:1 aspect ratio. The tricky part is that vertical lines must be twice as thick as horizontal lines. Diagonal lines would share the same basic rule (i.e. a line from (0, 0) to (3, 3) would take up an area of 6 x 3.)

Is this possible with OpenGL? I've tried using glLineWidth(2), but this effects the overall width of the line. I've got the matrices set up properly so that (1, 1) is actually displayed at (2, 1). I just can't seem to get the line(s) to draw like I need them to. :?

TIA,
Brian

Andy
1st March 2005, 03:41 AM
The matricies won't affect the opengl line width. Neither will aspect ratios and viewport settings.

You'll probably need to draw rectangles/polygons to get a specific thickness.

Andy

briandavis
10th March 2005, 03:42 PM
Andy,

Thanks for the reply. I have solved the problem I was having by using a combination of glReadPixels, glPixelZoom, and glDrawPixels. I had originally been given the advice to use glCopyPixels, but that turned out to be really slow.

- Brian

Gernot
15th March 2005, 03:14 AM
glReadPixels and the like are on most hardware very slow - depends strongly on the driver. What exactly are you trying to do? Outlines?

briandavis
15th March 2005, 02:12 PM
I've stumbled upon a workable solution to my problem using a combination of glReadPixels, glPixelZoom, and glDrawPixels. For whatever reason, copying directly to the front buffer using glPixelZoom is terribly slow. However, copying using glReadPixels, glPixelZoom, and glDrawPixels is substantially faster than the glCopyPixels method.

Not quite sure what the performance hit is from, but I have found a way around it. Thanks.

Incidentally, my application is taking a pre-rendered buffer and adding 2D text to it. A post-rendering step then stretches the entire buffer 2:1.

- Brian