Skip to content

Instantly share code, notes, and snippets.

@diegoeche
Created November 20, 2009 15:35
Show Gist options
  • Save diegoeche/239565 to your computer and use it in GitHub Desktop.
Save diegoeche/239565 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <GL/glut.h>
using namespace std;
int x1, x2, y1, y2, z1, z2 = 0;
void point3d(int x, int y, int z) {
glPushMatrix();{
glTranslatef(x, y, z);
glutSolidSphere (0.1, 16, 16);
}
glPopMatrix();
}
void display () {
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix();{
glScalef(0.1, 0.1, 0.1);
point3d (0, 0, 0);
point3d (0, 1, 1);
point3d (0, 2, 2);
}
glPopMatrix();
glFlush ();
}
void init () {
glClearColor (0.0, 0.0, 0.0, 1.0);
}
int main (int argc, char *argv[]) {
x1 = 0 ;
y1 = 0;
x2 = 1 ;
y2 = 100;
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (320, 240) ;
glutCreateWindow ("Bresenham's Algorithm");
init ();
glutDisplayFunc (display);
glutMainLoop ();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment