本文整理汇总了C++中QGLFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ QGLFormat函数的具体用法?C++ QGLFormat怎么用?C++ QGLFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QGLFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGLWidget
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent) {
_mouseState = UP;
}
示例2: QGLWidget
//! [0]
GLWidgetShader::GLWidgetShader(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
glEnable(GL_MULTISAMPLE);
// Important to enable the shaders
QGLFormat rgbaformat;
rgbaformat.setRgba(true);
rgbaformat.setSampleBuffers(true);
rgbaformat.setDoubleBuffer(true);
rgbaformat.setSamples(4);
rgbaformat.setOverlay(0);
this->setFormat(rgbaformat);
this->makeCurrent();
// Very important
this->setAutoFillBackground(false);
QTimer *timer = new QTimer(this);
timer->start(15);
timer->setInterval(15);
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(repaint()));
this->isDrawing=false;
qglClearColor(Qt::white);
this->nVertices = 0;
}
示例3: QGLWidget
GLWidget::GLWidget(QWidget *parent) :
QGLWidget(QGLFormat(QGL::DoubleBuffer), parent) {
this->setFocusPolicy(Qt::StrongFocus);
this->setMouseTracking(true);
this->setAutoBufferSwap(false);
prev_fps_ = 0.f;
}
示例4: QGLWidget
ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent)
: QGLWidget(new GLC_Context(QGLFormat(QGL::SampleBuffers)), parent)
, m_Light()
, m_World()
, m_GlView(this)
, m_MoverController()
, m_ModelBoundingBox()
, m_MotionTimer()
, acFilename()
, bgFilename()
, vboEnable(false)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
CreateScene();
QColor repColor;
repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0);
m_MoverController = GLC_Factory::instance()->createDefaultMoverController(repColor, &m_GlView);
// Get required UAVObjects
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
attActual = AttitudeActual::GetInstance(objManager);
connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude()));
}
示例5: QGLWidget
UiRenderPreview::UiRenderPreview(QWidget *parent, void *shared) :
QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::DirectRendering), parent, (QGLWidget*)shared) {
#else
UiRenderPreview::UiRenderPreview(QWidget *parent, void *shared) :
QOpenGLWidget(parent) {
Q_UNUSED(shared);
QSurfaceFormat sf;
//sf.setProfile(QSurfaceFormat::CompatibilityProfile);
//sf.setRenderableType(QSurfaceFormat::OpenGL);
//sf.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
//sf.setOption(QSurfaceFormat::DeprecatedFunctions);
sf.setSamples(4./devicePixelRatioFScale());
setFormat(sf);
#endif
setFocusPolicy(Qt::StrongFocus);
render = 0;
}
void UiRenderPreview::initializeGL() {
//OpenGL options
}
void UiRenderPreview::resizeGL(int width, int height) {
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 1, 0, 1, 1, -1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
示例6: QGLWidget
GlWidget::GlWidget(QWidget *parent)
: QGLWidget(QGLFormat(/* Additional format options */), parent)
{
alpha = 25;
beta = -25;
distance = 2.5;
}
示例7: QGLWidget
OpenGLWidget::OpenGLWidget(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
m_clearColor = QColor::fromRgb(0, 0, 0, 0);
m_glContext = nullptr;
m_width = 0;
m_height = 0;
}
示例8: QGLWidget
MyGLWidget::MyGLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
xRot = 0;
yRot = 0;
zRot = 0;
}
示例9: QGLWidget
// ...
GLWidget::GLWidget(QWidget* parent) : QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::Rgba | QGL::DepthBuffer), parent)
{
makeCurrent();
initFont();
resetSelection();
}
示例10: QGLWidget
GLQuad::GLQuad(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
QTimer *timer = new QTimer(this);
connect( timer, SIGNAL(timeout()), this, SLOT(updateGL()) );
timer->start( 50 );
}
示例11: QGLWidget
GLWidget::GLWidget(QWidget *p_parent)
: QGLWidget(new QGLContext(QGLFormat(QGL::SampleBuffers)), p_parent)
, m_Light()
, m_World()
, m_GlView()
, m_MoverController()
, m_ShuttleBoundingBox()
, m_MotionTimer()
{
connect(&m_GlView, SIGNAL(updateOpenGL()), this, SLOT(updateGL()));
m_Light.setPosition(4000.0, 40000.0, 80000.0);
//m_GlView.setBackgroundColor(Qt::white);
m_Light.setAmbientColor(Qt::lightGray);
m_GlView.cameraHandle()->setDefaultUpVector(glc::Z_AXIS);
m_GlView.cameraHandle()->setIsoView();
QColor repColor;
repColor.setRgbF(1.0, 0.11372, 0.11372, 1.0);
m_MoverController= GLC_Factory::instance()->createDefaultMoverController(repColor, &m_GlView);
createScene();
// Signal and slot connection
connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(rotateView()));
qDebug() << glc::X_AXIS.signedAngleWithVect(-glc::Y_AXIS, glc::Z_AXIS);
qDebug() << fmod(glc::X_AXIS.signedAngleWithVect(-glc::Y_AXIS, glc::Z_AXIS), 2.0 * glc::PI);
}
示例12: setViewport
void CSceneWidget::setEnabledOpenGl(bool enable)
{
#ifndef QT_NO_OPENGL
if(QGLFormat::hasOpenGL())
setViewport(enable?new QGLWidget(QGLFormat(QGL::SampleBuffers | QGL::DirectRendering)):new QWidget);
#endif
}
示例13: QGLWidget
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
resize(800,800);
QString filename = qApp->arguments().value(1,"");
qDebug() << "arglength: " << qApp->arguments().length();
if (filename == "artificial" || qApp->arguments().length() == 1) {
qDebug() << "creating new artificial data";
cons = new ArtificialConnections();
} else if (arg("nodes")!=""){
qDebug() << arg("nodes");
cons = new Connections(arg("nodes"), arg("cons"));
} else {
qDebug() << filename;
cons = new Connections(filename);
}
view = new GLfloat[16];
stuffAlpha = 0.99;
QVector3D size = cons->max-cons->min;
float largest = qMax(size.x(),size.y());
scale = (1/largest)*0.95;
bg = 1;
p1 = true;
p2 = true;
if (qApp->arguments().indexOf(QRegExp("-writefib"))!=-1) cons->writeBinaryVTK(filename+".fib");
if (qApp->arguments().indexOf(QRegExp("-screenshot"))!=-1) screenshot(filename+".png");
if (qApp->arguments().indexOf(QRegExp("-csv"))!=-1) cons->writeCSVs();
setFocus();
}
示例14: QGraphicsView
SchemaEditor::SchemaEditor(QWidget *parent, SchemaGui *schemaGui, Engine * engine, PanelScrollView *panelScrollView) :
QGraphicsView(schemaGui, parent),
_contextMenuPos(0,0),
_contextGear(NULL),
_engine(engine),
_schemaGui(schemaGui),
_scale(1),
_panelScrollView(panelScrollView),
_maxZValue(1),
_selectionChangeBypass(false)
{
_schemaGui->setSchemaEditor(this);
setDragMode(QGraphicsView::RubberBandDrag);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(Sunken | StyledPanel);
setOptimizationFlags(QGraphicsView::DontSavePainterState | QGraphicsView::IndirectPainting);
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
// render with OpenGL
if(0)
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
resetTransform();
setAcceptDrops(TRUE);
}
示例15: QMainWindow
MainWindow::MainWindow() : QMainWindow(0)
{
QMenu *file = menuBar()->addMenu(tr("&File"));
QAction *newAction = file->addAction(tr("New Game"));
newAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
QAction *quitAction = file->addAction(tr("Quit"));
quitAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
if (QApplication::arguments().contains("-fullscreen")) {
scene = new GraphicsScene(0, 0, 750, 400, GraphicsScene::Small);
setWindowState(Qt::WindowFullScreen);
} else {
scene = new GraphicsScene(0, 0, 880, 630);
layout()->setSizeConstraint(QLayout::SetFixedSize);
}
view = new QGraphicsView(scene, this);
view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
scene->setupScene(newAction, quitAction);
#ifndef QT_NO_OPENGL
view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
#endif
setCentralWidget(view);
}