这篇教程C++ swapBuffers函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中swapBuffers函数的典型用法代码示例。如果您正苦于以下问题:C++ swapBuffers函数的具体用法?C++ swapBuffers怎么用?C++ swapBuffers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了swapBuffers函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: glClearvoid GraspTest::displayCallback(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_dynamicsWorld) m_dynamicsWorld->debugDrawWorld();// drawLimit(); renderme(); glFlush(); swapBuffers();}
开发者ID:benkehoe,项目名称:gnrr,代码行数:14,
示例2: initBuffersvoid StelAppGraphicsWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*){ // Don't even try to draw if we don't have a core yet (fix a bug during splash screen) if (!stelApp || !stelApp->getCore() || !doPaint) return; StelPainter::setQPainter(painter); if (useBuffers) { StelPainter::makeMainGLContextCurrent(); initBuffers(); backgroundBuffer->bind(); QPainter* pa = new QPainter(backgroundBuffer); StelPainter::setQPainter(pa); // If we are using the gui, then we try to have the best reactivity, even if we need to lower the fps for that. int minFps = StelApp::getInstance().getGui()->isCurrentlyUsed() ? 16 : 2; while (true) { bool keep = paintPartial(); if (!keep) // The paint is done { delete pa; backgroundBuffer->release(); swapBuffers(); break; } double spentTime = StelApp::getTotalRunTime() - previousPaintFrameTime; if (1. / spentTime <= minFps) // we spent too much time { // We stop the painting operation for now delete pa; backgroundBuffer->release(); break; } } Q_ASSERT(!backgroundBuffer->isBound()); Q_ASSERT(!foregroundBuffer->isBound()); // Paint the last completed painted buffer StelPainter::setQPainter(painter); viewportEffect->paintViewportBuffer(foregroundBuffer); } else { while (paintPartial()) {;} } StelPainter::setQPainter(NULL); previousPaintFrameTime = StelApp::getTotalRunTime();}
开发者ID:Astrocoderguy,项目名称:stellarium,代码行数:50,
示例3: createWindowvoid createWindow(char* windowName, int boardSize, MouseListener l) { int windowSize = 2*BOARD_PADDING + boardSize * TILE_SIZE; initwindow(windowSize, windowSize, windowName); setbkcolor(LIGHTGRAY); clearScreen(); swapBuffers(); mouseClickListener.l = l; // register mouse listeners registermousehandler(WM_LBUTTONDOWN, mouseDown); registermousehandler(WM_LBUTTONUP, mouseUp); registermousehandler(WM_MOUSEMOVE, mouseMove);}
开发者ID:hick209,项目名称:Monitoria-ICC,代码行数:14,
示例4: OgreProfileBeginGPUEvent //----------------------------------------------------------------------- void RenderTarget::update(bool swap) { OgreProfileBeginGPUEvent("RenderTarget: " + getName()); // call implementation updateImpl(); if (swap) { // Swap buffers swapBuffers(); } OgreProfileEndGPUEvent("RenderTarget: " + getName()); }
开发者ID:OGRECave,项目名称:ogre,代码行数:15,
示例5: glClear void BulletOpenGLViewer::displayCallback() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_dynamicsWorld) { m_dynamicsWorld->debugDrawWorld(); } renderme(); glFlush(); swapBuffers(); }
开发者ID:gkalogiannis,项目名称:simox,代码行数:14,
示例6: glClear void SceneDisplayerWidget::paintGL() { if(sceneDisplayer!=nullptr) { sceneDisplayer->paint(); }else { glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.1f, 0.05f, 0.1f, 1.0f); } swapBuffers(); update(); }
开发者ID:xuxiaowei007,项目名称:UrchinEngine,代码行数:14,
示例7: setRotatevoid GLWidget::Draw(){ setRotate(); GLfloat length = 2.0; int i,j,k; glPushMatrix(); for( i = -1; i <= 1; i++) for( j = -1; j <= 1; j++) for( k = -1; k <= 1; k++) { glPushMatrix(); glTranslatef(length*i*1.05,length*j*1.05,length*k*1.05); cube(length); glPopMatrix(); } glPopMatrix(); swapBuffers(); ///////////////////////////////// /* glPushMatrix(); glBegin( GL_QUADS ); glColor3f( 0.0, 1.0, 0.0 ); glVertex3f( 1.0, 1.0, -1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( 1.0, 1.0, 1.0 );glColor3f( 1.0, 0.5, 0.0 ); glVertex3f( 1.0, -1.0, 1.0 ); glVertex3f( -1.0, -1.0, 1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( 1.0, -1.0, -1.0 );glColor3f( 1.0, 0.0, 0.0 ); glVertex3f( 1.0, 1.0, 1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( -1.0, -1.0, 1.0 ); glVertex3f( 1.0, -1.0, 1.0 );glColor3f( 1.0, 1.0, 0.0 ); glVertex3f( 1.0, -1.0, -1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( 1.0, 1.0, -1.0 );glColor3f( 0.0, 0.0, 1.0 ); glVertex3f( -1.0, 1.0, 1.0 ); glVertex3f( -1.0, 1.0, -1.0 ); glVertex3f( -1.0, -1.0, -1.0 ); glVertex3f( -1.0, -1.0, 1.0 );glColor3f( 1.0, 0.0, 1.0 ); glVertex3f( 1.0, 1.0, -1.0 ); glVertex3f( 1.0, 1.0, 1.0 ); glVertex3f( 1.0, -1.0, 1.0 ); glVertex3f( 1.0, -1.0, -1.0 ); glEnd(); glPopMatrix(); */}
开发者ID:tangming10000,项目名称:Tang,代码行数:50,
示例8: glClearvoid ConvexDecompositionDemo::displayCallback(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_dynamicsWorld) m_dynamicsWorld->debugDrawWorld(); renderme(); glFlush(); swapBuffers();}
开发者ID:TomasHurban,项目名称:DP_Hairs_simulation_and_visualization,代码行数:14,
示例9: LBLOGbool Window::_cmdSwap( co::Command& command ){ const WindowSwapPacket* packet = command.get< WindowSwapPacket >(); LBLOG( LOG_TASKS ) << "TASK swap buffers " << getName() << " " << packet << std::endl; if( getDrawableConfig().doublebuffered ) { // swap WindowStatistics stat( Statistic::WINDOW_SWAP, this ); makeCurrent(); swapBuffers(); } return true;}
开发者ID:bohara,项目名称:Equalizer,代码行数:15,
示例10: swapBuffers//-----------------------------------------------------------------------------void MainWindow::paintGL(){ gr->Clf(); gr->SubPlot(1,1,0); gr->Rotate(40,60); gr->Light(true); gr->AddLight(0,mglPoint(0,0,10),mglPoint(0,0,-1)); gr->Axis(); gr->Box(); gr->FPlot("sin(pi*x)","i2"); gr->FPlot("cos(pi*x)","|"); gr->FSurf("cos(2*pi*(x^2+y^2))"); gr->Finish(); swapBuffers();}
开发者ID:svn2github,项目名称:MathGL,代码行数:16,
示例11: blitvoid QGLBlitter::SubWidget::paintGL() { clear = 2; if (reinterpret_cast<const QGLBlitter*>(parentWidget())->isPaused()) {// if (swapInterval)// blitFront();// else { if (!blitted) blit(); swapBuffers(); blitted = false;// } }}
开发者ID:eadmaster,项目名称:gambatte-libretro,代码行数:15,
示例12: InfovoidContext::startLoop(){ Info() << "Context initializing renderloop."; m_loop->initialize(*this); Info() << "Starting render loop."; do { m_loop->render(); swapBuffers(); pollEvents(); } while (!windowShouldClose()); Info() << "Renderloop exited.";}
开发者ID:MEC402,项目名称:cruft,代码行数:15,
示例13: DPTR_Dvoid GLWidgetRenderer::paintGL(){ DPTR_D(GLWidgetRenderer); /* we can mix gl and qpainter. * QPainter painter(this); * painter.beginNativePainting(); * gl functions... * painter.endNativePainting(); * swapBuffers(); */ handlePaintEvent(); swapBuffers(); if (d.painter && d.painter->isActive()) d.painter->end();}
开发者ID:aisq2008,项目名称:QtAV,代码行数:15,
示例14: errorvoid GemWindow::render(void){ if(!makeCurrent()) { error("unable to switch to current window (do you have one?), cannot render!"); return; } if(!pushContext()) { error("unable to switch to current context, cannot render!"); return; } bang(); if(m_buffer==2) swapBuffers(); popContext();}
开发者ID:avilleret,项目名称:Gem,代码行数:15,
示例15: glClearvoid tgSimViewGraphics::displayCallback(){ if (isInitialzed()) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderme(); // optional but useful: debug drawing to detect problems if (m_dynamicsWorld) { m_dynamicsWorld->debugDrawWorld(); } glFlush(); swapBuffers(); }}
开发者ID:MrMoose,项目名称:NTRTsim,代码行数:15,
示例16: glClearColorvoid MyWindow::displayFunc() { glClearColor(1.0f, 1.0f, 1.0f, 0.1f); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); my_cam->update(); glDepthFunc(GL_LESS); drawBackground(); glDepthRange(0,1000); drawAxis(); drawCurs(); swapBuffers(); glFlush();}
开发者ID:lazorg64,项目名称:game_engine,代码行数:15,
示例17: glClearvoid View::paintGL(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glDisable(GL_LIGHTING); renderScene(); swapBuffers(); glEnable(GL_LIGHTING);}
开发者ID:cc26,项目名称:3D_SolarSystem,代码行数:15,
示例18: glClearColorvoid MyWindow::display(){ WindowInertiaCamera::display(); glClearColor(0.4f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // // timing for frames // //ViewerStates::realtime.update(true); ViewerStates::fTime += (float)m_realtime.frameDT; // // SCENE-LEVEL TEST // nvFX::PassInfo pr; memset(&pr, 0, sizeof(pr)); if(fx_TechScene) { int np = fx_TechScene->getNumPasses(); for(int i=0; i<np; i++) { nvFX::IPass* scenePass = fx_TechScene->getPass(i, &pr); if(!pr.bActive) continue; if(!scenePass->isValidated()) { continue; } pr.renderingGroup = 0; // set back to 0 before each pass. So no persistent value across passes scenePass->execute(&pr); iResolution->updateValue3f((float)m_W, (float)m_H, 0, scenePass); iGlobalTime->updateValue1f(ViewerStates::fTime, scenePass); iMouse->updateValue4fv(m_mouse, scenePass); //iDate = fx_EffectScene->findUniform("iDate"); //iSampleRate = fx_EffectScene->findUniform("iSampleRate"); switch(pr.renderingMode) { default: break; } glUseProgram(0); } } // Draw tweak bars#ifdef USEANTTWEAKBAR //TwDraw();#endif swapBuffers();}
开发者ID:2php,项目名称:nvFX,代码行数:48,
示例19: LOG_ALWAYS_FATAL_IFvoid CanvasContext::draw() { LOG_ALWAYS_FATAL_IF(!mCanvas || mEglSurface == EGL_NO_SURFACE, "drawRenderNode called on a context with no canvas or surface!"); profiler().markPlaybackStart(); SkRect dirty; mDamageAccumulator.finish(&dirty); EGLint width, height; mEglManager.beginFrame(mEglSurface, &width, &height); if (width != mCanvas->getViewportWidth() || height != mCanvas->getViewportHeight()) { mCanvas->setViewport(width, height); dirty.setEmpty(); } else if (!mDirtyRegionsEnabled || mHaveNewSurface) { dirty.setEmpty(); } else { if (!dirty.isEmpty() && !dirty.intersect(0, 0, width, height)) { ALOGW("Dirty " RECT_STRING " doesn't intersect with 0 0 %d %d ?", SK_RECT_ARGS(dirty), width, height); dirty.setEmpty(); } profiler().unionDirty(&dirty); } status_t status; if (!dirty.isEmpty()) { status = mCanvas->prepareDirty(dirty.fLeft, dirty.fTop, dirty.fRight, dirty.fBottom, mOpaque); } else { status = mCanvas->prepare(mOpaque); } Rect outBounds; status |= mCanvas->drawRenderNode(mRootRenderNode.get(), outBounds); profiler().draw(mCanvas); mCanvas->finish(); profiler().markPlaybackEnd(); if (status & DrawGlInfo::kStatusDrew) { swapBuffers(); } profiler().finishFrame();}
开发者ID:AdrianoMartins,项目名称:platform_frameworks_base,代码行数:48,
示例20: glClearvoid BenchmarkDemo::displayCallback(void) {#ifdef USE_GRAPHICAL_BENCHMARK glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderme(); //optional but useful: debug drawing to detect problems if (m_dynamicsWorld) m_dynamicsWorld->debugDrawWorld(); glFlush(); swapBuffers();#endif //USE_GRAPHICAL_BENCHMARK}
开发者ID:Mashewnutz,项目名称:Slo,代码行数:16,
示例21: commandbool Window::_cmdSwap( co::ICommand& cmd ){ co::ObjectICommand command( cmd ); LBLOG( LOG_TASKS ) << "TASK swap buffers " << getName() << " " << command << std::endl; if( getDrawableConfig().doublebuffered ) { // swap WindowStatistics stat( Statistic::WINDOW_SWAP, this ); makeCurrent(); swapBuffers(); } return true;}
开发者ID:gitter-badger,项目名称:Equalizer,代码行数:16,
示例22: glClearvoid PostComposer::passDistortion() { writeBuffer->bind(); glClear(GL_COLOR_BUFFER_BIT); shaderDistortion->bind(); shaderFXAA->transmitUniform("resolution", 1 / widthf, 1 / heightf); readBuffer->bindAndTransmitTextures(shaderDistortion); quad->draw(shaderDistortion->attribute("position")); writeBuffer->unbind(); swapBuffers();}
开发者ID:redagito,项目名称:JungleIN,代码行数:16,
示例23: initbool SDLwindow::oneStep(){ if (!initialized){ // init() must be executed in the thread where draw() is called init(); } double startT = SDL_GetTicks(); if (!processEvents()) return false; draw(); swapBuffers(); double dt = SDL_GetTicks() - startT; if (dt < 1000.0/30){ SDL_Delay(1000.0/30 - dt); } return true;}
开发者ID:thomas-moulard,项目名称:hrpsys-base-deb,代码行数:16,
示例24: mainint main(int argc, char* argv[]){ auto device = RenderDevice::getInstance(); device->init(); device->setQuitOnStart(true); Text text(30.0f); text.setString("Random color"); // Create a thread that changes the text color every second Thread thread([&](void*) { while(device->isRunning()) { text.setColor(Color::Random()); Thread::sleep(Time::seconds(1)); } }); // Start the thread thread.start(); while(device->isRunning()) { device->setTargetScreen(Screen::Top); device->clear(Color::Black); device->startFrame(); text.draw(); device->endFrame(); device->setTargetScreen(Screen::Bottom); device->clear(Color::Black); device->startFrame(); device->endFrame(); device->swapBuffers(); } // Wait the thread end thread.join(); // DON'T FORGET TO CALL THIS OR THE 3DS WILL CRASH AT EXIT device->destroy(); return 0;}
开发者ID:Cpasjuste,项目名称:Kairy,代码行数:47,
示例25: mainint main(int argc, char* argv[]){ // Get device singleton instance. auto device = RenderDevice::getInstance(); device->init(); device->setQuitOnStart(true); // Create a rectangle shape RectangleShape rect(100, 60, 100, 100); // And we set it's color to blue rect.setColor(Color::Blue); rect.setOutlineColor(Color::Red); rect.setOutlineThickness(2); // Create a line LineShape line(0, 0, BOTTOM_SCREEN_WIDTH, BOTTOM_SCREEN_HEIGHT); // And set its color to yellow line.setColor(Color::Yellow); // Main loop while(device->isRunning()) { device->setTargetScreen(Screen::Top); device->clear(Color::Black); device->startFrame(); // Draw the rectangle to top screen rect.draw(); device->endFrame(); device->setTargetScreen(Screen::Bottom); device->clear(Color::Black); device->startFrame(); // Draw a diagonal line on bottom screen line.draw(); device->endFrame(); device->swapBuffers(); } // DON'T FORGET TO CALL THIS OR THE 3DS WILL CRASH AT EXIT device->destroy(); return 0;}
开发者ID:Cpasjuste,项目名称:Kairy,代码行数:47,
示例26: glClearvoid SerializeDemo::clientMoveAndDisplay(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //simple dynamics world doesn't handle fixed-time-stepping float ms = getDeltaTimeMicroseconds(); ///step the simulation if (m_dynamicsWorld) { m_dynamicsWorld->stepSimulation(ms / 1000000.f); #ifdef DESERIALIZE_SOFT_BODIES if (fSoftBodySolver) fSoftBodySolver->copyBackToSoftBodies();#endif m_dynamicsWorld->debugDrawWorld();#ifdef DESERIALIZE_SOFT_BODIES if (m_dynamicsWorld->getWorldType()==BT_SOFT_RIGID_DYNAMICS_WORLD) { //optional but useful: debug drawing btSoftRigidDynamicsWorld* softWorld = (btSoftRigidDynamicsWorld*)m_dynamicsWorld; for ( int i=0;i<softWorld->getSoftBodyArray().size();i++) { btSoftBody* psb=(btSoftBody*)softWorld->getSoftBodyArray()[i]; if (softWorld->getDebugDrawer() && !(softWorld->getDebugDrawer()->getDebugMode() & (btIDebugDraw::DBG_DrawWireframe))) { btSoftBodyHelpers::DrawFrame(psb,softWorld->getDebugDrawer()); btSoftBodyHelpers::Draw(psb,softWorld->getDebugDrawer(),softWorld->getDrawFlags()); } } }#endif //DESERIALIZE_SOFT_BODIES } renderme(); glFlush(); swapBuffers();}
开发者ID:BBlayne,项目名称:COMP371-Codebase,代码行数:47,
示例27: glClearvoid Render::paintGL() { glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-getFrustWidth(), getFrustWidth(), -getFrustHeight(), getFrustHeight(), mFrustNear, mFrustFar); glTranslatef(-mCamPoint.x(),-mCamPoint.y(),-mCamPoint.z()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); float conv[16]; rotToFloatArray(conv); glMultMatrixf(conv); /*float xt = -3; float xf = 3; float yf = -3; float yt = 3; float z = 0;*/ glColor4f(1, 1, 1, 1); glLineWidth(10); glBegin(GL_LINES); glVertex3f(mCamOldPoint.x(),mCamOldPoint.y(),mCamOldPoint.z()); glVertex3f(mCamOldPoint.x() + mSelectionDir.x(), mCamOldPoint.y() + mSelectionDir.y(), mCamOldPoint.z() + mSelectionDir.z()); glEnd(); glColor4f(1, 0, 0, 1); glLineWidth(10); glBegin(GL_LINES); glVertex3f(mCamOldPoint.x() + mSelectionDir.x(), mCamOldPoint.y() + mSelectionDir.y(), mCamOldPoint.z() + mSelectionDir.z()); glVertex3f(mCamOldPoint.x() + mSelectionDir.x()*2, mCamOldPoint.y() + mSelectionDir.y()*2, mCamOldPoint.z() + mSelectionDir.z()*2); glEnd(); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor3f(1,1,1); mMesh.draw(0,0,0, false, true);/* glBegin(GL_QUADS); glVertex3f(xf,yt,z); glVertex3f(xf,yf,z); glVertex3f(xt,yf,z); glVertex3f(xt,yt,z); glEnd();*/ glFlush(); glFinish(); swapBuffers();}
开发者ID:TZer0,项目名称:SkeletalDefiner,代码行数:46,
示例28: glClearvoid ConvexDecompositionDemo::clientMoveAndDisplay(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); float dt = getDeltaTimeMicroseconds() * 0.000001f; m_dynamicsWorld->stepSimulation(dt); //optional but useful: debug drawing m_dynamicsWorld->debugDrawWorld(); renderme(); glFlush(); swapBuffers();}
开发者ID:Aatch,项目名称:bullet3,代码行数:17,
注:本文中的swapBuffers函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ swapTemp函数代码示例 C++ swap32函数代码示例 |