void QgsFillSymbolLayerV2::drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) { QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width(), size.height() ) ); startRender( context ); renderPolygon( poly, NULL, context ); stopRender( context ); }
//static void LLVertexBuffer::cleanupClass() { LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); sLockedList.clear(); startRender(); stopRender(); clientCopy(); // deletes GL buffers }
void QgsLineSymbolLayerV2::drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) { QPolygonF points; // we're adding 0.5 to get rid of blurred preview: // drawing antialiased lines of width 1 at (x,0)-(x,100) creates 2px line points << QPointF( 0, size.height() / 2 + 0.5 ) << QPointF( size.width(), size.height() / 2 + 0.5 ); startRender( context ); renderPolyline( points, context ); stopRender( context ); }
void Save::render() { reset(); tStart = QTime::currentTime(); lwProgess->addItem(tr("Rendering started at %1.").arg(tStart.toString("hh:mm:ss"))); QSize size(finalRes()); lwProgess->addItem(tr("Allocating memory (%1x%2)...").arg(size.width()).arg(size.height())); img = new QImage(finalRes(), QImage::Format_RGB888); lwProgess->addItem(tr("Waiting for rendering...")); emit startRender(); }
GLWidget::GLWidget(QWidget *parent) : QOpenGLWidget(parent) { data.vertex.push_back(QVector2D(1.0, 1.0)); data.vertex.push_back(QVector2D(1.0, -1.0)); data.vertex.push_back(QVector2D(-1.0, -1.0)); data.vertex.push_back(QVector2D(-1.0, 1.0)); data.zoom = 0; data.moveX = 0; data.moveY = 0; data.saving = false; data.currentFile = 0; data.nextFile = 0; data.vsh = 0; data.fsh = 0; data.program = 0; data.pause = false; saveDialog = 0; QSurfaceFormat fmt = format(); fmt.setSamples(0); fmt.setVersion(4, 0); fmt.setOption(QSurfaceFormat::DeprecatedFunctions); fmt.setProfile(QSurfaceFormat::CompatibilityProfile); fmt.setDepthBufferSize(0); fmt.setStencilBufferSize(0); fmt.setAlphaBufferSize(0); fmt.setSamples(0); setFormat(fmt); QSurfaceFormat::setDefaultFormat(fmt); setFormat(fmt); setFocusPolicy(Qt::StrongFocus); setAutoFillBackground(false); saveDialog = new Save; saveDialog->setAttribute(Qt::WA_DeleteOnClose, false); saveDialog->close(); connect(saveDialog, SIGNAL(startRender()), this, SLOT(startRender())); }
Window::Window() { m_shouldDisplayFeather = true; std::cout<<"Initializing Mallard main window "; glWidget = new GLWidget; m_tools = new ToolBox; m_barbEdit = new BarbEdit(this); m_renderEdit = new RenderEdit(this); glWidget->setInteractContext(m_tools); m_brushControl = new BrushControl(glWidget->brush(), this); m_featherEdit = new FeatherEdit(this); FeatherExample::FeatherLibrary = glWidget; m_timeControl = new TimeControl(this); glWidget->setPlayback(m_timeControl); m_sceneEdit = new SceneEdit(glWidget, this); addToolBar(m_tools); setCentralWidget(glWidget); setWorkTitle(tr("untitled")); createActions(); createMenus(); connect(m_tools, SIGNAL(contextChanged(int)), this, SLOT(receiveToolContext(int))); connect(m_tools, SIGNAL(contextChanged(int)), m_brushControl, SLOT(receiveToolContext(int))); connect(m_tools, SIGNAL(actionTriggered(int)), this, SLOT(receiveToolAction(int))); connect(m_tools, SIGNAL(stateChanged(int)), this, SLOT(receiveToolState(int))); connect(m_brushControl, SIGNAL(brushChanged()), glWidget, SLOT(receiveBrushChanged())); connect(m_brushControl, SIGNAL(paintModeChanged(int)), glWidget, SLOT(receivePaintMode(int))); connect(glWidget, SIGNAL(sceneNameChanged(QString)), this, SLOT(setWorkTitle(QString))); connect(glWidget, SIGNAL(sendMessage(QString)), this, SLOT(showMessage(QString))); connect(m_featherEdit, SIGNAL(textureLoaded(QString)), glWidget, SLOT(receiveFeatherEditBackground(QString))); connect(m_featherEdit, SIGNAL(featherAdded()), glWidget, SLOT(receiveFeatherAdded())); connect(glWidget, SIGNAL(sendFeatherEditBackground(QString)), m_featherEdit, SLOT(receiveTexture(QString))); connect(m_timeControl, SIGNAL(currentFrameChanged(int)), glWidget, SLOT(updateOnFrame(int))); connect(m_featherEdit->uvView(), SIGNAL(selectionChanged()), m_barbEdit->barbControl(), SLOT(receiveSelectionChanged())); connect(glWidget, SIGNAL(featherSelectionChanged()), m_barbEdit->barbControl(), SLOT(receiveSelectionChanged())); connect(m_featherEdit->uvView(), SIGNAL(shapeChanged()), m_barbEdit->barbView(), SLOT(receiveShapeChanged())); connect(glWidget, SIGNAL(renderResChanged(QSize)), m_renderEdit, SLOT(resizeRenderView(QSize))); connect(glWidget, SIGNAL(renderEngineChanged(QString)), m_renderEdit, SLOT(setRenderEngine(QString))); connect(glWidget, SIGNAL(renderStarted(QString)), m_renderEdit, SLOT(startRender(QString))); connect(m_renderEdit, SIGNAL(cancelRender()), glWidget, SLOT(receiveCancelRender())); connect(m_barbEdit->barbControl(), SIGNAL(shapeChanged()), glWidget, SLOT(receiveBarbChanged())); connect(glWidget, SIGNAL(sceneOpened()), m_sceneEdit, SLOT(reloadScene())); connect(m_sceneEdit->model(), SIGNAL(cameraChanged()), glWidget, SLOT(receiveCameraChanged())); std::cout<<"Ready\n"; statusBar()->showMessage(tr("Ready")); }
void QgsMarkerSymbolLayer::drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) { startRender( context ); QgsPaintEffect *effect = paintEffect(); if ( effect && effect->enabled() ) { QgsEffectPainter p( context.renderContext(), effect ); renderPoint( QPointF( size.width() / 2, size.height() / 2 ), context ); } else { renderPoint( QPointF( size.width() / 2, size.height() / 2 ), context ); } stopRender( context ); }
void QgsFillSymbolLayer::drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) { QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width(), size.height() ) ); startRender( context ); QgsPaintEffect *effect = paintEffect(); if ( effect && effect->enabled() ) { QgsEffectPainter p( context.renderContext(), effect ); renderPolygon( poly, nullptr, context ); } else { renderPolygon( poly, nullptr, context ); } stopRender( context ); }
bool wyDirector::resume() { if(!m_paused || m_glView == NULL) return false; // set current time as last update time m_lastUpdateTime = wyUtils::currentTimeMillis(); // reset flag m_paused = false; m_delta = 0; // call gl view startRender(); // notify listener notifyDirectorResumed(); return true; }
void Renderer::render() { Clock::startSection("render"); startRender(); renderMap(); for (auto &it : entities_) { renderEntity(it.second); } // render overlay second for z ordering issues if (entityOverlayRenderer_) { for (auto &it : entities_) { renderEntityOverlay(it.second); } } effectManager_->render(getRenderTime()); endRender(); }
void QgsLineSymbolLayer::drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) { QPolygonF points; // we're adding 0.5 to get rid of blurred preview: // drawing antialiased lines of width 1 at (x,0)-(x,100) creates 2px line points << QPointF( 0, int( size.height() / 2 ) + 0.5 ) << QPointF( size.width(), int( size.height() / 2 ) + 0.5 ); startRender( context ); QgsPaintEffect *effect = paintEffect(); if ( effect && effect->enabled() ) { QgsEffectPainter p( context.renderContext(), effect ); renderPolyline( points, context ); } else { renderPolyline( points, context ); } stopRender( context ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), imgwidth(800), imgheight(600), depth(8), tracer(0) { ui->setupUi(this); //connect render buttons connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(startRender())); connect(ui->DepthBox, SIGNAL(valueChanged(int)), this, SLOT(DepthChanged(int))); //connect load/save actions connect(ui->actionOpen_Scene_File, SIGNAL(triggered()), this, SLOT(openSceneFile())); connect(ui->actionSave_rendered_Image, SIGNAL(triggered()), this, SLOT(saveImageFile())); QGraphicsScene* scene = new QGraphicsScene(this); ui->graphicsView->setScene(scene); }
QImage QgsSymbolV2::bigSymbolPreviewImage() { QImage preview( QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied ); preview.fill( 0 ); QPainter p( &preview ); p.setRenderHint( QPainter::Antialiasing ); p.translate( 0.5, 0.5 ); // shift by half a pixel to avoid blurring due antialising if ( mType == QgsSymbolV2::Marker ) { p.setPen( QPen( Qt::gray ) ); p.drawLine( 0, 50, 100, 50 ); p.drawLine( 50, 0, 50, 100 ); } QgsRenderContext context = QgsSymbolLayerV2Utils::createRenderContext( &p ); startRender( context ); if ( mType == QgsSymbolV2::Line ) { QPolygonF poly; poly << QPointF( 0, 50 ) << QPointF( 99, 50 ); static_cast<QgsLineSymbolV2*>( this )->renderPolyline( poly, 0, context ); } else if ( mType == QgsSymbolV2::Fill ) { QPolygonF polygon; polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 ); static_cast<QgsFillSymbolV2*>( this )->renderPolygon( polygon, NULL, 0, context ); } else // marker { static_cast<QgsMarkerSymbolV2*>( this )->renderPoint( QPointF( 50, 50 ), 0, context ); } stopRender( context ); return preview; }
void QgsMarkerSymbolLayerV2::drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) { startRender( context ); renderPoint( QPointF( size.width() / 2, size.height() / 2 ), context ); stopRender( context ); }
void QgsFeatureRendererV2::startRender( QgsRenderContext& context, const QgsVectorLayer* vlayer ) { startRender( context, vlayer->fields() ); }