示例#1
0
/* \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);
}
示例#2
0
文件: main.cpp 项目: dsbabkov/sphere
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    GLWidget w;
    w.resize(400,400);
    w.show();

    return a.exec();
}
示例#3
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    GLWidget mainwin;
    mainwin.resize(500,500);
    mainwin.show();

    return app.exec();
}
示例#4
0
int main(int argc, char *argv[]) {
    
    QApplication app(argc, argv);
    
    GLWidget window;
    window.resize(800,600);
    window.show();
    
    return app.exec();
}
示例#5
0
int main( int argc, char ** argv )
{
    QApplication a( argc, argv );

    QSurfaceFormat format;
    format.setDepthBufferSize(16);
    QSurfaceFormat::setDefaultFormat(format);

    // Two top-level windows with two QOpenGLWidget children in each.
    // The rendering for the four QOpenGLWidgets happens on four separate threads.

    GLWidget topLevelGlWidget;
    QPoint pos = QApplication::desktop()->availableGeometry(&topLevelGlWidget).topLeft() + QPoint(200, 200);
    topLevelGlWidget.setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example top level"));
    topLevelGlWidget.resize(200, 200);
    topLevelGlWidget.move(pos);
    topLevelGlWidget.show();

    const QString glInfo = getGlString(topLevelGlWidget.context()->functions(), GL_VENDOR)
        + QLatin1Char('/') + getGlString(topLevelGlWidget.context()->functions(), GL_RENDERER);

    const bool supportsThreading = !glInfo.contains(QLatin1String("nouveau"), Qt::CaseInsensitive)
        && !glInfo.contains(QLatin1String("ANGLE"), Qt::CaseInsensitive)
        && !glInfo.contains(QLatin1String("llvmpipe"), Qt::CaseInsensitive);

    const QString toolTip = supportsThreading ? glInfo : glInfo + QStringLiteral("\ndoes not support threaded OpenGL.");
    topLevelGlWidget.setToolTip(toolTip);

    QScopedPointer<MainWindow> mw1;
    QScopedPointer<MainWindow> mw2;
    if (!QApplication::arguments().contains(QStringLiteral("--single"))) {
        if (supportsThreading) {
            pos += QPoint(100, 100);
            mw1.reset(new MainWindow);
            mw1->setToolTip(toolTip);
            mw1->move(pos);
            mw1->setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example #1"));
            mw1->show();
            pos += QPoint(100, 100);
            mw2.reset(new MainWindow);
            mw2->setToolTip(toolTip);
            mw2->move(pos);
            mw2->setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example #2"));
            mw2->show();
        } else {
            qWarning() << toolTip;
        }
    }

    return a.exec();
}
示例#6
0
/** void QWidget::resize(int w, int h)
 * bind/QWidget.h:11
 */
static int GLWidget_resize(lua_State *L) {
  try {
    GLWidget *self = *((GLWidget **)dub_checksdata(L, 1, "mimas.GLWidget"));
    int w = dub_checkint(L, 2);
    int h = dub_checkint(L, 3);
    self->resize(w, h);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "resize: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "resize: Unknown exception");
  }
  return dub_error(L);
}
示例#7
0
int main(int argc, char** argv) {
    QApplication a(argc, argv);

    QSurfaceFormat format;
    format.setVersion(3,3);
    format.setProfile(QSurfaceFormat::CoreProfile);
    QSurfaceFormat::setDefaultFormat(format);

    GLWidget glWidget;
    qreal pixelRatio = glWidget.devicePixelRatio();
    cout << "pixel ratio: " << pixelRatio << std::endl;
    glWidget.resize(640/pixelRatio,480/pixelRatio);
    glWidget.show();

    return a.exec();
}
示例#8
0
int main(int argc, char** argv) {

	// Do projective reconstruction
	bool is_projective = true;

	// Assume noise free
	bool has_outliers = false;

	// Read 2D points from text file

	Mat_<double> x1, x2;
	int npts;

	if (argc < 2) {
		help();
		exit(0);
	} else {
		ifstream myfile(argv[1]);
		if (!myfile.is_open()) {
			cout << "Unable to read file: " << argv[1] << endl;
			exit(0);

		} else {
			string line;

			// Read number of points
			getline(myfile, line);
			npts = (int) atof(line.c_str());
			x1 = Mat_<double>(2, npts);
			x2 = Mat_<double>(2, npts);

			// Read the point coordinates
			for (int i = 0; i < npts; ++i) {
				getline(myfile, line);
				stringstream s(line);
				string cord;

				s >> cord;
				x1(0, i) = atof(cord.c_str());
				s >> cord;
				x1(1, i) = atof(cord.c_str());

				s >> cord;
				x2(0, i) = atof(cord.c_str());
				s >> cord;
				x2(1, i) = atof(cord.c_str());

			}

			myfile.close();

		}
	}

	// Call the reconstruction function

	vector < Mat_<double> > points2d;
	points2d.push_back(x1);
	points2d.push_back(x2);
	Mat_<double> points3d_estimated;
	vector < Mat > Ps_estimated;

	reconstruct(points2d, Ps_estimated, points3d_estimated, is_projective,
			has_outliers);

	// Print output

	cout << endl;
	cout << "Projection Matrix of View 1: " << endl;
	cout << "============================ " << endl;
	cout << Ps_estimated[0] << endl << endl;
	cout << "Projection Matrix of View 1: " << endl;
	cout << "============================ " << endl;
	cout << Ps_estimated[1] << endl << endl;
	cout << "Reconstructed 3D points: " << endl;
	cout << "======================== " << endl;
	cout << points3d_estimated << endl;

	// Display 3D points using Qt widget

	// Create the structure
	vector<Vec3f> struct_coords;
	for (int i = 0; i < npts; ++i) {
		Vec3f point3d((float) points3d_estimated(0, i),
				(float) points3d_estimated(1, i),
				(float) points3d_estimated(2, i));
		struct_coords.push_back(point3d);
	}

	// Qt stuff
	QApplication app(argc, argv);
	GLWidget window;
	window.AddNewStructure(struct_coords);
	window.resize(800, 600);
	window.show();
	return app.exec();

}