void CameraWidget::update() { // Check if there is a capture device // if (capture == 0) { return; } // Grab a frame // IplImage* frame = ::cvQueryFrame(capture); // Convert that into an qt image // qImage = QImage((const uchar*)frame->imageData, frame->width, frame->height, frame->widthStep, QImage::Format_RGB888).rgbSwapped(); // Update the texture // updateTexture(); // Draw // glDraw(); }
void ViewCollection::render(GLuint groupId, glc::RenderFlag renderFlag) { if (!isEmpty()) { if (renderFlag == glc::WireRenderFlag) { glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset (1.0, 1.0); } if (GLC_State::isInSelectionMode()) { glDisable(GL_BLEND); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); } else { glEnable(GL_LIGHTING); } glDraw(groupId, renderFlag); if (renderFlag == glc::WireRenderFlag) { glDisable(GL_POLYGON_OFFSET_FILL); } } }
void AxisWidget::add(float x, float y, float z) { Rx = x; Ry = y; Rz = z; glDraw(); }
bool CQtOpenCVViewerGl::showImage( cv::Mat image ) { bufferMutex.lock(); image.copyTo(mOrigImage); bufferMutex.unlock(); glDraw(); return true; }
void MyGLWidget::mouseMoveEvent(QMouseEvent *e) { glm::vec2 newPos = glm::vec2(e->x(), e->y()); if(glm::distance(newPos, lastMousePos) > 100) lastMousePos = newPos; camera.Rotate_Horizontal((lastMousePos.x - newPos.x) * 0.4f); camera.Rotate_Vertical((lastMousePos.y - newPos.y) * 0.4f); lastMousePos = newPos; glDraw(); }
void CGLView::timerEvent(QTimerEvent *event) { BENCHMARK(0, "timer enter"); if (event->timerId() != m_timer.timerId()) { QWidget::timerEvent(event); return; } updateMidiTask(); BENCHMARK(1, "m_song task"); if (m_displayUpdateTicks < SCREEN_FRAME_RATE) return; m_displayUpdateTicks = 0; if (m_eventBits != 0) { if ((m_eventBits & EVENT_BITS_UptoBarReached) != 0) m_song->playFromStartBar(); if ((m_eventBits & EVENT_BITS_forceFullRedraw) != 0) m_forcefullRedraw = m_forceRatingRedraw = m_forceBarRedraw = REDRAW_COUNT; if ((m_eventBits & EVENT_BITS_forceRatingRedraw) != 0) m_forceRatingRedraw = REDRAW_COUNT; if ((m_eventBits & EVENT_BITS_newBarNumber) != 0) m_forcefullRedraw = m_forceRatingRedraw = m_forceBarRedraw = REDRAW_COUNT; // fixme this did not work so redraw everything m_qtWindow->songEventUpdated(m_eventBits); m_eventBits = 0; } if( m_cfg_openGlOptimise == 0 ) // zero is no GlOptimise m_fullRedrawFlag = true; else m_fullRedrawFlag = false; glDraw(); //update(); m_fullRedrawFlag = true; BENCHMARK(19, "timer exit"); }
void ViewCollection::renderShaderGroup(glc::RenderFlag renderFlag) { if (!isEmpty()) { if (GLC_State::isInSelectionMode()) { glDisable(GL_BLEND); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); } HashList::iterator iEntry= m_ShadedPointerViewInstanceHash.begin(); while (iEntry != m_ShadedPointerViewInstanceHash.end()) { glDraw(iEntry.key(), renderFlag); ++iEntry; } } }
void run () { while (!glfwWindowShouldClose(mainWindow)) { { glfwMakeContextCurrent(mainWindow); glDraw(mainWindow, glfwGetTime()); glFlush(); // NOTE: On windows, swapping buffers can block a lot, regardless of the swap interval. // NOTE: On windows, the current buffer swapping implementation doesn't require a current context. glfwSwapBuffers(mainWindow); glfwMakeContextCurrent(0); } glfwPollEvents(); } }
void MyGLWidget::keyPressEvent(QKeyEvent *e) { if(e->key() == Qt::Key_Escape) exit(0); // FORWARD if(e->key() == FORWARD) camera.Move_Forward(0.05f); if(e->key() == BACKWARD) camera.Move_Forward(-0.05f); // ROTATE-HORIZONTAL if(e->key() == TURN_L) camera.Rotate_Horizontal(5.0f); if(e->key() == TURN_R) camera.Rotate_Horizontal(-5.0f); // STRAFE if(e->key() == STRAFE_L) camera.Move_Sideways(0.05f); if(e->key() == STRAFE_R) camera.Move_Sideways(-0.05f); // UP DOWN if(e->key() == UP) camera.Move_Vertical(0.05f); if(e->key() == DOWN) camera.Move_Vertical(-0.05f); // ROTATE-VERTICAL if(e->key() == TURN_U) camera.Rotate_Vertical(5.0f); if(e->key() == TURN_D) camera.Rotate_Vertical(-5.0f); glDraw(); }
void CameraWidget::updateTexture() { // Convert the image to opengl format // glImage = QGLWidget::convertToGLFormat(qImage); // Setup the texture in memory // ::glBindTexture(GL_TEXTURE_2D, mTextureId); ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, glImage.width(), glImage.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); ::glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)glImage.bits()); // Redraw the screen // glDraw(); }
// Geometry display void GLC_Geometry::render(const GLC_RenderProperties& renderProperties) { Q_ASSERT(!m_IsWire || (m_IsWire && m_MaterialHash.isEmpty())); bool renderWire= (renderProperties.renderingFlag() == glc::TransparentRenderFlag) && isTransparent(); renderWire= renderWire || ((renderProperties.renderingFlag() != glc::TransparentRenderFlag) && !isTransparent()); if (!m_IsWire || renderWire) { if (m_MaterialHash.isEmpty() && !m_IsWire) { GLC_Material* pMaterial= new GLC_Material(); pMaterial->setName(name()); addMaterial(pMaterial); } m_IsSelected= renderProperties.isSelected(); // Define Geometry's property if(!GLC_State::isInSelectionMode()) { glPropGeom(renderProperties); } glDraw(renderProperties); m_IsSelected= false; m_GeometryIsValid= true; // OpenGL error handler GLenum error= glGetError(); if (error != GL_NO_ERROR) { GLC_OpenGlException OpenGlException("GLC_Geometry::glExecute " + name(), error); throw(OpenGlException); } } }
void OpencvGLWidget::updateImage(IplImage* image) { channel = image->nChannels; m_width = image->width; m_height = image->height; if (!imagetoshowcreated) { m_rgbImage = cvCreateImage(cvSize(m_width, m_height), IPL_DEPTH_8U, 3); m_grayImage = cvCreateImage(cvSize(m_width, m_height), IPL_DEPTH_8U, 1); imagetoshowcreated = true; } if (channel == 1) { cvCopy(image, m_grayImage); } else { cvCopy(image, m_rgbImage); } glDraw(); }
void DhQGLWidget::DvhglDraw() { return glDraw(); }
void Renderer::renderBuffers() { glDraw(); }
void MyGLWidget::wheelEvent ( QWheelEvent * event ) { zoom += event->delta() / 30 ; emit zoomFactorChanged(zoom); glDraw() ; // !Deprecated }
void QGLWidget::updateGL() { glDraw(); }
// Representation OpenGL Execution void GLC_RepMover::render() { // Call virtual draw function glDraw(); }
void QGLWidget::paintEvent( QPaintEvent * ) { glDraw(); updateOverlayGL(); }
/* to do a draw, just issue the glDraw and that will make it go through glPaint and take care of buffer swapping */ void MidasGL::draw() { glDraw(); }
void MyGLWidget::wheelEvent(QWheelEvent *e) { camera.Move_Forward((float)(e->delta() * 0.01f)); glDraw(); }