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


C++ GLWidget类代码示例

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


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

示例1: QMainWindow

/* \x41\x41\x41\x41\x41\x41\x41 */
TempleWin::TempleWin(QWidget *parent)
    : QMainWindow(parent) {

    lang = new TempleLang();
    std::cout << "==========" << std::endl;
    //menu
    QAction *quit = new QAction("&Quit", this);

    QMenu *file;
    file = menuBar()->addMenu("&File");
    file->addAction(quit);

    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));

    //toolbar
    QToolBar *tb = new QToolBar("TOOLBAR");

    TBar *tbw = new TBar(this, lang);
    tb->addWidget(tbw);
    tb->setMovable(false);
    addToolBar(Qt::RightToolBarArea, tb);

    GLWidget *widGl = new GLWidget(this, lang);
    widGl->show();
    widGl->resize(200,200);
    setCentralWidget(widGl);
}
开发者ID:douggard,项目名称:Temple,代码行数:28,代码来源:temple.cpp

示例2: function

void TVertex::function(Action action, QMouseEvent *event)
{
    using namespace Model;
    if(action == DRAW) return;

    GLWidget *widget = Workspace::activeWidget();
    widget->countFinalInverseMatrix();
    if(action == START || action == FINAL)
    {
        Journal::newRecord(CREATE);

        QVector3D newVertex;
        if(action == START)
        {
            _busy = true;
            widget->fromScreenToWorld(&newVertex, event);
        }
        else for(int i = 0; i < 3; i++) newVertex[i] = spinBox[i]->value();
        ver.clear();
        ver.push_back(vertex().push(newVertex));
        vertex()[ver[0]].setNewSelected(true);
        if(action == FINAL) action = STOP;
    }
    if(action == EXECUTE) widget->fromScreenToWorld(&vertex()[ver[0]].position(), event);
    if(action == STOP)
    {
        _busy = false;
        vertex()[ver[0]].setSelected(true, false);
        Journal::submit();
    }
}
开发者ID:ustinski,项目名称:3dModeler,代码行数:31,代码来源:tvertex.cpp

示例3: main

int main( int argc, char **argv ) {
    QApplication a( argc, argv );
    OctreeNode n1;
    GLWidget *w = new GLWidget();
    GLData* g = w->addObject();
    
    GLData* rnd = w->addObject();
    RandomSource src( rnd );
    QObject::connect( w->timer, SIGNAL(timeout()), &src, SLOT(timeOutSlot()) );
    
    std::cout << " genVBO()\n";
    /*
    g->setTriangles(); 
    g->setPosition(1,0,-6);
    g->setUsageStaticDraw();
    g->addVertex(-1.0f,-1.0f, 0.0f,  1.0f,0.0f,0.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) ); 
    g->addVertex( 1.0f,-1.0f, 0.0f,  0.0f,1.0f,0.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
    g->addVertex( 0.0f, 1.0f, 0.0f,  0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
    g->addVertex( 1.0f, 1.0f, 0.0f,  1.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
    g->addVertex( -1.0f, 1.0f, 0.0f,  1.0f,1.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
    g->addVertex( -2.0f, 0.0f, 0.0f,  1.0f,1.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
    std::vector<GLuint> poly(3);
    //poly.resize(3);
    poly[0]=0; poly[1]=1; poly[2]=2;
    g->addPolygon( poly );
    poly[0]=2; poly[1]=1; poly[2]=3;
    g->addPolygon( poly );
    poly[0]=0; poly[1]=2; poly[2]=4;
    g->addPolygon( poly );
    poly[0]=0; poly[1]=5; poly[2]=4;
    g->addPolygon( poly );
    g->print();
    //std::cout << "removePolygon()\n";
    //g.removePolygon(0);
    std::cout << "removeVertex(4)\n";
    g->removeVertex(4);
    g->print();
*/
    // now try a quad.
    OctreeNode n2;
    GLData* q = w->addObject();
    q->setQuads();
    q->setPosition(2,0,-6);
    q->setUsageStaticDraw(); 
    q->addVertex(-3.0f,0.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
    q->addVertex(-3.0f,1.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
    q->addVertex(-4.0f,1.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
    q->addVertex(-4.0f,0.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
    std::vector<GLuint> quad(4);
    quad[0]=0; quad[1]=1; quad[2]=2; quad[3]=3;
    q->addPolygon(quad);
    
    q->print();
    std::cout << "Q removeVertex(3)\n";
    //q->removeVertex(0);
    q->print();
    
    w->show();
    return a.exec();
}
开发者ID:DavidNicholls,项目名称:opencamlib,代码行数:60,代码来源:vbo_tst.cpp

示例4: setAtoms

  void VdWSurface::setAtoms(Molecule* mol)
  {
    // check if there is a selection in the current glwidget
    GLWidget *glwidget = GLWidget::current();
    if (glwidget) {
      QList<Primitive*> atoms = glwidget->selectedPrimitives().subList(Primitive::AtomType);
      if (!atoms.isEmpty()) {
        qDebug() << "VdWSurface: Number of atoms" << atoms.size();
        m_atomPos.resize(atoms.size());
        m_atomRadius.resize(atoms.size());

        for (unsigned int i = 0; i < m_atomPos.size(); ++i) {
          Atom *atom = static_cast<Atom*>(atoms.at(i));
          m_atomPos[i] = *atom->pos();
          m_atomRadius[i] = OpenBabel::etab.GetVdwRad(atom->atomicNumber());
        }

        return;
      }
    }

    qDebug() << "VdWSurface: Number of atoms" << mol->numAtoms();
    m_atomPos.resize(mol->numAtoms());
    m_atomRadius.resize(mol->numAtoms());

    for (unsigned int i = 0; i < m_atomPos.size(); ++i) {
      m_atomPos[i] = *mol->atom(i)->pos();
      m_atomRadius[i] = OpenBabel::etab.GetVdwRad(mol->atom(i)->atomicNumber());
    }
  }
开发者ID:AlbertDeFusco,项目名称:avogadro,代码行数:30,代码来源:vdwsurface.cpp

示例5: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowTitle("3D cloud crop");

    GLWidget *glWidget = new GLWidget();
    setCentralWidget(glWidget);


    scaleSelectionWidget = new ScaleSelectionWidget();

    scaleSelectionDockWidget = new QDockWidget("Color map", this);
    scaleSelectionDockWidget->setWidget(scaleSelectionWidget);
    scaleSelectionDockWidget->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea);
    scaleSelectionDockWidget->setVisible(true);

    addDockWidget(Qt::RightDockWidgetArea, scaleSelectionDockWidget, Qt::Horizontal);

    createActions();
    createMenu();

    connect(this, SIGNAL(gotFileNameToLoad(QString)),glWidget->getGLOperationThread(),SLOT(loadMesh(QString)));
    connect(scaleSelectionWidget, SIGNAL(scaleChanged(Scale*)),
            glWidget->getGLOperationThread(),SLOT(setScale(Scale*)));
}
开发者ID:aloschilov,项目名称:Test-Project,代码行数:25,代码来源:mainwindow.cpp

示例6: QWidget

//! [0]
Window::Window()
    : QWidget()
{
    Widget *native = new Widget(&helper, this);
    GLWidget *openGL = new GLWidget(&helper, this);
    QLabel *nativeLabel = new QLabel(tr("Native"));
    nativeLabel->setAlignment(Qt::AlignHCenter);
    QLabel *openGLLabel = new QLabel(tr("OpenGL"));
    openGLLabel->setAlignment(Qt::AlignHCenter);

    qWarning() << (openGL->doubleBuffer() ? "true" : "false");

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(native, 0, 0);
    layout->addWidget(openGL, 0, 1);
    layout->addWidget(nativeLabel, 1, 0);
    layout->addWidget(openGLLabel, 1, 1);
    setLayout(layout);

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), native, SLOT(animate()));
    connect(timer, SIGNAL(timeout()), openGL, SLOT(animate()));
    timer->start(50);

    setWindowTitle(tr("2D Painting on Native and OpenGL Widgets"));
}
开发者ID:bdrewery,项目名称:qt4,代码行数:27,代码来源:window.cpp

示例7: closeEvent

 void closeEvent(QCloseEvent *evt){
     QWidgetList windows = ws->windowList();
     for (int i = 0; i < int(windows.count()); ++i) {
         GLWidget *window = (GLWidget *)windows.at(i);
         window->stopRendering();
     }
     QMainWindow::closeEvent(evt);
 }
开发者ID:aewallin,项目名称:sandbox,代码行数:8,代码来源:appwindow.hpp

示例8: centralWidget

void MainWindow::on_actionSave_view_triggered()
{
    QString filename = QFileDialog::getSaveFileName(this);
    if (filename!=""){
        GLWidget* glw = centralWidget()->findChild<GLWidget*>("widget");
        glw->saveView(filename);
    }
}
开发者ID:NeuroanatomyAndConnectivity,项目名称:vidview,代码行数:8,代码来源:mainwindow.cpp

示例9: main

int main(int argc, char* argv[])
{
    QApplication a(argc, argv);
    GLWidget w;
    w.show();

    return a.exec();
}
开发者ID:tclass,项目名称:rubixCube,代码行数:8,代码来源:main.cpp

示例10: on_frame_show

// MLT consumer-frame-show event handler
void GLWidget::on_frame_show(mlt_consumer, void* self, mlt_frame frame_ptr)
{
    GLWidget* widget = static_cast<GLWidget*>(self);
    if (widget->showFrameSemaphore.tryAcquire()) {
        Frame frame(frame_ptr);
        emit widget->frameReceived(Mlt::QFrame(frame));
    }
}
开发者ID:eddrog,项目名称:shotcut,代码行数:9,代码来源:glwidget.cpp

示例11: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    GLWidget widget;
    widget.show();
    //widget.showFullScreen();

    return a.exec();
}
开发者ID:edlangley,项目名称:brick-qt,代码行数:9,代码来源:main.cpp

示例12: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    GLWidget mainwin;
    mainwin.resize(500,500);
    mainwin.show();

    return app.exec();
}
开发者ID:bjonke00,项目名称:myopenglexample,代码行数:9,代码来源:main.cpp

示例13: main

int main(int argc, char *argv[]) {
    
    QApplication app(argc, argv);
    
    GLWidget window;
    window.resize(800,600);
    window.show();
    
    return app.exec();
}
开发者ID:chazmatazz,项目名称:QtOpenGLDemo,代码行数:10,代码来源:main.cpp

示例14: GLWidget_openGLVersion

/** LuaStackSize GLWidget::openGLVersion(lua_State *L)
 * include/mimas/GLWidget.h:99
 */
static int GLWidget_openGLVersion(lua_State *L) {
  try {
    GLWidget *self = *((GLWidget **)dub_checksdata(L, 1, "mimas.GLWidget"));
    return self->openGLVersion(L);
  } catch (std::exception &e) {
    lua_pushfstring(L, "openGLVersion: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "openGLVersion: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:14,代码来源:mimas_GLWidget.cpp

示例15: QMainWindow

/*---------------------------------------------------------------------------*/
MainWindow::MainWindow( QWidget* pParent ):
    QMainWindow( pParent )
{
    CreateMenu( );

    GLWidget* pGLWidget = new GLWidget( this );
    connect( pGLWidget, SIGNAL( ToggleFullScreen( ) ),
             this, SLOT( ToggleFullScreen( ) ) );
    setCentralWidget( pGLWidget );
    resize( pGLWidget->width( ), pGLWidget->height( ) + menuBar( )->height( ) );
    setWindowTitle( tr( "Color cube example" ) );           // 设置窗口标题
}
开发者ID:wentaojia2014,项目名称:OpenGLDemo,代码行数:13,代码来源:MainWindow.cpp


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