Skip to main content
added 126 characters in body
Source Link
luser droog
  • 1.4k
  • 2
  • 12
  • 27

IIRC in another question, your said your Point class actually uses float x,y; for the coordinates. So one thing that can help is to shift the centers (the "zeros") over to the edge of the pixel, like:

int xi = pt.x + 0.5;
int yi = pt.y + 0.5;

And use those integers in calls the GLUT line drawing api.

I think this change would go inside your drawLine() function.

A more robust, but much more complicated solution would be to do the above and also implement anti-aliased line drawing.

IIRC in another question, your said your Point class actually uses float x,y; for the coordinates. So one thing that can help is to shift the centers (the "zeros") over to the edge of the pixel, like:

int xi = pt.x + 0.5;
int yi = pt.y + 0.5;

And use those integers in calls the GLUT line drawing api.

I think this change would go inside your drawLine() function.

IIRC in another question, your said your Point class actually uses float x,y; for the coordinates. So one thing that can help is to shift the centers (the "zeros") over to the edge of the pixel, like:

int xi = pt.x + 0.5;
int yi = pt.y + 0.5;

And use those integers in calls the GLUT line drawing api.

I think this change would go inside your drawLine() function.

A more robust, but much more complicated solution would be to do the above and also implement anti-aliased line drawing.

Source Link
luser droog
  • 1.4k
  • 2
  • 12
  • 27

IIRC in another question, your said your Point class actually uses float x,y; for the coordinates. So one thing that can help is to shift the centers (the "zeros") over to the edge of the pixel, like:

int xi = pt.x + 0.5;
int yi = pt.y + 0.5;

And use those integers in calls the GLUT line drawing api.

I think this change would go inside your drawLine() function.