public void setupLineParameters(final float lineWidth, final int stippleFactor, final short stipplePattern,
final boolean antialiased) {
final GL gl = GLContext.getCurrentGL();
final LineRecord lineRecord = ContextManager.getCurrentContext().getLineRecord();
if (!lineRecord.isValid() || lineRecord.width != lineWidth) {
gl.glLineWidth(lineWidth);
lineRecord.width = lineWidth;
}
if (stipplePattern != (short) 0xFFFF) {
if (!lineRecord.isValid() || !lineRecord.stippled) {
gl.glEnable(GL2.GL_LINE_STIPPLE);
lineRecord.stippled = true;
}
if (!lineRecord.isValid() || stippleFactor != lineRecord.stippleFactor
|| stipplePattern != lineRecord.stipplePattern) {
gl.getGL2().glLineStipple(stippleFactor, stipplePattern);
lineRecord.stippleFactor = stippleFactor;
lineRecord.stipplePattern = stipplePattern;
}
} else if (!lineRecord.isValid() || lineRecord.stippled) {
gl.glDisable(GL2.GL_LINE_STIPPLE);
lineRecord.stippled = false;
}
if (antialiased) {
if (!lineRecord.isValid() || !lineRecord.smoothed) {
gl.glEnable(GL.GL_LINE_SMOOTH);
lineRecord.smoothed = true;
}
if (!lineRecord.isValid() || lineRecord.smoothHint != GL.GL_NICEST) {
gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
lineRecord.smoothHint = GL.GL_NICEST;
}
} else if (!lineRecord.isValid() || lineRecord.smoothed) {
gl.glDisable(GL.GL_LINE_SMOOTH);
lineRecord.smoothed = false;
}
if (!lineRecord.isValid()) {
lineRecord.validate();
}
}