当前位置: 首页>>代码示例>>C++>>正文


C++ GeomGlut::setWinPixels方法代码示例

本文整理汇总了C++中GeomGlut::setWinPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ GeomGlut::setWinPixels方法的具体用法?C++ GeomGlut::setWinPixels怎么用?C++ GeomGlut::setWinPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeomGlut的用法示例。


在下文中一共展示了GeomGlut::setWinPixels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initGraphicsWin

void GeomGlut::initGraphicsWin( unsigned int pixelWinX, unsigned int pixelWinY, double _xMin, double _xMax, double _yMin, double _yMax ,long double (*func)(long double))
{
  f = func;

  if(_xMax-_xMin<=0)
        return;

  winFuncPixels.x = pixelWinX;
  winFuncPixels.y = pixelWinY;

  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
  glutInitWindowPosition(0, 0);

  glutInitWindowSize(winFuncPixels.x, winFuncPixels.y);

  // at the begining, the function win pixel and the actual win pixel are identical:
  graphWin.setWinPixels( winFuncPixels.x, winFuncPixels.y );

  minWin.x = _xMin;
  minWin.y = _yMin;
  maxWin.x = _xMax;
  maxWin.y = _yMax;

  glutCreateWindow("Algorithmes numériques: labo#4 - Part 1");

  // Initialiser la couleur du fond (blanc)
  glClearColor(0.9f, 0.9f, 0.9f, 1.0f);

  glutReshapeFunc( Reshape );
  glutDisplayFunc( Display );
  glutMainLoop();
}
开发者ID:Diego999,项目名称:Algorithmes-Numeriques,代码行数:32,代码来源:GeomGlut.cpp

示例2: Reshape

void Reshape(int w, int h)
{
  if (h == 0) h = 1;
  if (w == 0) w = 1;
  glViewport(0, 0, w, h);

  graphWin.setWinPixels( w, h );

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();

  float xRatio = static_cast<float>(w)/static_cast<float>(graphWin.xWinFunc());
  float yRatio = static_cast<float>(h)/static_cast<float>(graphWin.yWinFunc());

  // Volume de clipping : (left, right, bottom, top, near, far)
  glOrtho(graphWin.xMin()*xRatio, graphWin.xMax()*xRatio, graphWin.yMin()*yRatio, graphWin.yMax()*yRatio, -2.0f, 2.0f);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}
开发者ID:Diego999,项目名称:Algorithmes-Numeriques,代码行数:20,代码来源:GeomGlut.cpp

示例3: initGraphicsWin

void GeomGlut::initGraphicsWin( unsigned int pixelWinX, double xMin, double xMax, double yMin, double yMax )
{
    if(xMax-xMin<=0)
    {
        cout << "xMax-xMin cannot be < or = to 0" << endl << endl;
        return;
    }

    winFuncPixels.x = pixelWinX;
    winFuncPixels.y = (unsigned int)((yMax-yMin) * (double)winFuncPixels.x/(xMax-xMin));

    int argc = 1;
    char *argv[1] = {(char*)"Glut"};
    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA | GLUT_MULTISAMPLE);
    glutInitWindowPosition(0, 0);

    cout << "System coordinate min(" << xMin << ", " << yMin << ") max(" << xMax << ", " << yMax << " give for " << winFuncPixels.x << " pixels in X, a Y pixel number of " << winFuncPixels.y << endl << endl;

    cout << "pixelWin(" << winFuncPixels.x << ", " << winFuncPixels.y << ")...";
    glutInitWindowSize(winFuncPixels.x, winFuncPixels.y);
    cout << " success!" << endl << endl;

    // at the begining, the function win pixel and the actual win pixel are identical:
    graphWin.setWinPixels( winFuncPixels.x, winFuncPixels.y );

    minWin.x = xMin;
    minWin.y = yMin;
    maxWin.x = xMax;
    maxWin.y = yMax;

    glutCreateWindow("Algorithmes numeriques: labo#6");

    // Initialiser la couleur du fond (blanc)
    glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
    glutMouseFunc( Click );
    glutReshapeFunc( Reshape );
    glutDisplayFunc( Display );
    glutMainLoop();
}
开发者ID:Edstr,项目名称:AlgoNum,代码行数:41,代码来源:GeomGlut.cpp


注:本文中的GeomGlut::setWinPixels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。