Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

VRJugglerDisplayDevice.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  *cr VRJuggler patches contributed by Martijn Kragtwijk: m.kragtwijk@rug.nl
00008  *cr
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  * RCS INFORMATION:
00013  *
00014  *      $RCSfile: VRJugglerDisplayDevice.C,v $
00015  *      $Author: johns $        $Locker:  $             $State: Exp $
00016  *      $Revision: 1.4 $       $Date: 2019/01/17 21:21:02 $
00017  *
00018  ***************************************************************************
00019  * DESCRIPTION:
00020  * a VRJuggler specific display device for VMD
00021  ***************************************************************************/
00022 #include "VRJugglerDisplayDevice.h" 
00023 #include "Inform.h"
00024 //#include <vrjuggler_ogl.h>          // include vrjuggler library access
00025 
00026 // static string storage used for returning stereo modes
00027 static const char *vrjugglerStereoNameStr[1] = {"VRJuggler"};
00028 
00030 VRJugglerDisplayDevice::VRJugglerDisplayDevice(void) : OpenGLRenderer("VRJuggler") {
00031   stereoNames = vrjugglerStereoNameStr;
00032   stereoModes = 1;
00033   doneGLInit = FALSE;    
00034   num_display_processes  = 0; //VRJugglerConfig->ActiveWalls;
00035                                                           // hebben we deze variabele wel nodig?
00036     
00037   // leave everything else up to the vrjuggler_gl_init_fn
00038 }
00039 
00041 VRJugglerDisplayDevice::~VRJugglerDisplayDevice(void) {
00042   // nothing to do
00043 }
00044 
00045 
00047 
00048 // set up the graphics on the seperate VRJuggler displays
00049 void VRJugglerDisplayDevice::vrjuggler_gl_init_fn(void) {
00050   setup_initial_opengl_state();     // do all OpenGL setup/initialization now
00051 
00052   // follow up with mode settings
00053   aaAvailable = TRUE;               // enable antialiasing
00054   cueingAvailable = FALSE;          // disable depth cueing
00055   cullingAvailable = FALSE;         // disable culling 
00056   // XXX need to test this still
00057   // ext->hasstereo = VRJugglerInStereo();  // stereo availability test
00058   ext->hasstereo = TRUE;            // stereo is on initially
00059   ext->stereodrawforced = FALSE;    // no need for forced stereo draws
00060  
00061   glClearColor(0.0, 0.0, 0.0, 0.0); // set clear color to black
00062 
00063   aa_on();                          // force antialiasing on if possible
00064   cueing_off();                     // force depth cueing off
00065 
00066   // set default settings 
00067   set_sphere_mode(sphereMode);
00068   set_sphere_res(sphereRes);
00069   set_line_width(lineWidth);
00070   set_line_style(lineStyle);
00071 
00072   clear();                          // clear screen
00073   update();                         // swap buffers
00074 
00075   // we want the VRJuggler to be centered at the origin, and in the range -1, +1
00076   (transMat.top()).translate(0.0, 3.0, -2.0);
00077   (transMat.top()).scale(PI);
00078 
00079   doneGLInit = TRUE;                // only do this once
00080 }
00081 
00082 void VRJugglerDisplayDevice::set_stereo_mode(int) {
00083   // cannot change to stereo mode in the VRJuggler, it is setup at init time
00084 }
00085   
00086 void VRJugglerDisplayDevice::normal(void) {
00087   // prevent the OpenGLRenderer implementation of this routine
00088   // from overriding the projection matrices provided by the 
00089   // VRJuggler library.
00090 }
00091 
00092 // special render routine to check for graphics initialization
00093 void VRJugglerDisplayDevice::render(const VMDDisplayList *cmdlist) {
00094   //msgInfo << ".";
00095 
00096   if(!doneGLInit) {
00097     vrjuggler_gl_init_fn();
00098   }
00099 
00100   // prepare for rendering
00101   glPushMatrix();
00102   multmatrix((transMat.top()));  // add our VRJuggler adjustment transformation
00103 
00104   // update the cached transformation matrices for use in text display, etc.
00105   // In the VRJuggler, we have to do this separately for all of the processors.  
00106   // Would be nice to do this outside of the render routine however, 
00107   // amortized over several Displayables.
00108   glGetFloatv(GL_PROJECTION_MATRIX, ogl_pmatrix);
00109   glGetFloatv(GL_MODELVIEW_MATRIX, ogl_mvmatrix);
00110   ogl_textMat.identity();
00111   ogl_textMat.multmatrix(ogl_pmatrix);
00112   ogl_textMat.multmatrix(ogl_mvmatrix);
00113 
00114   // call OpenGLRenderer to do the rest of the rendering the normal way
00115   OpenGLRenderer::render(cmdlist);
00116   glPopMatrix();
00117 }
00118 
00119 // update after drawing
00120 void VRJugglerDisplayDevice::update(int do_update) {
00121 }
00122 

Generated on Sun Oct 6 02:43:29 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002