Up: SGI graphics Frequently Asked Questions (FAQ)
Next: -61- Why can't 'cc' find some standard Xwindows functions?
Previous: -59- Why does nothing happen when I call mapcolor(index, R, G, B)?
Subject: -60- What's wrong with blink() in IRIX 4.0.x?
Date: 10 Jun 1993 00:00:01 EST
- blink() is broken all the way up through 4.0.5F, where blink() only
blinks to black.
- you can work-around this blink() problem by doing the following:
blink(rate, index, red<<8, green<<8, blue<<8)
- ~4Dgifts/examples/glpg/ch04/blinker.c has three main problems:
- it doesn't do the above work-around.
- it doesn't do a gflush after mapping colors.
- it doesn't turn blinking off initially.
- what happens is that if a program starts anything blinking and
exits without ever turning blinking off with blink(-1, 0, 0, 0, 0)
then the next program to attempt blinking will not be able to
blink. this happens if for instance you close the blinker window
before its 10 second sleep() has completed.
- a simple idea for a work-around for this problem: programs which do
blinking should turn their blinking on when they have focus; they
should turn all blinking off when they lose focus. This is not
perfect but is a plausible attempt at sharing the 20 blinking
system-wide colormap entries.
Here is a copy of ~4Dgifts/examples/glpg/ch04/blinker.c that contains
the above workarounds, except for input-focus:
#include <gl/gl.h>
#define MAXBLINKS 20 /* maximum number of blinking entries */
#define FIRSTBLINKCI 64 /* avoid the first 64 colors */
main()
{
int i;
prefsize(400, 400);
winopen("blinker");
ortho2(-0.5, 20.0*MAXBLINKS + 9.5, -0.5, 500.5);
color(BLACK);
clear();
/* always turn blinking off before calling 'blink' */
blink (-1, 0, 0, 0, 0);
for (i = MAXBLINKS - 1; i >= 0 ; i--) {
mapcolor(i + FIRSTBLINKCI, 255, 255, 255);
/* always call gflush() after mapcolors() */
gflush();
color(i + FIRSTBLINKCI);
sboxfi(i*20 + 10, 10, i*20 + 20, 490);
/* GL bug in blink -- must left-shift r,g,b values */
blink(i + 1, i + FIRSTBLINKCI, 255 << 8, 0 << 8, 0 << 8);
}
sleep(10);
blink(-1, 0, 0, 0, 0); /* stop all blinking */
gexit();
return 0;
}
Up: SGI graphics Frequently Asked Questions (FAQ)
Next: -61- Why can't 'cc' find some standard Xwindows functions?
Previous: -59- Why does nothing happen when I call mapcolor(index, R, G, B)?