Documente Academic
Documente Profesional
Documente Cultură
CSE ENGINEERS
Al Hizbul Bahar
Home
PHP
AboutMe
cake php JAVA Python WordPress OpenGL Linux/Ubuntu
Leave a comment
Follow
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
lBegin(GL_POINTS); g glVertex2i(x,y);
glEnd();
glFlush();
}
void horizontal() {
if(x1>x2)
{
foat temp;
temp = x1;
x1 = x2;
x2 = temp;
}
for(foat x=x1; x<=x2; x++)
{
setPixel(x,y1);
}
}
void vertical() {
if(y1>y2)
{
foat temp;
temp = y1;
y1 = y2;
y2 = temp;
}
for(foat y=y1; y<=y2; y++)
{
setPixel(x1,y);
}
}
void bresenham1() {
if(x1>x2)
{
foat temp;
temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
Powered by WordPress.com
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
y 2 = temp; }
int x = x1, y = y1;
int dx = x2-x1;
int dy = y2-y1;
int dT = 2*(dy-dx);
int dS = 2*dy;
int d = 2*dy-dx;
setPixel(x,y); while(x<x2)
{
x++;
if(d<0)
{
d = d+dS;
}
else
{
d = d+dT;
y++;
}
setPixel(x,y);
}
setPixel(x2,y2);
}
void bresenham2() {
if(x1>x2)
{
foat temp;
temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
y2 = temp;
}
int x = x1, y = y1;
int dx = x2-x1;
int dy = y2-y1;
int dT = 2*(dy+dx);
int dS = 2*dy;
int d = -(2*dx+dy);
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
setPixel(x,y); while(x<x2)
{
x++;
if(d<0)
{
d = d-dS;
}
else
{
y;
d = d-dT;
}
setPixel(x,y);
}
setPixel(x2,y2);
}
void bresenham3() {
if(y1>y2)
{
foat temp;
temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
y2 = temp;
}
int x = x1, y = y1;
int dx = x2-x1;
int dy = y2-y1;
int dT = 2*(dx-dy);
int dS = 2*dx;
int d = 2*dx-dy;
setPixel(x,y); while(y<y2)
{
y++;
if(d<0)
{
d = d+dS;
}
else
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
{ x++;
d = d+dT;
}
setPixel(x,y);
}
setPixel(x2,y2);
}
void bresenham4() {
if(y1>y2)
{
foat temp;
temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
y2 = temp;
}
int x = x1, y = y1;
int dx = x2-x1;
int dy = y2-y1;
int dT = 2*(dy+dx);
int dS = 2*dx;
int d = -(2*dy+dx);
setPixel(x,y); while(y<y2)
{
y++;
if(d<0)
{
d = d-dS;
}
else
{
x;
d = d-dT;
}
setPixel(x,y);
}
setPixel(x2,y2);
}
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
r eturn 0; }
To get complete code and project contact with me through email , mobile. You may commented below as your requirement.
Share this:
Related
Bresenham Circle Algorithm Using OpenGL andC++ Car Workshop(Multi Server Queuing) Simulation UsingJava
Leave a Reply
search here
Go
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
Archives
January 2014 December 2013 November 2013 September 2013 July 2013 June 2013 May 2013 April 2013
My Cloud
Algorithm
array
banker's algorithm
Binary Search
Bresenham
algorithm
c++
cakephp
Compiler
country array
cpu scheduling
data insert
Factorial
Fibonacci
First
Follow
framework
GCD
image to binary
ip address
comm
linux command
MANET
Multi
Server
nam
ns2
OpenGL
OS
paypal
java
php
Javascript
lamp
Lexical Analysis
linux
php framework
prime
Prime
number
Pyramid
python
shortest path
simulation
single server
sql
ubuntu12.04
user login
user registration
validation
wirelessnetwork
wordpress
youtube
CSE Engineers
CSE Engineers
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]
Like
Blog at WordPress.com.
| The Responsive Theme.
http://engineersview.wordpress.com/2013/05/21/bresenham-line-algorithm-using-opengl-and-c/[11/02/2014 19:59:53]