Login  Register

I can't set Line Width to 1 pixel

Posted by elect on May 21, 2012; 9:08am
URL: https://forum.jogamp.org/I-can-t-set-Line-Width-to-1-pixel-tp4004559.html

Hello guys,

I'm trying to set some line loops to 1 pixel width, but I always get some antialiasing effect when the width number is an odd number

Here some example code:

                        gl2.glLineWidth(1.0f);
                        gl2.glBegin(GL2.GL_LINES);
                            gl2.glVertex2i(-10, 0);
                            gl2.glVertex2i(-10, 10);
                        gl2.glEnd();
                       
                        gl2.glLineWidth(2.0f);
                        gl2.glBegin(GL2.GL_LINES);
                            gl2.glVertex2i(-10, -10);
                            gl2.glVertex2i(-10, 0);
                        gl2.glEnd();
                       
                        gl2.glLineWidth(3.0f);
                        gl2.glBegin(GL2.GL_LINES);
                            gl2.glVertex2i(-10, -20);
                            gl2.glVertex2i(-10, -10);
                        gl2.glEnd();
                       
                        gl2.glLineWidth(4.0f);
                        gl2.glBegin(GL2.GL_LINES);
                            gl2.glVertex2i(-10, -30);
                            gl2.glVertex2i(-10, -20);
                        gl2.glEnd();
                       
                        gl2.glLineWidth(5.0f);
                        gl2.glBegin(GL2.GL_LINES);
                            gl2.glVertex2i(-10, -40);
                            gl2.glVertex2i(-10, -30);
                        gl2.glEnd();

produces this (in order from up to down):

http://dl.dropbox.com/u/1401029/LineWidth.png

gl2.glIsEnabled(GL2.GL_LINE_SMOOTH) returns false and gl2.glhint doesnt seem to affect it at all

any ideas?