I need to plot a pixel on the window, according to its position in pixels in integers, not floats. like, for example, if I was to plot 0, 0 it would be the very top left corner of the window, 1,1 would be one pixel to the right of 0, 0, and 1 pixel below 0. I guess what I need is it to be kind of like I grid. I don’t care if 0, 0 is the origin like how it normally is, but I need it to count by pixels, not having 1 as the max and -1 as the min.
Things I have already tried: I thought I could just do something like this Window Width ^-1 * X for plotting, and that actually does work, but not all the time. Anyways, how would I go by doing this? I have also done X position / Screen Width, and that works the best, but it starts messing up for every 10 or so pixels.
float size = .0025; // = 1/400 (400 = width and height of window)
for(int i = -400 ; i < 400 ; i++)
{
glBegin(GL_POINTS);
glVertex2f(size * i, size * i);
glEnd();
}
What this code should so is draw a straight diagonal line across the screen, but it messes up.