pencil drawings

IRIX Screensavers

This is a small text on screensavers for IRIX (6.5.x). No hard effort was put in it, but it's handy to keep the document online, I thought.

Normal savers use 'haven'. A more advanced screensaver utility is 'xscreensaver'.

A note on XScreensaver: XScreensaver is nice, but I had some trouble getting it to work with OpenGL 24-bit screensavers (which was JUST what I was downloading it for). It may be ofcourse, that I'm not too good of a Unix whiz (yet). The problems seems to be that the usual screensavers are STILL written in GL, not OpenGL. Atlantis is supported since 6.3, but I know there are 2 versions of this one; one in GL and one in OpenGL. I don't know for sure whether the supported version is the GL or OpenGL version, but I have a pretty sure hunch...

I am currently working (as a pet project; a hobby) on a screensaver (and partly perhaps for this stand-alone machine we're making; eh, well let's let the computer have some fun drawing for itself). I use C++, so the drawing part is neatly tucked away in the class somewhere, so converting to OpenGL is really quite simple. Besides, I love the way you can say 'fullscrn(); winopen();' in GL and presto! Well, almost ofcourse. Use RGBmode(); gconfig(); and that sort of stuff to get a nice 24-bit image.

Look into /usr/lib/X11/savers/defaults. There are the files that the desktop looks at (try: par ssaver | grep open). You can deduce that sort of file for your own saver. I did. If you look at the savers you get when registering, you can see in swmgr that they consist of just 2 files; the file in /usr/lib/X11/savers/defaults/ and the executable itself. That seems easy enough.

The default savers seem to use either haven or xlock. The latter mysteriously (look at the hardcoded modes in 'man xlock') seems to know only so many savers. Weird. Probably ancient stuff. It doesn't take much for a GL saver; I've included a small test I once did. I know the code sucks, but I haven't seen any book on GL yet, so most of it is deduced from manpages and legacy knowledge. I've kept some commented parts; it was just-a-test.

--- ssaver.c (link with -lgl or something; see where it ends up)

#include <gl/gl.h>
#include <gl/device.h>
#include <dmedia/dmedia.h>
void Line(int x1,int y1,int x2,int y2)
{ short v[2];
  bgnline();
    v[0]=x1; v[1]=y1; v2s(v);
    v[0]=x2; v[1]=y2; v2s(v);
  endline();
}
#define MAXX 1280		// getgdesc(GD_XPMAX)
#define MAXY 1024
void main(int argc,char **argv)
{ int x1,y1,x2,y2;
  int v[2][2];

  prefsize(1280,1024);
  winopen("GL window");
  RGBmode();
  doublebuffer();
  //viewport(0,768,0,576);
  fullscrn();
  gconfig();
  //winposition(100,200,100,200);
  //imakebackground();
  clear();

  v[0][0]=1; v[0][1]=2;
  v[1][0]=3; v[1][1]=4;
  x1=100; y1=150; x2=400; y2=400;
  qdevice(ESCKEY);
  clear(); swapbuffers();
  clear(); //swapbuffers();
  while(1)
  { cpack(0); clear();
    x1=x1+v[0][0]; if(x1<0||x1>=MAXX){ v[0][0]=-v[0][0]; x1=x1+v[0][0];      }
    y1=y1+v[0][1]; if(y1<0||y1>=MAXY){ v[0][1]=-v[0][1]; y1=y1+v[0][1];      }
    x2=x2+v[1][0]; if(x2<0||x2>=MAXX){ v[1][0]=-v[1][0]; x2=x2+v[1][0];      }
    y2=y2+v[1][1]; if(y2<0||y2>=MAXY){ v[1][1]=-v[1][1]; y2=y2+v[1][1];      }
    cpack(0xFFFFFFFF);
    Line(x1,y1,x2,y2);
    swapbuffers();
    if(qtest())
    { short data;
      if(qread(&data)==ESCKEY)
      break;
    }
  }
}
---

Ruud van Gaal, 23-6-1999
(c) 1998-2006 Dolphinity BV / Ruud van Gaal