本文整理汇总了C++中GLWindow::show方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow::show方法的具体用法?C++ GLWindow::show怎么用?C++ GLWindow::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWindow
的用法示例。
在下文中一共展示了GLWindow::show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
// mask: on/off
// opacity: on/off
for (int i=0; i<4; ++i) {
bool mask = i & 0x1;
bool opacity = i & 0x2;
Qt::WindowFlags flags = Qt::FramelessWindowHint;
Widget *widget = new Widget(flags);
GLWindow *window = new GLWindow(flags);
widget->setGeometry(100 + 100 * i, 100, 80, 80);
window->setGeometry(100 + 100 * i, 200, 80, 80);
if (mask) {
QRegion region(0, 0, 80, 80, QRegion::Ellipse);
widget->setMask(region);
window->setMask(region);
}
if (opacity) {
widget->setWindowOpacity(0.5);
window->setOpacity(0.5);
}
widget->show();
window->show();
}
return app.exec();
}
示例2: main
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
GLWindow *window = new GLWindow(QGLFormat());
window->show();
return app.exec();
}
示例3: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GLWindow w;
w.show();
return a.exec();
}
示例4: main
int main( int argc, char ** argv )
{
Q_INIT_RESOURCE(texture);
QGuiApplication a( argc, argv );
GLWindow window;
window.show();
return a.exec();
}
示例5: main
int main(int argc, char** argv) {
auto glversion = gl::getAvailableVersion();
auto major = GL_GET_MAJOR_VERSION(glversion);
auto minor = GL_GET_MINOR_VERSION(glversion);
if (glversion < GL_MAKE_VERSION(4, 1)) {
MessageBoxA(nullptr, "Interface requires OpenGL 4.1 or higher", "Unsupported", MB_OK);
return 0;
}
QGuiApplication app(argc, argv);
bool quitting = false;
// FIXME need to handle window closing message so that we can stop the timer
GLWindow* window = new GLWindow();
window->create();
window->show();
window->setSurfaceType(QSurface::OpenGLSurface);
window->setFormat(getDefaultOpenGLSurfaceFormat());
bool contextCreated = false;
QTimer* timer = new QTimer();
QObject::connect(timer, &QTimer::timeout, [&] {
if (quitting) {
return;
}
if (!contextCreated) {
window->createContext();
contextCreated = true;
}
if (!window->makeCurrent()) {
throw std::runtime_error("Failed");
}
glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
window->swapBuffers();
window->doneCurrent();
});
// FIXME need to handle window closing message so that we can stop the timer
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&] {
quitting = true;
QObject::disconnect(timer, &QTimer::timeout, nullptr, nullptr);
timer->stop();
timer->deleteLater();
});
timer->setInterval(15);
timer->setSingleShot(false);
timer->start();
app.exec();
return 0;
}
示例6: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
// fmt.setVersion(3, 3);
// fmt.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(fmt);
GLWindow w;
w.show();
return a.exec();
}