Ejemplo n.º 1
0
void    GLUI_Rotation::iaction_draw_active_area_persp( void )
{
  /********** arcball *******/
  copy_float_array_to_ball();

  setup_texture();
  setup_lights();
	
  glEnable(GL_CULL_FACE );

  glMatrixMode( GL_MODELVIEW );
  glPushMatrix();

  mat4 tmp_rot = *ball->rot_ptr;
  glMultMatrixf( (float*) &tmp_rot[0][0] ); 

  /*** Draw the checkered box ***/
  /*glDisable( GL_TEXTURE_2D );              */
  draw_ball(1.35); // 1.96 );

  glPopMatrix();

  glBindTexture(GL_TEXTURE_2D,0); /* unhook our checkerboard texture */
  glDisable( GL_TEXTURE_2D );
  glDisable( GL_LIGHTING );
  glDisable( GL_CULL_FACE );
}
Ejemplo n.º 2
0
void    GLUI_Rotation::iaction_draw_active_area_persp( void )
{
    if ( NOT can_draw() )
        return;

    copy_float_array_to_ball();

    setup_texture();
    setup_lights();

    glEnable(GL_CULL_FACE );

    glMatrixMode( GL_MODELVIEW );
    glPushMatrix();

    mat4 tmp_rot = *ball->rot_ptr;
    glMultMatrixf( (float*) &tmp_rot[0][0] );

    /*** Draw the checkered box ***/
    /*glDisable( GL_TEXTURE_2D );              */
    draw_ball( 1.96 );

    glPopMatrix();

    glDisable( GL_TEXTURE_2D );
    glDisable( GL_LIGHTING );
    glDisable( GL_CULL_FACE );
}
Ejemplo n.º 3
0
int    GLUI_Rotation::iaction_mouse_up_handler( int local_x, int local_y, 
						int inside )
{
  copy_float_array_to_ball();

  ball->mouse_up();

  return false;
}
Ejemplo n.º 4
0
int    GLUI_Rotation::iaction_mouse_down_handler( int local_x, int local_y )
{
  copy_float_array_to_ball();

  init_ball();

  local_y = (int)(2.0 * ball->center[1] - local_y);

  ball->mouse_down( local_x, local_y );

  /*	printf( "%d %d - %f %f\n", local_x, local_y, ball->center[0], ball->center[1] );              */

  copy_ball_to_float_array();

  spinning = false;

  return false;
}
Ejemplo n.º 5
0
int    GLUI_Rotation::iaction_mouse_held_down_handler( int local_x, int local_y,
						       int inside)
{  
  if ( NOT glui )
    return 0;

  copy_float_array_to_ball();

  local_y = (int)(2.0 * ball->center[1] - local_y);

  /*	printf( "%d %d\n", local_x, local_y );              */

  ball->mouse_motion( local_x, local_y, 0, 
		     (glui->curr_modifiers & GLUT_ACTIVE_ALT) != 0, 
		     (glui->curr_modifiers & GLUT_ACTIVE_CTRL) != 0 );
 
  copy_ball_to_float_array();

  if ( can_spin )
    spinning = true;

  return false;
}
Ejemplo n.º 6
0
void        GLUI_Rotation::idle( void )
{
  spinning = ball->is_spinning;

  if ( can_spin == true AND spinning == true ) {
    copy_float_array_to_ball();
    ball->idle();

    *ball->rot_ptr = *ball->rot_ptr * ball->rot_increment;

    mat4 tmp_rot;
    tmp_rot = *ball->rot_ptr;

    copy_ball_to_float_array();

    draw_active_area_only = true;
    translate_and_draw_front();
    draw_active_area_only = false;

    output_live(true); /** output live and update gfx **/
  }
  else { 
  }
}