[comp.sys.sgi] What is your StereoView aspect ratio?

sdempsey@UCSD.EDU (Steve Dempsey) (09/01/90)

I'm having a devil of a time determining what the correct aspect ratio
of a fullscreen stereo raster (1280x492 pixels) is.  This applies only to
the new StereoView option that supports programmable switching of the
monitor type with setmonitor(STR_RECT).  So far I have three possibilities
(well, two possibilities and one reality):

1.  The StereoView User's Guide (version 1.0) indicates that the correct
    aspect ratio is 1.30, based on 492 stereo scanlines expanding to the
    same physical size as 984 regular scanlines.  

	1280 / 984 = 1.30

2.  Thant Tessman of SGI has reported to me that the Mitsubishi HL6915STK
    multisync monitor is 'smart' in that it expands the vertical raster
    size to fit a programmed physical size, regardless of the actual number
    of scanlines.  So the stereo aspect ratio should be the same as a
    normal 1280x1024 raster.

	1280 / 1024 = 1.25

3.  On our 340VGX with the monitor named above I measured a 1280x1024
    raster to make sure the monitor was setup properly, and indeed I
    measured an aspect ratio of 1.25.  I then switched the monitor with
    setmonitor(STR_RECT).  The raster width did not change, but the raster
    height definitely shrank.  I measured the aspect ratio at 1.38!
    I called the Hotline and was told that this is "normal".

IS IT NORMAL FOR YOU?
    I would appreciate it if those of you who have StereoView and the "smart"
    monitor would run the little test program below and measure your
    aspect ratios and send me the results.  I can't make any sense out of
    the 1.38 figure and I fear that it may vary among machines.  If we all
    come up with the same number then I'll just accept it as some sort of
    video voodoo and put the 1.38 figure into my code.  Otherwise I'll at
    least have some ammunition to persuade SGI that a real problem exists here.

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

main()
    {
    short     val;

    foreground();
    noborder();
    prefposition(0, 1279, 0, 1023);
    winopen("");
    qdevice(KEYBD);
    color(RED);
    clear();
    while( qread(&val) != KEYBD ); /* pause here to measure the normal screen */
    color(GREEN);
    clear();
    sleep(1);	/* don't crash the VGX graphics pipe! */
    setmonitor(STR_RECT);
    while( qread(&val) != KEYBD ); /* pause here to measure the stereo screen */
    setmonitor(HZ60);
    }

---------------------------------------------------------------------------
Steve Dempsey					voice:	  (619) 534-0208
Dept. of Chemistry Computer Facility, 0314	UUCP:	  ucsd!sdempsey
University of Calif. at San Diego		BITNET:	  sdempsey@ucsd
9500 Gilman Drive				INTERNET: sdempsey@ucsd.edu
La Jolla, CA 92093-0314				fax:	  (619) 534-0058

thant@horus.esd.sgi.com (Thant Tessman) (09/06/90)

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;
}