Go to the first, previous, next, last section, table of contents.


OpenGL Graphics in MUC

Muq supports OpenGL graphics as of release -1.45.0, provided that you compile the server on a machine with appropriate libraries.

On Debian, this means you typically need the following packages installed:

mesag3
mesag-dev
glutg3
glutg3-dev

(If anyone will tell me what the required libraries are for other distributions, say RedHat, I'll be happy to list that information here also.)

If these packages are missing, Muq will still compile fine, but the OpenGL calls will be stubbed out to error traps.

The main missing OpenGL functionality as of Muq -1.45.0 relates to input (from mouse and such). Nearly all the drawing commands should work. Almost none of them have been tested, however.

Here is a transcript of using MUC to draw the OpenGL teapot:

cynbe@chee muq/c> ./muq
Opening db ROOTDB...
Opening db KEYW...
Opening db MUF...
Opening db LISP...
Opening db QNET...
Opening db ANSI...
Opening db DBUG...
Opening db DICT...
Opening db DIFI...
Opening db GEST...
Opening db LNED...
Opening db MUC...
Opening db MUFV...
Opening db OMSH...
Opening db OMUD...
Opening db PUB...
Opening db QNETA...
Opening db RMUD...
Opening db TASK...
Opening db TLNT...
Opening db muqn...
MUF (Multi-User Forth) shell starting up
Hints from me$s.loginHints$h[1,2...]:
  For configuration menu do:       config
  To exit server from console do:  <CTRL>-C or rootShutdown
root: 
muc:shell
MUC (Multi-User C) shell starting up
root> 
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
root> 
glutCreateWindow("Teapot");
root>  1
float* light_diffuse  = (float*) { 1.0, 1.0, 1.0, 1.0 };
root> 
float* light_position = (float*) { 1.0, 1.0, 1.0, 0.0 }; 
root> 
glLightfv( GL_LIGHT0, GL_DIFFUSE, light_diffuse );
root> 
glLightfv( GL_LIGHT0, GL_POSITION, light_position );
root> 
glEnable( GL_LIGHTING );
root> 
glEnable( GL_LIGHT0 );
root> 
glEnable( GL_DEPTH_TEST );
root> 
glMatrixMode( GL_PROJECTION );
root> 
gluPerspective( 40.0, 1.0, 1.0, 10.0 );
root> 
glMatrixMode( GL_MODELVIEW );
root> 
glutSwapBuffers();
root> 
gluLookAt( /*eye:*/ 0.0,0.0,3.0, /*centre:*/ 0.0,0.0,0.0, /*up:*/ 0.0,1.0,0.0);
root> 
glTranslatef( 0.0,0.0, -1.0 );
root> 
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
root> 
glutSolidTeapot( 1.0 );
root> 
glutSwapBuffers();
root> 
glFlush();
root> 
sleepJob( 1000 );
root> 
glutDestroyWindow( glutGetWindow() );
root> 


Go to the first, previous, next, last section, table of contents.