REM Demo on how to embed an external library REM http://www.opengl.org/ REM REM PvE, August 2014 - GPL. REM REM Add the necessary include files and libraries as command line option to the compiler: REM REM gcc -include GL/gl.h -include GL/glut.h -g -o teapot teapot.c -lm -lgc -lGL -lglut REM REM Some colors DECLARE lightpos[] = { 2.0, 2.0, -8.0, 0.0 } TYPE float DECLARE lightamb[] = { 0.15, 0.15, 0.15 } TYPE float DECLARE teapot_color[] = { 0.1, 0.7, 0.1, 0.5 } TYPE float REM Current position of teapot FLOAT xpos, ypos REM Draw the teapot SUB display() CALL glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) CALL glShadeModel(GL_SMOOTH) CALL glEnable(GL_DEPTH_TEST) CALL glEnable(GL_LIGHTING) CALL glEnable(GL_LIGHT0) CALL glLightfv(GL_LIGHT0, GL_POSITION, lightpos) CALL glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, teapot_color) CALL glMatrixMode(GL_MODELVIEW) CALL glPushMatrix() CALL glRotated(xpos, 1.0, 0.0, 0.0) CALL glRotated(ypos, 0.0, 1.0, 0.0) CALL glutSolidTeapot(0.5) CALL glLoadIdentity() CALL glPopMatrix() CALL glutSwapBuffers() ENDSUB REM Idle loop SUB idle() INCR xpos, 0.5 INCR ypos, 1.0 CALL glutPostRedisplay() ENDSUB CALL glutInit(&argc, argv) CALL glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) CALL glutInitWindowSize(500, 400) CALL glutCreateWindow("M4BASIC using OpenGL") CALL glClearColor(0.0, 0.0, 0.0, 1.0) CALL glutDisplayFunc(display) CALL glutIdleFunc(idle) CALL glutMainLoop()