Wednesday, March 16, 2011

Sample Point Drawing program with Visual C + +

#include <GL/glut.h>

void drawTitik(int x, int y)
{
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
}

void drawTitik()
{
glBegin(GL_POINTS);
glVertex2i(100,50);
glVertex2i(100,130);
glVertex2i(150,130);
glEnd();
}

void display(void)
{
//clear screen
glClear(GL_COLOR_BUFFER_BIT);
drawDot();
glutSwapBuffers();
}

int main(int argc, char **argv)
{
glutInit(&argc,argv);//Inisialisasi Toolkit
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowPosition(100,100);
glutInitWindowSize(640,480);
glutCreateWindow("My First OpenGL");
glClearColor(0.0, 0.0,0.0,0.0);
gluOrtho2D(0.,840.,-240.,240.);
glutIdleFunc(display);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}


0 comments:

Post a Comment