コード例 #1
0
ファイル: glformat.cpp プロジェクト: hpicgs/cgsee
const QGLFormat GLFormat::asQGLFormat() const
{
    QGLFormat format;

    format.setVersion(m_majorVersion, m_minorVersion);
    
    switch(m_profile)
    {
    default:
    case NoProfile:
        format.setProfile(QGLFormat::NoProfile); 
        break;
    case CoreProfile:
        format.setProfile(QGLFormat::CoreProfile); 
        break;
    case CompatibilityProfile:
        format.setProfile(QGLFormat::CompatibilityProfile); 
        break;
    };

    format.setRedBufferSize    (m_redBufferSize);
    format.setGreenBufferSize  (m_greenBufferSize);
    format.setBlueBufferSize   (m_blueBufferSize);
    format.setAlphaBufferSize  (m_alphaBufferSize);

    format.setDepthBufferSize  (m_depthBufferSize);
    format.setStencilBufferSize(m_stencilBufferSize);
    format.setDoubleBuffer     (m_doubleBuffer);
    format.setStereo           (m_stereo);
    format.setSampleBuffers    (m_sampleBuffers);
    format.setSamples          (m_samples);
    format.setSwapInterval     (m_swapInterval);

    return format;
}
コード例 #2
0
ファイル: bootmanager.cpp プロジェクト: kemenaran/citra
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
    QWidget(parent), keyboard_id(0), emu_thread(emu_thread) {

    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
    setWindowTitle(QString::fromStdString(window_title));

    keyboard_id = KeyMap::NewDeviceId();
    ReloadSetKeymaps();

    // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose
    QGLFormat fmt;
    fmt.setVersion(3,3);
    fmt.setProfile(QGLFormat::CoreProfile);
    // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
    fmt.setOption(QGL::NoDeprecatedFunctions);

    child = new GGLWidgetInternal(fmt, this);
    QBoxLayout* layout = new QHBoxLayout(this);

    resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);
    layout->addWidget(child);
    layout->setMargin(0);
    setLayout(layout);

    OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);

    OnFramebufferSizeChanged();
    NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height()));

    BackupGeometry();

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()));
#endif
}
コード例 #3
0
//! [0]
FLGLWindow::FLGLWindow(QWidget * parent) : QWidget(parent), mdi_(parent)
{
    QGLFormat glFormat;
    glFormat.setVersion( 4, 1 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
    glFormat.setSampleBuffers( true );
    glWidget = new FLGLWidget(glFormat);

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
    connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
    connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
    connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
////! [0]
//
////! [1]
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(glWidget);
    mainLayout->addWidget(xSlider);
    mainLayout->addWidget(ySlider);
    mainLayout->addWidget(zSlider);
    setLayout(mainLayout);

    xSlider->setValue(0);
    ySlider->setValue(0);
    zSlider->setValue(0);
    setWindowTitle(tr("Hello GL"));
}
コード例 #4
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){
    ui->setupUi(this);

    QGLFormat format;
    format.setVersion(4,1);
    format.setProfile(QGLFormat::CoreProfile);

    //do this so everything isnt so bunched up
    this->setMinimumHeight(600);

    //add our openGL context to our scene
    m_openGLWidget = new OpenGLWidget(format,this);
    m_openGLWidget->hide();
    ui->gridLayout->addWidget(m_openGLWidget,0,0,7,1);

    //Group box for our general UI buttons
    QGroupBox *docGrb = new QGroupBox("General:",this);
    ui->gridLayout->addWidget(docGrb,8,0,1,1);
    QGridLayout *docLayout = new QGridLayout(docGrb);
    docGrb->setLayout(docLayout);

    //button to add fluid simulations
    QPushButton *addFluidSimBtn = new QPushButton("Add Fluid Simulation",docGrb);
    connect(addFluidSimBtn,SIGNAL(clicked()),this,SLOT(addFluidSim()));
    docLayout->addWidget(addFluidSimBtn,0,0,1,1);

    //open Documation button
    QPushButton *openDocBtn = new QPushButton("Open Documentation",docGrb);
    connect(openDocBtn,SIGNAL(pressed()),this,SLOT(openDoc()));
    docLayout->addWidget(openDocBtn,1,0,1,1);

}
コード例 #5
0
ファイル: qgl_qpa.cpp プロジェクト: ghjinlei/qt5
QT_BEGIN_NAMESPACE

/*!
    Returns an OpenGL format for the window format specified by \a format.
*/
QGLFormat QGLFormat::fromSurfaceFormat(const QSurfaceFormat &format)
{
    QGLFormat retFormat;
    if (format.alphaBufferSize() >= 0)
        retFormat.setAlphaBufferSize(format.alphaBufferSize());
    if (format.blueBufferSize() >= 0)
        retFormat.setBlueBufferSize(format.blueBufferSize());
    if (format.greenBufferSize() >= 0)
        retFormat.setGreenBufferSize(format.greenBufferSize());
    if (format.redBufferSize() >= 0)
        retFormat.setRedBufferSize(format.redBufferSize());
    if (format.depthBufferSize() >= 0)
        retFormat.setDepthBufferSize(format.depthBufferSize());
    if (format.samples() > 1) {
        retFormat.setSampleBuffers(true);
        retFormat.setSamples(format.samples());
    }
    if (format.stencilBufferSize() > 0) {
        retFormat.setStencil(true);
        retFormat.setStencilBufferSize(format.stencilBufferSize());
    }
    retFormat.setDoubleBuffer(format.swapBehavior() != QSurfaceFormat::SingleBuffer);
    retFormat.setStereo(format.stereo());
    retFormat.setVersion(format.majorVersion(), format.minorVersion());
    retFormat.setProfile(static_cast<QGLFormat::OpenGLContextProfile>(format.profile()));
    return retFormat;
}
コード例 #6
0
MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  m_ui(new Ui::MainWindow)
{
  m_ui->setupUi(this);

  QGLFormat format;
  // set the number of samples for multisampling
  // will need to enable glEnable(GL_MULTISAMPLE); once we have a context
  format.setSamples(4);
  #if defined( DARWIN)
    // at present mac osx Mountain Lion only supports GL3.2
    // the new mavericks will have GL 4.x so can change
    format.setVersion(3,2);
  #else
    // with luck we have the latest GL version so set to this
    format.setVersion(4,5);
  #endif
  // now we are going to set to CoreProfile OpenGL so we can't use and old Immediate mode GL
  format.setProfile(QGLFormat::CoreProfile);
  // now set the depth buffer to 24 bits
  format.setDepthBufferSize(24);

  m_gl=new GLWindow(format, this);
  m_ui->s_mainWindowGridLayout->addWidget(m_gl,0,0,2,1);

  connect(m_ui->m_wireframe,SIGNAL(toggled(bool)),m_gl,SLOT(toggleWireframe(bool)));

}
コード例 #7
0
ファイル: application.cpp プロジェクト: aveminus/freq
Application::
Application(int& argc, char **argv, bool prevent_log_system_and_execute_args )
    :   QApplication(argc, argv),
        default_record_device(-1)
{
    QGLFormat glformat = QGLFormat::defaultFormat ();
#ifndef LEGACY_OPENGL
    EXCEPTION_ASSERTX(false, "Sonic AWE uses QPainters which doesn't support OpenGL 4. See legacy-opengl.prf");
    glformat.setProfile( QGLFormat::CoreProfile );
    glformat.setVersion( 3, 2 );
#endif
    bool vsync = false;
    glformat.setSwapInterval(vsync ? 1 : 0);
    QGLFormat::setDefaultFormat (glformat);
    shared_glwidget_ = new QGLWidget(glformat);
    shared_glwidget_->makeCurrent();

#ifndef LEGACY_OPENGL
    GlException_SAFE_CALL( glGenVertexArrays(1, &VertexArrayID) );
    GlException_SAFE_CALL( glBindVertexArray(VertexArrayID) );
#endif

    setOrganizationName("MuchDifferent");
    setOrganizationDomain("muchdifferent.com");

#if defined(TARGET_reader)
    setApplicationName("Sonic AWE Reader");
#elif defined(TARGET_hast)
    setApplicationName("Sonic AWE LOFAR");
#else
    setApplicationName("Sonic AWE");
#endif

    if (!prevent_log_system_and_execute_args)
        logSystemInfo(argc, argv);

    Sawe::Configuration::resetDefaultSettings();
    Sawe::Configuration::parseCommandLineOptions(argc, argv);

    if (!Sawe::Configuration::use_saved_state())
    {
        QSettings().remove("reset on next startup");

        QVariant value = QSettings().value("value");
        setApplicationName(applicationName() + " temp");
        QSettings().clear();
        QSettings().setValue("value", value);
    }
    if (QSettings().value("reset on next startup", false).toBool())
    {
        QVariant value = QSettings().value("value");
        QSettings().clear();
        QSettings().setValue("value", value);
    }

    if (!prevent_log_system_and_execute_args)
    {
        execute_command_line_options(); // will call 'exit(0)' on invalid arguments
    }
}
コード例 #8
0
ファイル: glwidget.cpp プロジェクト: danilob/BasicShaders
GLWidget::GLWidget(QWidget *parent) :
    QGLWidget(QGLFormat(QGL::SampleBuffers),parent),
          m_camera( new Camera( this ) )
{
    setFocusPolicy(Qt::StrongFocus);
    glEnable(GL_MULTISAMPLE);
    glEnable(GL_STENCIL_FUNC);
    simTimer = new QTimer(this);
    connect(simTimer, SIGNAL(timeout()), this, SLOT(updateGL()));
    simTimer->start(0);

    // Initialize the camera position and orientation
    m_camera->setPosition( QVector3D( 5.0f, 5.0f, 5.0f ) );
    m_camera->setViewCenter( QVector3D( 0.0f, 0.0f, 0.0f ) );
    m_camera->setUpVector( QVector3D( 0.0f, 1.0f, 0.0f ) );

    QGLFormat glFormat;
    glFormat.setVersion( 3, 3 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
    glFormat.setSampleBuffers( true );
    glFormat.setSamples(16);

    this->setFormat(glFormat);

    scene = new Scene(this);
    scene->setCamera(m_camera);
    withshadow = true;
}
コード例 #9
0
ファイル: bootmanager.cpp プロジェクト: KitoHo/citra
void GRenderWindow::InitRenderTarget() {
    if (child) {
        delete child;
    }

    if (layout()) {
        delete layout();
    }

    // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
    // WA_DontShowOnScreen, WA_DeleteOnClose
    QGLFormat fmt;
    fmt.setVersion(3, 3);
    fmt.setProfile(QGLFormat::CoreProfile);
    fmt.setSwapInterval(Settings::values.use_vsync);

    // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
    fmt.setOption(QGL::NoDeprecatedFunctions);

    child = new GGLWidgetInternal(fmt, this);
    QBoxLayout* layout = new QHBoxLayout(this);

    resize(Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight);
    layout->addWidget(child);
    layout->setMargin(0);
    setLayout(layout);

    OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);

    OnFramebufferSizeChanged();
    NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height()));

    BackupGeometry();
}
コード例 #10
0
ファイル: GLContainer.cpp プロジェクト: azer89/SvgTool
GLContainer::GLContainer(QWidget *parent) :
    QAbstractScrollArea (parent),
    _ctrlPressed(false),
    _mousePressed(false),
    _sWidth(20),
    _sHeight(20),
    _prevNum(-1),
    _scrollMoved(false)
{
    QGLFormat format;
    format.setVersion(4, 0);
    format.setProfile(QGLFormat::CompatibilityProfile);
    format.setSampleBuffers(true);

    _glWidget = new GLWidget(format);
    _glWidget->setObjectName(QStringLiteral("myGLImageDisplay"));

    setViewport(_glWidget);

    horizontalScrollBar()->setSingleStep(10);
    horizontalScrollBar()->setPageStep(100);

    verticalScrollBar()->setSingleStep(10);
    verticalScrollBar()->setPageStep(100);

    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),this, SLOT(HScrollChanged(int)));
    connect(verticalScrollBar(),   SIGNAL(valueChanged(int)),this, SLOT(VScrollChanged(int)));

    setMouseTracking(true);

    _doubleClickTimer = new QTimer(this); connect(_doubleClickTimer, SIGNAL(timeout()), this, SLOT(DummyFunction()));
    _doubleClickTimeout = 100;

    this->_justInitialized = true;
}
コード例 #11
0
ファイル: main.cpp プロジェクト: Nishantgoyal/OpenGL-QT
QGLFormat setContext() {
    QGLFormat glFormat;
    glFormat.setVersion(3, 3);
    glFormat.setProfile(QGLFormat::CoreProfile);
    glFormat.setSampleBuffers(true);
    return glFormat;

}
コード例 #12
0
ファイル: view2d.cpp プロジェクト: jewalky/TestShit
static const QGLFormat& GetView2DFormat()
{
    static QGLFormat fmt;
    fmt = QGLFormat();
    fmt.setVersion(2, 0);
    fmt.setProfile(QGLFormat::CompatibilityProfile);
    //fmt.setSampleBuffers(true);
    return fmt;
}
QGLFormat       getFormat()
{
    QGLFormat   glFormat;

    glFormat.setVersion( 3, 2 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >= Qt-4.8.0
    glFormat.setSampleBuffers( true );

    return (glFormat);
}
コード例 #14
0
	SceneDisplayerWidget::SceneDisplayerWidget(QWidget *parent, const std::string &mapEditorPath) :
			QGLWidget(parent),
			mapEditorPath(mapEditorPath),
			sceneDisplayer(nullptr)
	{
		QGLFormat glFormat;
		glFormat.setVersion(3,3);
		glFormat.setProfile(QGLFormat::CompatibilityProfile);
		glFormat.setSampleBuffers(true);
		glFormat.setDoubleBuffer(true);
		setFormat(glFormat);
	}
コード例 #15
0
ファイル: oglviewport.cpp プロジェクト: Cpasjuste/libarcade
OGLViewport::OGLViewport(QWidget *parent) :
    QGLWidget(parent)
{
    QGLFormat format;
    format.setVersion(3, 3);
    format.setProfile(QGLFormat::CoreProfile);
    setFormat(format);

    OGLSetContext(this);
    OGLSetSwapBuffers(::swapBuffers);
    OGLSetMakeCurrent(::makeCurrent);
    OGLSetDoneCurrent(::doneCurrent);
}
コード例 #16
0
ファイル: mainwindow.cpp プロジェクト: schardong/Visualizer
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent)
    {
        loadVolAction = new QAction("Load Volume Data", this);
        connect(loadVolAction, SIGNAL(triggered()), this, SLOT(loadVolume()));

        loadTFAction = new QAction("Load Transfer Function", this);
        connect(loadTFAction, SIGNAL(triggered()), this, SLOT(loadTransferFunction()));

        quitAction = new QAction("Quit", this);
        connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));

        mipAction = new QAction("Maximum Intensity Projection", this);
        connect(mipAction, SIGNAL(triggered()), this, SLOT(modeMIP()));

        avgAction = new QAction("Average Intensity Projection", this);
        connect(avgAction, SIGNAL(triggered()), this, SLOT(modeAVG()));

        comAction = new QAction("Composition Projection", this);
        connect(comAction, SIGNAL(triggered()), this, SLOT(modeCOM()));

        contourTreeAction = new QAction("Build Contour Tree", this);
        connect(contourTreeAction, SIGNAL(triggered()), this, SLOT(buildContourTree()));

        fileMenu = new QMenu("File", this);
        fileMenu->addAction(loadVolAction);
        fileMenu->addAction(loadTFAction);
        fileMenu->addSeparator();
        fileMenu->addAction(quitAction);

        viewMenu = new QMenu("View", this);
        viewMenu->addAction(mipAction);
        viewMenu->addAction(avgAction);
        viewMenu->addAction(comAction);

        toolMenu = new QMenu("Tools", this);
        toolMenu->addAction(contourTreeAction);

        menuBar()->addMenu(fileMenu);
        menuBar()->addMenu(viewMenu);
        menuBar()->addMenu(toolMenu);

        resize(600, 600);

        QGLFormat f;
        f.setVersion(4, 2);
        f.setProfile(QGLFormat::CoreProfile);

        view = new Ui::Viewport(f, this);
        setCentralWidget(view);
    }
コード例 #17
0
ファイル: main.cpp プロジェクト: Yenapas/m1_ig3d
int main(int argc, char **argv)
{
    QApplication application(argc, argv);

    QGLFormat glFormat;
    glFormat.setVersion(3, 3);
    glFormat.setProfile(QGLFormat::CoreProfile);
    glFormat.setSampleBuffers(true);

    RenderingWidget widget(glFormat);
    widget.show();

    return application.exec();
}
コード例 #18
0
ファイル: main.cpp プロジェクト: ataiya/homebrew
int main(int argc, char *argv[]){
    QApplication app(argc, argv);
    
    ///--- Setup for OpenGL4
    QGLFormat glFormat;
    glFormat.setVersion( 3, 2 );
    glFormat.setProfile( QGLFormat::CoreProfile );
    glFormat.setSampleBuffers( false );
    
    GLWidget widget(glFormat);
    widget.resize(640,480);
    widget.show();
    return app.exec();
}
コード例 #19
0
ファイル: GLShaderDev.cpp プロジェクト: Ryp/GLShaderDev
void GLShaderDev::initializeContext()
{
    QGLFormat glFormat;

    glFormat.setVersion(4, 2);
    glFormat.setProfile(QGLFormat::CompatibilityProfile);
    glFormat.setSampleBuffers(true); // NOTE this option activates MSAA
    glFormat.setDoubleBuffer(true);

    _glpreview = new GLPreviewWidget(glFormat);
    _glwidget = _glpreview->getGLWidget();

    connect(_glwidget, SIGNAL(glInitialized()), this, SLOT(initGLInfo()));
}
コード例 #20
0
ファイル: GLCanvas.cpp プロジェクト: rabedik/hifi
static QGLFormat& getDesiredGLFormat() {
    // Specify an OpenGL 3.3 format using the Core profile.
    // That is, no old-school fixed pipeline functionality
    static QGLFormat glFormat;
    static std::once_flag once;
    std::call_once(once, [] {
        glFormat.setVersion(4, 1);
        glFormat.setProfile(QGLFormat::CoreProfile); // Requires >=Qt-4.8.0
        glFormat.setSampleBuffers(false);
        glFormat.setDepth(false);
        glFormat.setStencil(false);
    });
    return glFormat;
}
コード例 #21
0
ファイル: mainwindow.cpp プロジェクト: fernandodsl/CSGMod
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow)
{
	ui->setupUi(this);

	// Opengl Setup with version 3.3 and Core Profile
	QGLFormat format;
	format.setVersion(3, 3);
	format.setProfile(QGLFormat::CoreProfile);
	m_canvas = new GLCanvas( format );

	ui->horizontalLayout->addWidget(m_canvas);
}
コード例 #22
0
ファイル: main.cpp プロジェクト: AlbertSuarez/IDI-Labs
int main (int argc, char **argv) {
  QApplication a( argc, argv);

  QGLFormat format;
  format.setDepthBufferSize(24);
  format.setVersion(3, 3);
  format.setProfile(QGLFormat::CoreProfile);
  QGLFormat::setDefaultFormat(format);
  MyGLWidget mygl(format);
  mygl.resize (800, 800);
  mygl.show ();

  return a.exec ();
}
コード例 #23
0
ファイル: mainwindow.cpp プロジェクト: phaser/quintessence
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QGLFormat format;
    format.setVersion(3, 1);
    format.setProfile(QGLFormat::CoreProfile);
    format.setSampleBuffers(true);

    glWidget = new OpenGLWidget(format);
    glWidget->setMinimumSize(960, 640);
    glWidget->setMaximumSize(960, 640);
    this->ui->scrollArea->setWidget(glWidget);
}
コード例 #24
0
ファイル: main.cpp プロジェクト: weiucsd/oculus
int main( int argc, char* argv[] )
{
    QApplication a( argc, argv );

    QGLFormat glFormat;
    glFormat.setVersion( 3, 3 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
    glFormat.setSampleBuffers( true );

    // Create a GLWidget requesting our format
    GLWidget w( glFormat );
    w.show();

    return a.exec();
}
コード例 #25
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QGLFormat format;
    format.setVersion(3, 3);
    format.setProfile(QGLFormat::CompatibilityProfile);
    format.setSampleBuffers(true);

    PerspectiveWidget* pw = new PerspectiveWidget(format, ui->centralWidget);
    ui->centralWidget->layout()->addWidget(pw);
    ui->centralWidget->layout()->update();
}
コード例 #26
0
void GeneratorWindow::createView()
{
    QGLFormat format;
    format.setVersion(3, 3);
    format.setProfile(QGLFormat::CoreProfile);

    m_gameWidget = new GameWidget(120);
    m_gameWidget->setFormat(format);

    m_runButton = new QPushButton("Run");
    m_stepButton = new QPushButton("Tick");
    m_InstantButton = new QPushButton("Instant");
    m_resetButton = new QPushButton("Reset");
    m_tickSpeed = new QSpinBox();
    m_tickSpeed->setMinimum(1);
    m_tickSpeed->setMaximum(1000);
    m_tickSpeed->setValue(1000);
    m_tickInfoLabel = new QLabel("");

    connect(m_runButton, &QPushButton::clicked, [this]() {
        if (!m_animationTimer.isActive()) {
            m_stepButton->setDisabled(true);
            m_runButton->setText("Stop");
            m_animationTimer.start();
        } else {
            m_animationTimer.stop();
            m_runButton->setText("Run");
            m_stepButton->setDisabled(false);
        }
    });
    connect(m_stepButton, &QPushButton::clicked, [this]() {
        m_generator.tick();
    });
    connect(m_InstantButton, &QPushButton::clicked, [this]() {
        m_generator.runAll();
    });
    connect(m_resetButton, &QPushButton::clicked, [this]() {
        m_generator.reset();

        m_animationTimer.stop();
        m_runButton->setText("Run");
        m_stepButton->setDisabled(false);
    });

    connect(m_tickSpeed, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this](int newValue) {
        m_animationTimer.setInterval(1000 / newValue);
    });
}
コード例 #27
0
ファイル: main.cpp プロジェクト: andyTsing/piccante
int main(int argc, char **argv)
{
    QApplication app( argc, argv );

    QGLFormat glFormat;
    glFormat.setVersion( 4, 0 );
    glFormat.setProfile( QGLFormat::CoreProfile );
    glFormat.setSampleBuffers( true );

    //Creating a window with OpenGL 4.0 Core profile
    Window w( glFormat );
    w.show();

    app.installEventFilter(&w);

    return app.exec();
}
コード例 #28
0
int main( int argc, char* argv[] )
{
    QApplication a( argc, argv );

    // Specify an OpenGL 3.2 format using the Core profile.
    // That is, no old-school fixed pipeline functionality
    QGLFormat glFormat;
    glFormat.setVersion( 3, 2 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
    glFormat.setSampleBuffers( true );

    // Create a GLWidget requesting our format
    GLWidget w( glFormat );
    w.show();

    return a.exec();
}
コード例 #29
0
ファイル: Window.cpp プロジェクト: ruiqimao/CS123Final
Window::Window(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Window)
{
    QGLFormat qglFormat;
    qglFormat.setVersion(3, 2);
    qglFormat.setProfile(QGLFormat::CoreProfile);
    qglFormat.setSampleBuffers(true);
    QGLFormat::setDefaultFormat(qglFormat);
    ui->setupUi(this);

    // Set the default values.
    setRadius(DEF_RADIUS);
    setRestitution(DEF_RESTITUTION);
    setMass(DEF_MASS);
    setNumSpheres(0);
}
コード例 #30
0
ファイル: bootmanager.cpp プロジェクト: Aurorer/citra
GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this)
{
    // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose
    QGLFormat fmt;
    fmt.setProfile(QGLFormat::CoreProfile);
    fmt.setVersion(3,2);
    fmt.setSampleBuffers(true);
    fmt.setSamples(4);
    
    child = new GGLWidgetInternal(fmt, this);
    QBoxLayout* layout = new QHBoxLayout(this);
    resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);
    layout->addWidget(child);
    layout->setMargin(0);
    setLayout(layout);

    BackupGeometry();
}