Showing posts with label OpenGL on Microsoft Windows. Show all posts
Showing posts with label OpenGL on Microsoft Windows. Show all posts

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;
}

OpenGL Configuration in Ms.. Visual C + + 6.0,



After installation Ms.Visual C + + 6.0, then the next step that is required OpenGL configuration computer to be able to create graphical programs in C + + 6.0 Ms.Visual. Important files required for installation of OpenGL are as follows:

1. glut.h
2. glut32.lib
3. glut32.dll

The following configuration steps on Ms.Visual OpenGL C + + 6.0:
  1. Copylah or add glut32.dll files in the directory C: \ WINDOWS \ system. As the following figure:
  2. or add glut.h header files in the directory C:\ProgramFiles\MicrosoftVisual Studio\VC98\Include\GL. As the following figure:
3. Copylah or add glut32.lib library files in the directory C: \ Program Files \ Microsoft Visual Studio \ VC98 \ Lib. As the following figure:

4. OpenGL configuration finished, and you're ready to make a graphics program on Ms.Visual C + + 6.0.
if no OpenGL you can download here