Exemple #1
0
static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
    VLC_UNUSED(vd);
    VLC_UNUSED(subpicture);

    picture_sys_t *p_picsys = picture->p_sys;
    vout_display_sys_t *sys = vd->sys;
    void (*display_callback)(picture_sys_t*) = p_picsys->pf_display_callback;
    if (display_callback)
        display_callback(p_picsys);

    if (subpicture)
	sys->b_has_subpictures = true;
    /* As long as no subpicture was received, do not call
       DisplaySubpicture since JNI calls and clearing the subtitles
       surface are expensive operations. */
    if (sys->b_has_subpictures)
    {
	DisplaySubpicture(vd, subpicture);
        if (!subpicture)
        {
            /* The surface has been cleared and there is no new
               subpicture to upload, do not clear again until a new
               subpicture is received. */
            sys->b_has_subpictures = false;
        }
    }

    /* refcount lowers to 0, and pool_cfg.unlock is called */
    picture_Release(picture);
    if (subpicture)
        subpicture_Delete(subpicture);
}
Exemple #2
0
void MyCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
	//printf("OnPaint\n");
	wxPaintDC dc(this);
	SetCurrent(*m_glRC);
	display_callback();
	SwapBuffers();
}
void red_ball_tracker::spin_once(void)
{
  // Display images if needed.
  if (_need_display_img && _image_origin && _image_filtered)
  {
    display_callback();

    cv::waitKey(1);
  }

  // Increase idle counter.
  ++_idle_counter;
}
Exemple #4
0
static void glut_display_callback(void)
{
	display_callback();
	glutSwapBuffers();
}
/**
* Clear the screen, then render the mesh using the given camera.
* @param camera The logical camera to use.
* @see math/camera.hpp
*/
void OpenglProject::render(const Camera* camera)
{
   // TODO render code
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);




   //Quaternion to calcuate the angle and axis for rotation
   Quaternion rotation = scene.mesh_position.orientation;
   Quaternion rotationHeight = scene.heightmap_position.orientation;


   //Container mesh rotation conversion
   Vector3 rot_axis;
   double angle;
   rotation.to_axis_angle(&rot_axis, &angle);
   angle = angle *(180 / PI);


   //Heightmap mesh rotation conversion
   Vector3 rot_axisHeight;
   double angleHeight;
   rotationHeight.to_axis_angle(&rot_axisHeight, &angleHeight);
   angleHeight = angleHeight * (180 / PI);






   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();



   //Camera set up
   gluLookAt(camera->position.x, camera->position.y, camera->position.z,
             camera->position.x + camera->get_direction().x, 
             camera->position.y + camera->get_direction().y, 
             camera->position.z + camera->get_direction().z,
             camera->get_up().x, camera->get_up().y, camera->get_up().z);
		
		



   //Transformation for the heightmap mesh data
   glPushMatrix();

		
   GLfloat waterColor[] = { 0.0, 0.65, 1.0, 1.0 };
   GLfloat mat_specular[] = { 0.0, 0.65, 1.0, 1.0 };
   GLfloat low_shininess[] = { 6.0 };

   glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, waterColor);
   glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
   glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, low_shininess);
		

   glTranslated(
     scene.heightmap_position.position.x, 
     scene.heightmap_position.position.y,
     scene.heightmap_position.position.z);
   glRotated( angleHeight, 
              rot_axisHeight.x, rot_axisHeight.y, rot_axisHeight.z);
   glScaled(scene.heightmap_position.scale.x, 
            scene.heightmap_position.scale.y,
            scene.heightmap_position.scale.z);

   glEnableClientState(GL_VERTEX_ARRAY);
   glEnableClientState(GL_NORMAL_ARRAY);
   glColor3f(0.0, 1.0, 1.0);
   glVertexPointer(3, GL_DOUBLE, 0, masterHeightMap);
   glNormalPointer(GL_DOUBLE, 0, masterHeightNorm);
   glDrawElements(GL_TRIANGLES, 6 * (NUMVERTS - 1)*(NUMVERTS - 1), 
                  GL_UNSIGNED_INT, masterHIndex);
		
   glPopMatrix();

   //Transformation for the triangle mesh data
   glTranslated(scene.mesh_position.position.x, 
                scene.mesh_position.position.y, 
                scene.mesh_position.position.z);
   glRotated(angle, rot_axis.x, rot_axis.y, rot_axis.z);
   glScaled(scene.mesh_position.scale.x, 
            scene.mesh_position.scale.y, 
            scene.mesh_position.scale.z);
   display_callback();



   glFlush();

}