nchy13 0 Light Poster

HI, I am trying to set the consecutive pixels to a specific color so as to obtain a line. Though, I know there is a built in function for drawing the line, but I am interested to do it without using any GL primitive.
This is the display function as of now. Here I thought that changing limits from -250 to 250 instead of -1.0 to 1.0 will do the job but to no avail.
In this code I am just getting a point a the centre of the window.
Any help is appreciated as to how make a line using pixels.
Here both height and width of window is 501 pixels.

void renderFunction()
{
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0, 1.0, 1.0);
    glOrtho(-250.0, 250.0, -250.0, 250.0, 0.0, 0.0);
    glViewport(0,0,500,500);
    glBegin(GL_POINTS);
        glVertex2i(0,0);
        for(int i=1; i<100; i++)
            glVertex2f(float(i/250), float(i/250));
    glEnd();
    glFlush();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.