PDA

View Full Version : how to change attributes of line in opengl



anshuman
02-17-2005, 02:55 AM
hi,
my problem at hand is that i have an entity say line and i want to change it's attributes such as thickness,line type(broken,normal line etc) ,(endstyle of line say round,rectangular etc)etc .Now all the data and attributes of line is in a smart array defined as such in the code.Now in opengl can we change all this GDI calls and apply it on the same line which draws the line using opengl.It would be really great if someone can help.Thanks in advance,
regards,
anshuman

Relic
02-17-2005, 03:48 AM
On OpenGL there is
- glLineWidth,
- glLineStipple, and
- glEnable(GL_LINE_SMOOTH) for antialised lines (needs blending to work nicely)

OpenGL implementations vary in supporting different line widths. The basic requirement is min and max width == 1.0.
You need to query the "range" and "granularity" (search the OpenGL spec) to find out what sizes are supported in aliased and antialised mode.

Line cappings can not be changed. There are two modes, aliased lines are cut horizontally or vertically depending on the x- or y-major length.
Antialised lines are drawn as rectangles with capping 90 degrees to the line direction. Some implementations don't even do that right.

mikael_aronsson
02-17-2005, 03:58 AM
Lines in OpenGL is a little more limited, you can use glLinewidth to set width of line (hardware may limit the width for you) and you can use glLineStipple to set bit patterns for lines, that is about it, you can also do some neat effects with blending of course.

Mikael