WAP for to draw beatsaudio logo using circles and line(OpenGL)
#include<GL/glu.h>
#include<GL/glut.h>
#include<GL/gl.h>
using namespace std;
void draw(int i)
{
if(i!=20)
glClear(GL_COLOR_BUFFER_BIT);
int add=10;
if(i==20)
add=15;
for(int r=i;r<=i+add;r++)
{
glPointSize(2);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POINTS);
int yk=r;
int xk=0;
int p,p0=1-r;
p=p0;
int x=0,y=r;
glVertex2i(xk,yk);
glVertex2i(-xk,-yk);
glVertex2i(yk,-xk);
glVertex2i(-yk,xk);
while(x<=y)
{
if(p<0)
{
x+=1;
glVertex2i(x,y);
glVertex2i(y,x);
glVertex2i(-x,-y);
glVertex2i(-y,-x);
glVertex2i(x,-y);
glVertex2i(-y,x);
glVertex2i(-x,y);
glVertex2i(y,-x);
p=p+2*x+1;
}
else
{
x+=1;
y-=1;
glVertex2i(x,y);
glVertex2i(y,x);
glVertex2i(-x,-y);
glVertex2i(-y,-x);
glVertex2i(x,-y);
glVertex2i(-y,x);
glVertex2i(-x,y);
glVertex2i(y,-x);
p=p+2*x-2*y+1;
}
}
glEnd();
}
glColor3f(0.0,0.0,0.0);
for(int j=-12;j>-20;j--)
{
glLineWidth(3);
glBegin(GL_LINES);
glVertex2i(j,0);
glVertex2i(j,50);
glEnd();
}
glFlush();
}
void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-50, 50, -50, 50);
}
void display()
{
draw(1);
draw(20);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutCreateWindow("beatsaudio");
glutDisplayFunc(display);
init();
glutMainLoop();
}
#include<GL/glut.h>
#include<GL/gl.h>
using namespace std;
void draw(int i)
{
if(i!=20)
glClear(GL_COLOR_BUFFER_BIT);
int add=10;
if(i==20)
add=15;
for(int r=i;r<=i+add;r++)
{
glPointSize(2);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POINTS);
int yk=r;
int xk=0;
int p,p0=1-r;
p=p0;
int x=0,y=r;
glVertex2i(xk,yk);
glVertex2i(-xk,-yk);
glVertex2i(yk,-xk);
glVertex2i(-yk,xk);
while(x<=y)
{
if(p<0)
{
x+=1;
glVertex2i(x,y);
glVertex2i(y,x);
glVertex2i(-x,-y);
glVertex2i(-y,-x);
glVertex2i(x,-y);
glVertex2i(-y,x);
glVertex2i(-x,y);
glVertex2i(y,-x);
p=p+2*x+1;
}
else
{
x+=1;
y-=1;
glVertex2i(x,y);
glVertex2i(y,x);
glVertex2i(-x,-y);
glVertex2i(-y,-x);
glVertex2i(x,-y);
glVertex2i(-y,x);
glVertex2i(-x,y);
glVertex2i(y,-x);
p=p+2*x-2*y+1;
}
}
glEnd();
}
glColor3f(0.0,0.0,0.0);
for(int j=-12;j>-20;j--)
{
glLineWidth(3);
glBegin(GL_LINES);
glVertex2i(j,0);
glVertex2i(j,50);
glEnd();
}
glFlush();
}
void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-50, 50, -50, 50);
}
void display()
{
draw(1);
draw(20);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutCreateWindow("beatsaudio");
glutDisplayFunc(display);
init();
glutMainLoop();
}