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,
On OpenGL there is
- 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.
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.