void GLUI_Mouse_Interaction::draw_active_area( void ) { int win_h = glutGet( GLUT_WINDOW_HEIGHT ), win_w = glutGet(GLUT_WINDOW_WIDTH); int text_height = 18; /* what a kludge */ int viewport_size = h-text_height; /*MIN(w,h); */ glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glTranslatef( (float) win_w/2.0, (float) win_h/2.0, 0.0 ); glRotatef( 180.0, 0.0, 1.0, 0.0 ); glRotatef( 180.0, 0.0, 0.0, 1.0 ); glTranslatef( (float) -win_w/2.0, (float) -win_h/2.0, 0.0 ); glTranslatef( (float) this->x_abs + .5, (float) this->y_abs + .5, 0.0 ); glTranslatef( (float)this->w/2.0, (float)viewport_size/2.0 + 2.0 , 0.0 ); /*** Draw the interaction control's orthographic elements ***/ iaction_draw_active_area_ortho(); /*** Setup and draw the interaction control's perspective elements ***/ /*** Set the viewport to just the square of the drawing area ***/ /* glViewport( this->x_abs , glui->main_panel->h - this->y_abs - this->h,*/ /*glViewport( this->x_abs+1+(this->w/2-viewport_size/2), this->h-this->y_abs-viewport_size-1, viewport_size, viewport_size );*/ viewport_size -= 4; int offset = 0; if ( ((this->w-viewport_size) % 2) == 1 ) offset = 1; glViewport( this->x_abs + (this->w-viewport_size)/2 + offset, win_h - this->y_abs - this->h + text_height, viewport_size, viewport_size ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); double xy=1.00,zc=50.0; /* X-Y size, and Z origin */ glFrustum( -1.0*xy, 1.0*xy, -xy, xy, zc*0.7, zc*1.3 ); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glTranslatef( 0.0, 0.0, -zc ); glScalef(xy,xy,1.0); // xy); /* glutSolidTeapot( 1.0 ); */ iaction_draw_active_area_persp(); glMatrixMode( GL_MODELVIEW ); glPopMatrix(); glui->set_viewport(); glui->set_ortho_projection(); glMatrixMode( GL_MODELVIEW ); glPopMatrix(); }
void GLUI_Mouse_Interaction::draw_active_area( void ) { int orig; int win_h = glutGet( GLUT_WINDOW_HEIGHT ), win_w = glutGet(GLUT_WINDOW_WIDTH); if ( NOT glui ) return; /*putchar( 'X' ); flushout; */ orig = set_to_glut_window(); int text_height = 18; /* what a kludge */ int viewport_size = h-text_height; /*MIN(w,h); */ glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glTranslatef( (float) win_w/2.0, (float) win_h/2.0, 0.0 ); glRotatef( 180.0, 0.0, 1.0, 0.0 ); glRotatef( 180.0, 0.0, 0.0, 1.0 ); glTranslatef( (float) -win_w/2.0, (float) -win_h/2.0, 0.0 ); glTranslatef( (float) this->x_abs + .5, (float) this->y_abs + .5, 0.0 ); glTranslatef( (float)this->w/2.0, (float)viewport_size/2.0 + 2.0 , 0.0 ); /*** Draw the interaction control's orthographic elements ***/ iaction_draw_active_area_ortho(); /*** Setup and draw the interaction control's perspective elements ***/ /*** Set the viewport to just the square of the drawing area ***/ /* glViewport( this->x_abs , glui->main_panel->h - this->y_abs - this->h,*/ /*glViewport( this->x_abs+1+(this->w/2-viewport_size/2), this->h-this->y_abs-viewport_size-1, viewport_size, viewport_size );*/ viewport_size -= 4; int offset = 0; if ( ((this->w-viewport_size) % 2) == 1 ) offset = 1; glViewport( this->x_abs + (this->w-viewport_size)/2 + offset, win_h - this->y_abs - this->h + text_height, viewport_size, viewport_size ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum( -1.0*.08, 1.0*.08, -.08, .08, .1, 8.0 ); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glTranslatef( 0.0, 0.0, -3.2f ); /* glutSolidTeapot( 1.0 ); */ iaction_draw_active_area_persp(); glMatrixMode( GL_MODELVIEW ); glPopMatrix(); glui->set_viewport(); glui->set_ortho_projection(); glMatrixMode( GL_MODELVIEW ); glPopMatrix(); restore_window(orig); }