cara membuat segitiga dengan mocrosoft visual setudio
/* Praktikum 01
* Pengenalan OpenGL
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <glut.h>
void mydisplay()
{
glClear(GL_COLOR_BUFFER_BIT); // Menghapus layar
glBegin(GL_POLYGON);
glVertex2f(0.4,0.2);
glVertex2f(0.2,0);
glVertex2f(0.4,-0.2);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(-0.4,0.2);
glVertex2f(-0.2,0);
glVertex2f(-0.4,-0.2);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(-0.2,0.4);
glVertex2f(0.2,0.4);
glVertex2f(0,0.2);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(0,-0.2);
glVertex2f(-0.2,-0.4);
glVertex2f(0.2,-0.4);
glEnd();
glFlush();
}
int main(int argc, char** argv){
printf("Contoh Sederhana Kotak ");
glutCreateWindow("Praktikum01");
glutDisplayFunc(mydisplay);
glutMainLoop();
}