TUGAS GRAFKOM Q 5

Friday, 7 December 2012



Bulat bergaris


keterangan : 
pakek openGL microsoft visual c++ 2010 express.


source code



#include <stdafx.h>
#include <glut.h>
#include <math.h>



void display()
{
glClear(GL_COLOR_BUFFER_BIT);

 float alpha, radius, cx, cy;
 cx=25;
 cy=25;
 alpha = 0;
 radius = 12;

 glBegin(GL_LINE_STRIP);
 {
  for(float i=0; i<=360; i++)
  {
   alpha+=1;
   glVertex2f(radius * cos (alpha/180 * 3.1415) + cx, radius * sin(alpha/180 * 3.1415) + cy);
  }

 }

 glEnd();


 glBegin(GL_LINES);
glVertex2f(14,20);
glVertex2f(14,30);

glVertex2f(15,18);
glVertex2f(15,32);

glVertex2f(16,17);
glVertex2f(16,33);

glVertex2f(17,16);
glVertex2f(17,34);

glVertex2f(18,15);
glVertex2f(18,35);

glVertex2f(19,14);
glVertex2f(19,35);
//------------------------
glVertex2f(20,14);
glVertex2f(20,36);

glVertex2f(21,14);
glVertex2f(21,36);
//------------------------------
glVertex2f(22,13);
glVertex2f(22,37);

glVertex2f(23,13);
glVertex2f(23,37);

glVertex2f(24,13);
glVertex2f(24,37);

glVertex2f(25,13);
glVertex2f(25,37);

glVertex2f(26,13);
glVertex2f(26,37);

glVertex2f(27,13);
glVertex2f(27,37);

glVertex2f(28,13);
glVertex2f(28,37);

glVertex2f(29,14);
glVertex2f(29,36);
//------------------------------
glVertex2f(30,14);
glVertex2f(30,36);

glVertex2f(31,14);
glVertex2f(31,36);

glVertex2f(32,15);
glVertex2f(32,35);

glVertex2f(33,16);
glVertex2f(33,34);

glVertex2f(34,17);
glVertex2f(34,33);

glVertex2f(35,18);
glVertex2f(35,32);

glVertex2f(36,20);
glVertex2f(36,30);
//------------------------------
 glEnd();

 glFlush();
}
void myinit()
{
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
 gluOrtho2D(0.0, 50.0, 0.0, 50.0);
 glMatrixMode(GL_MODELVIEW);
 glClearColor(1.0,1.0,1.0,1.0);
 glColor3f(0.0,0.0,0.0);
}

int main(int argc, char* argv[])
{
 glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
 glutInitWindowSize(400,400);
 glutInitWindowPosition(50,50);
 glutCreateWindow("testing1");
 glutDisplayFunc(display);
 myinit();
 glutMainLoop();

 return 0;
}


No comments:

Post a Comment

Cara Refund Google Ads

  Non Aktifkan Akun gogle dulu. Baru semua saldo yang berada di dalamnya, akan otomatis di kembalikan, lengkap dengan tgl berapa akan di kem...

 
FREE BLOGGER TEMPLATE BY DESIGNER BLOGS