Hi all,
I have a problem with double precision when drawing lines.
X axis range is from 99.9999 to 100.001. So, I set ortho as
gl.glOrtho(99.9999d, 100.001d, -5, 200, -10, 10);
Example input data:- X-axis value is increasing 1.25e-7 for every single point
Display callback:public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gl.glBegin(GL2.GL_LINE_STRIP);
int j = -5;
double offset = (0.001 / 8000);
for (int i = 0; i < 8000; i++) {
int y = j++;
double x = 100 + (offset * i);
gl.glVertex2d( x, y);
if (j == 200) {
j = -5;
}
}
gl.glEnd();
}
Expected output:
But I have following as a result:
Any advice ?