mohon maaf karna masih simple creation..hehehe
Scriptnya kurang lebih sperti ini:
#include "stdafx.h"
#include <GL/glut.h>
void myinit()
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 50.0, 0.0, 50.0);
glMatrixMode(GL_MODELVIEW);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
{
glColor3f(1.0, 0.0, 0.0);
glVertex3i(0,0,0);
glColor3f(0.0, 1.0, 0.0);
glVertex3i(25,50,0);
glColor3f(0.0, 0.0, 1.0);
glVertex3i(50,0,0);
}
glEnd();
glFlush();
}
int main(int argc, char* argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("Segitiga Warna with OpenGL / 09.04.111.00120");
glutDisplayFunc(display);
myinit();
glutMainLoop();
return 0;
}
1 komentar:
kita juga punya nih artikel mengenai OpenGL, silahkan dikunjungi dan dibaca untuk menambah wawasan, berikut linknya
http://repository.gunadarma.ac.id/bitstream/123456789/2325/1/Texture%20Mapping%20for%20Solar%20System%20Simulation(OpenGL%20Implementation).pdf
trimakasih
Posting Komentar