Putting an image onto the IRIS root window
    Howard Look 
    howardl at sgi.com
       
    Tue Dec  4 07:10:27 AEST 1990
    
    
  
In article <3016 at uc.msc.umn.edu> wes at msc.edu writes:
>Is there a way to place an image onto the root window of a 4D series
>IRIS?  The first step would be to convert the image from whatever
>format it is in to the proper format (IRIS rle maybe?).  The next
>step would be to load it onto the root.  I have not found any information
>about this in the manuals.  Has anyone done this?
Check out the man page for imakebackground. You could use longimage
from the image library to read a .rgb file, and then lrectwrite to
get it into the window.
Here's a copy of the now infamous night background to give you an
idea of how to use imakebackground.
Enjoy,
Howard.
/***** CUT HERE ******/
#include "gl.h"
#include "device.h"
/*
A way cool background that looks like the twilight sky.
Start it up in user.ps
Howard Look, April 13, 1990
*/
main()
{
	int gid;
	
	imakebackground() ;
	gid = winopen("") ;
	RGBmode();
	gconfig();
	shademodel(GOURAUD);
	
	ortho2(0.0, 1.0, 0.0, 1.0) ;
	qenter(REDRAW,gid);
	while (1)
	{
		short val ;
		long dev = qread(&val) ;
		if (dev == REDRAW) draw_background() ;
	}
}
#define Y1 0.0
#define Y2 .2
draw_background()
{
    int i,j;
	static int orange[] = {255,72,0};
	static int blueish[] = {0,110,189};
	static int black[] = {0,0,0};
	static int red[] = {255,0,0};
	float v1[2],v2[2],v3[2],v4[2];
	v1[0] = v4[0] = 0.0;
	v2[0] = v3[0] = 1.0;
	v1[1] = v2[1] = 0.0;
	v3[1] = v4[1] = Y1;
	bgnpolygon();
		c3i(red);
		v2f(v1);
		v2f(v2);
		c3i(orange);
		v2f(v3);
		v2f(v4);
	endpolygon();
	v1[1] = v2[1] = Y2;
	bgnpolygon();
		c3i(orange);
		v2f(v4);
		v2f(v3);
		c3i(blueish);
		v2f(v2);
		v2f(v1);
	endpolygon();
	v3[1] = v4[1] = 1.0;
	bgnpolygon();
		c3i(blueish);
		v2f(v1);
		v2f(v2);
		c3i(black);
		v2f(v3);
		v2f(v4);
	endpolygon();
	cpack(0xFFFFFF);
    for (j=0; j<10; j++)
    {
        bgnpoint();
        for (i=0; i<256; i++)
        {
			float x[2];
			x[0] = ((float)rand())/32767.0;
			x[1] = ((float)rand())/32767.0;
			v2f(x);
        }
        endpoint();
    }
    for (j =0; j<200; j++)
    {
		float x[2],r;
		x[0] = ((float)rand())/32767.0;
		x[1] = ((float)rand())/32767.0;
		r = ((float)rand())/32767.0/500.0;
		circf(x[0],x[1],r);
    }
}
    
    
More information about the Comp.sys.sgi
mailing list