Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <GL/glut.h>
- using namespace std;
- #define PI 3.14
- void lingkaran(float center_x, float center_y, float jari2, int res = 100) {
- glBegin(GL_LINE_LOOP);
- for(int i = 0; i <= res;i++) { glVertex2f(
- center_x + (jari2 * cos(i * (2.0f * PI) / res)),
- center_y + (jari2 * sin(i * (2.0f * PI) / res))
- ); }
- glEnd();
- }
- void tampil() {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3ub(0,255,0);
- lingkaran(100,100,70);
- glutSwapBuffers();
- }
- int main(int argc, char** argv) {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
- glutInitWindowPosition(100,100); glutInitWindowSize(480,480);
- glutCreateWindow("Pemrograman Grafik RPL 2017");
- glClearColor(1.0,1.0,1.0,0);
- gluOrtho2D(0.,200.,0.,200.); // proyeksi bidang gambar
- glutDisplayFunc(tampil); glutMainLoop(); return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement