示例#1
0
int main(int argc, char ** argv)
{
	ShowWindow(GetConsoleWindow(), SW_HIDE);

	QApplication app(argc, argv);

	QSurfaceFormat format;
	format.setDepthBufferSize(4);
	format.setSamples(24);
	format.setVersion(4, 4);
	format.setRenderableType(QSurfaceFormat::OpenGL);

	OpenGLWidget window;
	window.setFormat(format);
	window.resize(WINDOW_WIDTH, WINDOW_HEIGHT);

	selector = new ShaderFinder();

	pane = new CollapsiblePanelWidget(&window);
	pane->setStyleSheet("background-color:white");
	pane->setWidgetResizable(true);
	pane->setGeometry(0, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT);
	pane->duration = 500;
	pane->config(QRect(0, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT), QRect(-WINDOW_WIDTH / 5, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT));

	paneBox = new QGroupBox();
	pane->setWidget(paneBox);

	paneLayout = new QVBoxLayout();
	paneLayout->setSpacing(10);
	paneLayout->setAlignment(Qt::AlignTop);
	paneLayout->addWidget(selector);

	pane->widget()->setLayout(paneLayout);
	pane->show();

	anim = new CollapsiblePanelWidget(&window);
	anim->setStyleSheet("background-color:white");
	anim->setWidgetResizable(true);
	anim->setGeometry(WINDOW_WIDTH * 0.8, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT);
	anim->duration = 500;
	anim->config(QRect(WINDOW_WIDTH * 0.8, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT), QRect(WINDOW_WIDTH, 0, WINDOW_WIDTH / 5, WINDOW_HEIGHT));

	animBox = new QGroupBox();
	anim->setWidget(animBox);

	animLayout = new QVBoxLayout();
	animLayout->setSpacing(10);
	animLayout->setAlignment(Qt::AlignTop);

	anim->widget()->setLayout(animLayout);
	anim->show();

	window.show();

	return app.exec();
}
示例#2
0
int main(int argc, char **argv) {
    QApplication app(argc, argv);
    
    // In this tutorial, we use OpenGL 4.1 core for MacOSX support.
    QSurfaceFormat format = QSurfaceFormat::defaultFormat();
    format.setVersion(4, 1);
    format.setProfile(QSurfaceFormat::CoreProfile);
    format.setOption(QSurfaceFormat::DeprecatedFunctions, false);
    QSurfaceFormat::setDefaultFormat(format);

    OpenGLWidget widget;
    widget.resize(800, 600);
    widget.setWindowTitle("First animation");
    widget.show();

    return app.exec();
}