コード例 #1
0
ファイル: GLCanvas.cpp プロジェクト: JochenKempfle/MoCap
void GLCanvas::OnPaint(wxPaintEvent &event)
{
	wxPaintDC dc(this);

	if (!_GLRC)
    {
        return;
    }

	SetCurrent(*_GLRC);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	if (_style & SINGLE_SENSOR_MODE)
    {
        renderSingleSensor();
    }
    else if (_style & SINGLE_JOINT_MODE)
    {
        renderSingleJoint();
    }
    else
    {
        renderSkeleton();
    }
	// _image.render();
	// glFlush();
	SwapBuffers();
	if (_showUI && !(_style & SELECTION_MODE))
    {
        drawUserInterface(dc);
    }
	event.Skip();
}
コード例 #2
0
ファイル: skeleton_stream.cpp プロジェクト: pjsdream/pcml
void SkeletonStream::renderSkeleton()
{
    Eigen::Matrix3Xd skeleton;
    if (!getSkeleton(skeleton))
        return;

    renderSkeleton(skeleton);
}
コード例 #3
0
ファイル: GLCanvas.cpp プロジェクト: JochenKempfle/MoCap
int GLCanvas::getObjectIdAt(const wxPoint& pos)
{
    if (pos.x > GetSize().x - _buttonSize && pos.y < _numButtons * _buttonSize)
    {
        return -1;
    }

    int id = -1;
    if (_GLRC)
    {
        SetCurrent(*_GLRC);
        glDisable(GL_BLEND);
        _style |= SELECTION_MODE;

        glClearColor(1.0, 1.0, 1.0, 1.0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glLoadIdentity();

        renderSkeleton();

        glFlush();
        glClearColor(0.0, 0.0, 0.0, 0.0);
        _style &= ~SELECTION_MODE;
        glEnable(GL_BLEND);

        // read the color at pos and convert it to an id
        GLubyte color[3];
        glReadPixels(pos.x, GetClientSize().y - pos.y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, color);
        id = static_cast<unsigned int>(((color[0]) << 16) + ((color[1]) << 8) + (color[2]));

        // if all color values are set to 0xFF, the background (or no clickable object) was clicked. Set id to -1
        if (id >= 0xFFFFFF)
        {
            id = -1;
        }
    }
    return id;
}
コード例 #4
0
ファイル: model.cpp プロジェクト: bsmr-opengl/cal3d
void Model::onRender()
{
  // set global OpenGL states
  glEnable(GL_DEPTH_TEST);
  glShadeModel(GL_SMOOTH);

//// DEBUG: CLOTH SIM
/*
  static CalVector spherePosition;
  spherePosition.set(Sphere.x, Sphere.y, Sphere.z);
  static float sphereRadius = 15.0f;

//  m_calModel->getSpringSystem()->setSphere(spherePosition.x, spherePosition.y, spherePosition.z, sphereRadius);

  glColor3f(1.0f, 1.0f, 1.0f);
  glBegin(GL_LINE_STRIP);
    glVertex3f(spherePosition.x + sphereRadius, spherePosition.y, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y + sphereRadius, spherePosition.z);
    glVertex3f(spherePosition.x - sphereRadius, spherePosition.y, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y - sphereRadius, spherePosition.z);

    glVertex3f(spherePosition.x + sphereRadius, spherePosition.y, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y, spherePosition.z + sphereRadius);
    glVertex3f(spherePosition.x - sphereRadius, spherePosition.y, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y, spherePosition.z - sphereRadius);

    glVertex3f(spherePosition.x + sphereRadius, spherePosition.y, spherePosition.z);

    glVertex3f(spherePosition.x, spherePosition.y + sphereRadius, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y, spherePosition.z + sphereRadius);
    glVertex3f(spherePosition.x, spherePosition.y - sphereRadius, spherePosition.z);
    glVertex3f(spherePosition.x, spherePosition.y, spherePosition.z - sphereRadius);
    glVertex3f(spherePosition.x, spherePosition.y + sphereRadius, spherePosition.z);
  glEnd();
*/
//// DEBUG END

  //CalSkeleton *pCalSkeleton = m_calModel->getSkeleton();

  // Note :
  // You have to call coreSkeleton.calculateBoundingBoxes(calCoreModel)
  // during the initialisation (before calModel.create(calCoreModel))
  // if you want to use bounding boxes.

  m_calModel->getSkeleton()->calculateBoundingBoxes();

  // Note:
  // Uncomment the next lines if you want to test the experimental collision system.
  // Also remember that you need to call calculateBoundingBoxes()

  //m_calModel->getSpringSystem()->setForceVector(CalVector(0.0f,0.0f,0.0f));
  //m_calModel->getSpringSystem()->setCollisionDetection(true);  

  // check if we need to render the skeleton
  if(theMenu.isSkeleton()==1)
  {
    renderSkeleton();
  }
  else if(theMenu.isSkeleton()==2)
  {
    renderBoundingBox();
  }
  
  // check if we need to render the mesh
  if(theMenu.isSkeleton()==0 || theMenu.isWireframe())
  {
    renderMesh(theMenu.isWireframe(), theMenu.isLight());
  }

  // clear global OpenGL states
  glDisable(GL_DEPTH_TEST);
}
コード例 #5
0
void Geometry::render()
{
	_renderMesh();
	//
	renderSkeleton();
}