本文整理汇总了C++中GLWidget::show方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWidget::show方法的具体用法?C++ GLWidget::show怎么用?C++ GLWidget::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWidget
的用法示例。
在下文中一共展示了GLWidget::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: main
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
GLWidget w;
w.show();
return a.exec();
}
示例4: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GLWidget widget;
widget.show();
//widget.showFullScreen();
return a.exec();
}
示例5: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
GLWidget mainwin;
mainwin.resize(500,500);
mainwin.show();
return app.exec();
}
示例6: main
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
GLWidget window;
window.resize(800,600);
window.show();
return app.exec();
}
示例7: GLWidget_show
/** void QWidget::show()
* bind/QWidget.h:31
*/
static int GLWidget_show(lua_State *L) {
try {
GLWidget *self = *((GLWidget **)dub_checksdata(L, 1, "mimas.GLWidget"));
self->show();
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "show: %s", e.what());
} catch (...) {
lua_pushfstring(L, "show: Unknown exception");
}
return dub_error(L);
}
示例8: main
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();
}
示例9: main
int main(int argc, char** argv) {
Q_INIT_RESOURCE(texture);
QApplication a(argc, argv);
QSurfaceFormat format;
format.setVersion(3,3);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
GLWidget glwidget;
glwidget.show();
return a.exec();
}
示例10: main
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();
}
示例11: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
GLWidget *window = new GLWidget;
window->show();
return app.exec();
/*Vector v(1, 0, 0);
Vector n(0, 0, 1);
double ang = 2 * pi;
//rotate(v, Quaternion(n, ang));
rotate1(v, n, ang);
std::cout << v.x() << " " << v.y() << " " << v.z() << '\n';
int tmp;
std::cin >> tmp;
return 0;*/
}
示例12: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setVersion(3,3);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
a.setApplicationName("PS6");
#ifndef QT_NO_OPENGL
GLWidget w;
w.show();
#else
QLabel note("OpenGL Support required");
note.show;
#endif
return a.exec();
}
示例13: glwidgettest
int glwidgettest(int argc, char* argv[])
{
// Set up the default format for our GL contexts.
QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
defaultFormat.setSamples(4);
QSurfaceFormat::setDefaultFormat(defaultFormat);
QApplication app(argc, argv);
GLWidget widget;
widget.setGeometry(10, 10, 250, 250);
widget.show();
GeometryNode* geometry = new GeometryNode;
SphereGeometry* spheres = new SphereGeometry;
geometry->addDrawable(spheres);
spheres->addSphere(Vector3f(0, 0, 0), Vector3ub(255, 0, 0), 0.5);
spheres->addSphere(Vector3f(2, 0, 0), Vector3ub(0, 255, 0), 1.5);
spheres->addSphere(Vector3f(0, 2, 1), Vector3ub(0, 0, 255), 1.0);
widget.renderer().scene().rootNode().addChild(geometry);
// Make sure the widget renders the scene, and store it in a QImage.
widget.raise();
widget.repaint();
// Run the application for a while, and then quit so we can save an image.
QTimer timer;
timer.setSingleShot(true);
app.connect(&timer, SIGNAL(timeout()), SLOT(quit()));
timer.start(200);
app.exec();
// Grab the frame buffer of the GLWidget and save it to a QImage.
QImage image = widget.grabFramebuffer();
// Set up the image regression test.
ImageRegressionTest test(argc, argv);
// Do the image threshold test, printing output to the std::cout for ctest.
return test.imageThresholdTest(image, std::cout);
}
示例14: main
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();
}
示例15: qttextlabeltest
int qttextlabeltest(int argc, char *argv[])
{
// Set up the default format for our GL contexts.
QGLFormat defaultFormat = QGLFormat::defaultFormat();
defaultFormat.setSampleBuffers(true);
QGLFormat::setDefaultFormat(defaultFormat);
// Create and show widget
QApplication app(argc, argv);
GLWidget widget;
widget.setGeometry(10, 10, 500, 500);
widget.show();
// Create scene
GeometryNode *geometry = new GeometryNode;
widget.renderer().scene().rootNode().addChild(geometry);
// Add a small sphere at the origin for reference:
SphereGeometry *spheres = new SphereGeometry;
spheres->addSphere(Vector3f::Zero(), Vector3ub(128, 128, 128), 0.1f);
geometry->addDrawable(spheres);
// Default text property:
TextProperties tprop;
// Test alignment:
TextLabel3D *l3 = NULL;
TextLabel2D *l2 = NULL;
// 3D:
tprop.setColorRgb(255, 0, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VTop);
l3 = new TextLabel3D;
l3->setText("Upper Left Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(0, 255, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VBottom);
l3 = new TextLabel3D;
l3->setText("Bottom Left Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(0, 0, 255);
tprop.setAlign(TextProperties::HRight, TextProperties::VTop);
l3 = new TextLabel3D;
l3->setText("Upper Right Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(255, 255, 0);
tprop.setAlign(TextProperties::HRight, TextProperties::VBottom);
l3 = new TextLabel3D;
l3->setText("Bottom Right Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgba(255, 255, 255, 220);
tprop.setRotationDegreesCW(90.f);
tprop.setAlign(TextProperties::HCenter, TextProperties::VCenter);
l3 = new TextLabel3D;
l3->setText("Centered Anchor (3D)");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
l3->setRenderPass(Avogadro::Rendering::TranslucentPass);
geometry->addDrawable(l3);
tprop.setRotationDegreesCW(0.f);
tprop.setAlpha(255);
// 2D:
tprop.setColorRgb(255, 0, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VTop);
l2 = new TextLabel2D;
l2->setText("Upper Left Corner");
l2->setAnchor(Vector2i(0, widget.height()));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(0, 255, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VBottom);
l2 = new TextLabel2D;
l2->setText("Bottom Left Corner");
l2->setAnchor(Vector2i(0, 0));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(0, 0, 255);
tprop.setAlign(TextProperties::HRight, TextProperties::VTop);
l2 = new TextLabel2D;
l2->setText("Upper Right Corner");
l2->setAnchor(Vector2i(widget.width(), widget.height()));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(255, 255, 0);
//.........这里部分代码省略.........