Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <GL/glut.h>
- using namespace std;
- void mydisplay() {
- float x, q = 0.7, y;
- int i = 1;
- glClear(GL_COLOR_BUFFER_BIT); // Menghapus layar
- glBegin(GL_LINE_STRIP);
- for(x=-1;x<=1;x+=0.2) {
- if (i % 2 == 0) y = -q; else y = q;
- i++;
- glVertex2f(x,y);
- printf("p: %0.4f, y: %0.4f\n",x,y);
- }
- glEnd(); glFlush();
- }
- int main() {
- glutCreateWindow( "Pemrograman Grafik RPL 2017");
- glutDisplayFunc(mydisplay);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement