home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume26 / pico / part01 / dpy.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-14  |  680 b   |  34 lines

  1. #include "pico.h"
  2.  
  3. #ifdef sgi
  4. #include <gl/gl.h>
  5. static void initdisplay() {
  6.     static init;
  7.     if (!init) {
  8.         init = 1;
  9.         prefposition(200, 199 + DEF_X, 200, 199 + DEF_Y);
  10.         foreground();
  11.         winopen("pico");
  12.         RGBmode();
  13.         gconfig();
  14.     }
  15. }
  16.  
  17. /*
  18.    pico works with [0,0] in the top left, but sgi windows put it in
  19.    the bottom left
  20. */
  21.  
  22. extern void display(unsigned char *data) {
  23.     unsigned long scr[DEF_X * DEF_Y];
  24.     int i,j;
  25.     initdisplay();
  26.     for (i = 0, j = DEF_X*(DEF_Y-1); i < DEF_Y*DEF_X; i++, (++j&(DEF_X-1)) || j -= 2*DEF_X)
  27.         scr[j] = data[i] | (data[i]<<8) | (data[i]<<16);
  28.     lrectwrite(0, 0, DEF_X - 1, DEF_Y - 1, scr);
  29. }
  30. #else
  31. extern void display(unsigned char *data) {
  32. }
  33. #endif
  34.