drawing in subwindows

Malgorzata Sturgill margaret at cs.utah.edu
Wed Aug 15 02:00:19 AEST 1990


Hi,
	I am trying to draw in subwindows ( open with swinopen ). I finally 
managed to persuade my code to draw, but unfortunately it does not draw where 
I expect. I have included a piece of code to ilustrate. All this program does 
it opens a 300x300 parent window (black) and then opens a white 200x200 white 
subwindow. the program is then supposed to draw the diagonals of the subwindow 
in red. Well it does not. It does draw a cross, but it does not fill the whole
window. Am I just doing something stupid?

					Any help would be great,

							m.
------------------ Code Follows ---------------------------------------------

#include <stdio.h>
#include <gl.h>
#include <device.h>

long parent, child;

main(argc, argv)
int argc;
char *argv[];
{
short data;

	foreground();
	prefposition(500,800,500,800);
	parent = winopen("parent") ;
	gconfig();
	reshapeviewport();
	color(BLACK);
	clear();
	child = swinopen(parent);
	winposition(50,250,50,250);
	gconfig();
	color(WHITE);
	clear();
	qenter(REDRAW,(short)child);

	while (TRUE){
		while (qtest()){
			switch(qread(&data)){
				case REDRAW:
					if ((long)data == parent){
						winset(parent);
						reshapeviewport();
						color(BLACK);
						clear();
						break;
					}
					if ((long)data == child){
						redr();
						printf("child redrawn\n");
					}
					break;
				default:
					break;

			}
		}
	}
}

redr(){
	winset(child);
	reshapeviewport();
	color(WHITE);
	clear();
	color(RED);
	move2(0,0);
	draw2(199,199);
	move2(0,199);
	draw2(199,0);
}

Malgorzata Marek Sturgill		margaret at cs.utah.edu
					margaret at ms.uky.edu

"A sphere isn't that simple when you get into higher dimensions
 - it's a bit non-flat."

			- Annonymous
Malgorzata Marek Sturgill		margaret at cs.utah.edu
					margaret at ms.uky.edu

"A sphere isn't that simple when you get into higher dimensions



More information about the Comp.sys.sgi mailing list