What is your StereoView aspect ratio?

Thant Tessman thant at horus.esd.sgi.com
Fri Sep 7 02:16:32 AEST 1990


The only thing I can think of is that the settings on your
monitor aren't right.  I checked again, and so far, two
different Mitsubishi monitors stretch the image vertically.

Here's the program I used to work out my aspect ratio stuff:

Note:  With 3.3 the is_stereo() can be replaced with a call to

	getgdesc(GD_STEREO)


stereo.h ------------------------------------------------

/* stereo.h */

#ifndef STEREO_H
#define STEREO_H

#define YMAXSTEREO 491
#define YOFFSET 532

#endif


grid.h --------------------------------------------------

#include <gl.h>
#include <device.h>
#include <get.h>
#include "stereo.h"

#define LEFT 1
#define RIGHT 2

main() {

    int dev, val;
    int monitor;

    noborder();
    prefposition(0, XMAXSCREEN, 0, YMAXSCREEN);
    winopen("grid");

    monitor = getmonitor();

    if (is_stereo()) setmonitor(STR_RECT);

    qdevice(ESCKEY);
    qdevice(MIDDLEMOUSE);
    qdevice(WINQUIT);

    draw_test();

    while (1) {

	switch (dev=qread(&val)) {

	    case ESCKEY:
		if (val) break;
	    case WINQUIT:
		setmonitor(monitor);
		exit();

	    case REDRAW:
		draw_test();
		break;
	}
    }

}


draw_test() {

    viewport(0, XMAXSCREEN, 0, YMAXSCREEN);
    color(BLACK); clear();

    color(RED);
    viewport(0, XMAXSCREEN, 0, YMAXSTEREO);
    draw_grid();
    cmov2i(180, 0);
    charstr("right");

    color(BLUE);
    viewport(0, XMAXSCREEN, YOFFSET, YOFFSET+YMAXSTEREO);
    draw_grid();
    cmov2i(-200, 0);
    charstr("left");

}


draw_grid() {

    int i;

    ortho2(0, XMAXSCREEN.5, 0, YMAXSTEREO.5);

    recti(0, 0, XMAXSCREEN, YMAXSTEREO);

    translate(XMAXSCREEN/2.0, YMAXSTEREO/2.0, 0.0);
    scale(2.0, 1.0, 1.0);

    for (i = -128; i<=128; i+=32) {
	move2i(i, -128); draw2i(i, 128);
    }

    for (i = -128; i<=128; i+=32) {
	move2i(-128, i); draw2i(128, i);
    }

    circ(0.0, 0.0, YMAXSTEREO/2.0);
    circ(0.0, 0.0, 8.0);
    
}



/* define a way to check if stereo is installed. */
/* For now, use getvideo and setvideo:           */
#include <gl/addrs.h>
#include <gl/cg2vme.h>

int is_stereo() {

    int RV1 = TRUE;
    long rw1, rw2;
    int i;

    /* test to see if DER1_STEREO bit is read/write or read-only */
    /* if it is read-only, stereo is installed.                  */

    /* loop makes SURE the bit really behaves as a read/write bit. */

    for ( i = 1; i < 10; i++) {

	rw1 = getvideo(DE_R1);
	rw1 = rw1 ^ DER1_STEREO;                   /* flip the stereo bit */
	rw2 = rw1;
	setvideo(DE_R1, rw2);
	rw2 = getvideo(DE_R1);
	RV1 = (rw1 == rw2) ? TRUE : FALSE;
	if (!RV1) break;                        /* failed to flip the bit */

	rw2 = rw2 ^ DER1_STEREO;               /* flip the stereo bit back*/
	rw1 = rw2;
	setvideo(DE_R1, rw2);
	rw2 = getvideo(DE_R1);
	RV1 = (rw1 == rw2) ? TRUE : FALSE;
	if (!RV1) break;                    /* failed to flip the bit back*/
    } 

    return (RV1 == TRUE) ? FALSE : TRUE;
}



More information about the Comp.sys.sgi mailing list