## Plotting Points inside a function

Hi,

I am doing my first steps with openGL. For a university course I have to implement the Bresenham algorithm, which fills in the appropriate pixels between two points to draw a line. In my example code I cannot see the points the function bresenham() should be drawing. Can anyone help me here?

Code :
```#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <GL/glut.h>  // GLUT, include glu.h and gl.h

/* Handler for window-repaint event. Call back when the window first appears and
whenever the window needs to be re-painted. */

void bresenham(int x0, int y0,int x1, int y1){
int deltax = x1 - x0;
int deltay = y1 - y0;
double error = 0;
double deltaerror = abs(deltay/deltax);
int y = y0;
for(int i = 0; i < deltax; i++){ // POINT CREATION IN FOR-LOOP ALLOWED ?
glBegin(GL_POINTS); // HERE THE POINTS SHOULD BE CREATED
glPointSize(8);
glColor3f(1.0f, 0.0f, 0.0f); // Red
glVertex3f(x0+i,y,0);
glEnd();
error = error + deltaerror;
if (error >= 0.5){
y = y+1;
error = error - 1;
}
}
}

void display() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to black and opaque
glClear(GL_COLOR_BUFFER_BIT);         // Clear the color buffer (background)

bresenham(100,100,200,140); // HERE THE BRESENHAM FCN IS CALLED

glFlush();  // Render now
}

/* Main function: GLUT runs as a console application starting at main()  */
int main(int argc, char** argv) {
glutInit(&argc, argv);                 // Initialize GLUT
glutCreateWindow("OpenGL Setup Test"); // Create a window with the given title
glutInitWindowSize(320, 320);   // Set the window's initial width & height
glutInitWindowPosition(50, 50); // Position the window's initial top-left corner
glutDisplayFunc(display); // Register display callback handler for window re-paint
glutMainLoop();           // Enter the event-processing loop
return 0;
}```

I think I messed with the order of functions. Thank you very much!

Damian