// reshape the display after a shape change
void OpenGLDisplayDevice::reshape(void) {
  xSize = 512;
  ySize = 512;
  xOrig = 0;
  yOrig = 0;

  switch (inStereo) {
    case OPENGL_STEREO_SIDE:
    case OPENGL_STEREO_CROSSED:
      set_screen_pos(0.5f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_ABOVEBELOW:
      set_screen_pos(2.0f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_STENCIL:
      enable_stencil_stereo();
      set_screen_pos((float)xSize / (float)ySize);
      break;
 
    default:
      set_screen_pos((float)xSize / (float)ySize);
      break;
  }
}
// reshape the display after a shape change
void OpenGLDisplayDevice::reshape(void) {
  // this code assumes that the xSize and ySize variables have
  // been updated (magically) already by the time this gets called.

  switch (inStereo) {
    case OPENGL_STEREO_SIDE:
      set_screen_pos(0.5f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_ABOVEBELOW:
      set_screen_pos(2.0f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_STENCIL_CHECKERBOARD:
    case OPENGL_STEREO_STENCIL_COLUMNS:
    case OPENGL_STEREO_STENCIL_ROWS:
      enable_stencil_stereo(inStereo);
      set_screen_pos((float)xSize / (float)ySize);
      break;
 
    default:
      set_screen_pos((float)xSize / (float)ySize);
      break;
  }
}
Esempio n. 3
0
// reshape the display after a shape change
void FltkOpenGLDisplayDevice::reshape(void) {

  xSize = window->w();
  ySize = window->h();
  xOrig = window->x();
  yOrig = screenY - window->y() - ySize;

  switch (inStereo) {
    case OPENGL_STEREO_SIDE:
      set_screen_pos(0.5f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_ABOVEBELOW:
      set_screen_pos(2.0f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_STENCIL_CHECKERBOARD:
    case OPENGL_STEREO_STENCIL_COLUMNS:
    case OPENGL_STEREO_STENCIL_ROWS:
      enable_stencil_stereo(inStereo);
      set_screen_pos((float)xSize / (float)ySize);
      break;

    default:
      set_screen_pos((float)xSize / (float)ySize);
      break;
  }
}
Esempio n. 4
0
/*
*	Function: handle_key_press(uint8_t scancode)
*	Description: This function handles how to interpret characters pressed
*				the keyboard
*	inputs:	 keyboard scan code
*	outputs: nothing
*	effects: modifies the contents displayed on the screen
*/
void
handle_key_press(uint8_t scancode) {


	// Handle unknown scancodes
	if (scancode >= KEY_COUNT) {
		return;
	}

	uint8_t key = scancode_map[key_mode][scancode];

	// None character keys are handled in interrupt handler
	if (key == NULL_KEY) {
		return;
	}

	if (ctrl_state == PRESSED) {
		switch(key) {
			case 'l':
				clear();
				set_screen_pos(0,0);
				break;
			case 'c':
				return;
				break;
		}
	}

	else if ((key_buffer_idx < KEY_BUFFER_SIZE) && (keyboard_enabled == 1)) {
		append_to_key_buff(key);
		putc(key);
	}
}
Esempio n. 5
0
 void
 DisplayDevice::do_resize_window (int w, int h)
 {
   xSize = w;
   ySize = h;
   set_screen_pos ((float) xSize / (float) ySize);
 }
// reshape the display after a shape change
void OpenGLPbufferDisplayDevice::reshape(void) {
  switch (inStereo) {
    case OPENGL_STEREO_SIDE:
      set_screen_pos(0.5f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_ABOVEBELOW:
      set_screen_pos(2.0f * (float)xSize / (float)ySize);
      break;

    case OPENGL_STEREO_STENCIL_CHECKERBOARD:
    case OPENGL_STEREO_STENCIL_COLUMNS:
    case OPENGL_STEREO_STENCIL_ROWS:
      enable_stencil_stereo(inStereo);
      set_screen_pos((float)xSize / (float)ySize);
      break;
 
    default:
      set_screen_pos((float)xSize / (float)ySize);
      break;
  }
}
Esempio n. 7
0
/////////////////////////  constructor and destructor  
DisplayDevice::DisplayDevice (const char *nm) : transMat(16) {
  name = stringdup(nm);       // save the string name of this display device
  num_display_processes  = 1; // set number of rendering processes etc
  renderer_process = 1;       // we're a rendering process until told otherwise
  _needRedraw = 0;            // Start life not needing to be redrawn. 
  backgroundmode = 0;         // set default background mode to solid color

  // set drawing characteristics default values
  lineStyle = ::SOLIDLINE;
  lineWidth = 1;
  sphereRes = 3;
  cylinderRes = 6;
  sphereMode = ::SOLIDSPHERE;

  // set scalar values
  aaAvailable = cueingAvailable = TRUE;
  aaPrevious = aaEnabled = cueingEnabled = cullingEnabled = FALSE;
  xOrig = yOrig = xSize = ySize = 0;
  screenX = screenY = 0;

  // set viewing geometry ... looking from z-axis in negative direction,
  // with 90-degree field of view and assuming the origin is in the
  // center of the viewer's 'screen'
  nearClip = 0.5f;
  farClip = 10.0f;
  eyePos[0] = eyePos[1] = 0.0f;  eyePos[2] = 2.0f;
  set_screen_pos(2.0f * eyePos[2], 0.0f, 4.0f/3.0f);

  // set initial depth cueing parameters 
  // (defaults are compatible with old revs of VMD)
  cueMode = CUE_EXP2;
  cueDensity = 0.32f;
  cueStart = 0.5f;
  cueEnd = 10.0f;

  // set initial shadow mode
  shadowEnabled = 0;

  // set initial ambient occlusion settings
  aoEnabled = 0;
  aoAmbient = 0.8f;
  aoDirect = 0.3f;

  // XXX stereo modes and rendering modes should be enumerated 
  // dynamically not hard-coded, to allow much greater flexibility

  // Setup stereo options ... while there is no stereo mode by default,
  // set up normal values for stereo data
  inStereo = 0;
  stereoSwap = 0;
  stereoModes = 1;
  stereoNames = stereoNameStr;

  // Setup caching mode options
  cacheMode = 0;
  cacheModes = 1;
  cacheNames = cacheNameStr;

  // Setup rendering mode options
  renderMode = 0;
  renderModes = 1;
  renderNames = renderNameStr;

  // default view/projection settings
  eyeSep = 0.065f;               // default eye seperation
  eyeDist = eyePos[2];	         // assumes viewer on pos z-axis

  float lookatorigin[3];
  vec_scale(&lookatorigin[0], -1, &eyePos[0]); // calc dir to origin
  set_eye_dir(&lookatorigin[0]);               // point camera at origin
  upDir[0] = upDir[2] = 0.0;  upDir[1] = 1.0;
  calc_eyedir();                 // determines eye separation direction
  my_projection = PERSPECTIVE;

  // load identity matrix onto top of transformation matrix stack
  Matrix4 temp_ident;
  transMat.push(temp_ident);

  mouseX = mouseY = 0;
}