Posts

Showing posts with the label opengl

Bresenhams Line Drawing Algorithm in OpenGL C code

Bresenhams Line Drawing Algorithm in OpenGL C code //Author: Azhar Khan //Rajasthan Technical University //Poornima Institute of Engineering And Technology # include < GL/glut.h > # include < windows.h > # include < stdio.h > GLint x0 , y0 , xEnd , yEnd ; void init ( ) {     glClearColor ( 1.0 , 1.0 , 1.0 , 0.0 ) ;     glColor3f ( 1.0 f , 0.0 f , 0.0 f ) ;     glPointSize ( 1.0 ) ;     glMatrixMode ( GL_PROJECTION ) ;     glLoadIdentity ( ) ;     gluOrtho2D ( 0.0 , 600.0 , 0.0 , 600.0 ) ; } void setPixel ( GLint xcoordinate , GLint ycoordinate ) {     glBegin ( GL_POINTS ) ;     glVertex2i ( xcoordinate , ycoordinate ) ;     glEnd ( ) ;     glFlush ( ) ; } void lineBA ( GLint x0 , GLint y0 , GLint xEnd , GLint yEnd ) {     GLint dx = xEnd - x0 ;     GLint dy = yEnd - y0 ; ...