当前位置: 首页>>代码示例>>C++>>正文


C++ renderFrame函数代码示例

本文整理汇总了C++中renderFrame函数的典型用法代码示例。如果您正苦于以下问题:C++ renderFrame函数的具体用法?C++ renderFrame怎么用?C++ renderFrame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了renderFrame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ofClear

void ofxWater::update(){
    // Calculate the difference between buffers and spread the waving
    updateFbo.begin();
    ofClear(0);
    updateShader.begin();
    updateShader.setUniformTexture("buffer1Sample", pingPong.src->getTextureReference(), 0);
    updateShader.setUniformTexture("buffer2Sample", pingPong.dst->getTextureReference(), 1);
    updateShader.setUniform1f("damping", (float)density );
    renderFrame();
    updateShader.end();
    updateFbo.end();
    
    // Blur the waving in order to make it smooth
    pingPong.src->begin();
    blurShader.begin();
    blurShader.setUniformTexture("tex", updateFbo.getTextureReference(), 0);
    blurShader.setUniform1f("fade_const", (float)(blurFade));
    renderFrame();
    blurShader.end();
    pingPong.src->end();
    
    // Use the buffer as a bumpmap to morph the surface of the background texture
    renderFbo.begin();
    ofClear(0);
    renderShader.begin();
    renderShader.setUniformTexture("tex", *texture , 0);
    renderShader.setUniformTexture("heightMap", updateFbo.getTextureReference(), 1);
    renderFrame();
    renderShader.end();
    renderFbo.end();
    
    // Switch buffers
    pingPong.swap();
}
开发者ID:burningneutron,项目名称:ofxFX,代码行数:34,代码来源:ofxWater.cpp

示例2: checkWindowResized

void Engine::updateFrame(bool interactible, long deltaTime)
{
	if (interactible)
	{
		// Each frame, we check to see if the window has resized.  While the
		// various events we get _should_ cover this, in practice, it appears
		// that the safest move across all platforms and OSes is to check at 
		// the top of each frame
		checkWindowResized();

		// We're "interactible", i.e. focused, so we play the music
		playLoopedMusic(true);

		// Time stands still when we're auto-paused, and we don't
		// automatically render
		if (getAppUIMode() == MODE_GAMEPLAY)
		{
			// only advance the "game" timer in gameplay mode
			advanceTime(deltaTime);

			// This will try to set up EGL if it isn't set up
			// When we first set up EGL completely, we also load our GLES resources
			// If these are already set up or we succeed at setting them all up now, then
			// we go ahead and render.
			renderFrame(true);
		}
		else if (isForcedRenderPending()) 
		{
			// forced rendering when needed for UI, etc
			renderFrame(true);
		}
	}
	else
	{
		// Even if we are not interactible, we may be visible, so we
		// HAVE to do any forced renderings if we can.  We must also
		// check for resize, since that may have been the point of the
		// forced render request in the first place!
		if (isForcedRenderPending() && mEgl.isReadyToRender(false)) 
		{
			checkWindowResized();
			renderFrame(false);
		}

		// We're not "interactible", so we'd better stop the music immediately
		playLoopedMusic(false);
	}
}
开发者ID:CZdravko,项目名称:NV-Globe,代码行数:48,代码来源:engine.cpp

示例3: windowProc

static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {
	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_ERASEBKGND:
		return 0;

	case WM_PAINT:
		renderFrame();
		return 0;

	case WM_MOUSEMOVE:		return mouseEvent(lParam, 0);
	case WM_LBUTTONDOWN:	return mouseEvent(lParam, 1);
	case WM_LBUTTONUP:		return mouseEvent(lParam, -1);
	case WM_RBUTTONDOWN:	return mouseEvent(lParam, 2);
	case WM_RBUTTONUP:		return mouseEvent(lParam, -2);

	case WM_SIZE:
		InvalidateRect(hWnd, NULL, FALSE);
		width = LOWORD(lParam);
		height = HIWORD(lParam);
		glViewport(0, 0, width, height);
		break;

	default:
		break;
	}

	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
开发者ID:fluffyfreak,项目名称:sphere_filling_curve,代码行数:33,代码来源:main.cpp

示例4: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	createWindow(hInstance);
	createGLContext();
	imguiRenderGLInit("c:\\windows\\fonts\\calibri.ttf");

	timeBeginPeriod(1);

	ShowWindow(hWnd, SW_SHOW);

	for (;;) {
		MSG msg;
		while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
			if (msg.message == WM_QUIT)
				return 0;

			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		renderFrame();
	}

	timeEndPeriod(1);
}
开发者ID:fluffyfreak,项目名称:sphere_filling_curve,代码行数:25,代码来源:main.cpp

示例5: while

bool LeverControl::process(uint32 deltaTimeInMillis) {
	if (!_enabled) {
		return false;
	}

	if (_isReturning) {
		_accumulatedTime += deltaTimeInMillis;
		while (_accumulatedTime >= ANIMATION_FRAME_TIME) {
			_accumulatedTime -= ANIMATION_FRAME_TIME;
			if (_returnRoutesCurrentFrame == *_returnRoutesCurrentProgress) {
				_returnRoutesCurrentProgress++;
			}
			if (_returnRoutesCurrentProgress == _frameInfo[_currentFrame].returnRoute.end()) {
				_isReturning = false;
				_currentFrame = _returnRoutesCurrentFrame;
				return false;
			}

			uint toFrame = *_returnRoutesCurrentProgress;
			if (_returnRoutesCurrentFrame < toFrame) {
				_returnRoutesCurrentFrame++;
			} else if (_returnRoutesCurrentFrame > toFrame) {
				_returnRoutesCurrentFrame--;
			}

			_engine->getScriptManager()->setStateValue(_key, _returnRoutesCurrentFrame);
			renderFrame(_returnRoutesCurrentFrame);
		}
	}
	
	return false;
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:32,代码来源:lever_control.cpp

示例6: startAtFrame

void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
	bool isDifferent = _movieFrameSurface[0]->w != r.width() ||
		_movieFrameSurface[0]->h != r.height();

	startAtFrame(startFrame);
	_currentFrame = startFrame;

	while (_currentFrame < (int)endFrame && !g_vm->shouldQuit()) {
		if (isNextFrame()) {
			renderFrame();
			++_currentFrame;

			if (isDifferent) {
				// Clear the destination area, and use the transBlitFrom method,
				// which supports arbitrary scaling, to reduce to the desired size
				g_vm->_screen->fillRect(r, 0);
				g_vm->_screen->transBlitFrom(*_movieFrameSurface[0],
					Common::Rect(0, 0, _movieFrameSurface[0]->w, _movieFrameSurface[0]->h), r);
			} else {
				g_vm->_screen->blitFrom(*_movieFrameSurface[0], Common::Point(r.left, r.top));
			}

			g_vm->_screen->update();
			g_vm->_events->pollEvents();
		}

		// Brief wait, and check at the same time for clicks to abort the clip
		if (g_vm->_events->waitForPress(10))
			break;
	}

	stop();
}
开发者ID:DrItanium,项目名称:scummvm,代码行数:33,代码来源:avi_surface.cpp

示例7: main

int main(int argc, char** argv) {
  fullscreen = false;
  grab = false;
  quit = false;
  initScreen();
  initFrameBuffer();
  createGLContext();
  createColorMap();

  createWindow();
  
  createBlankCursor();
  
  int x = 0;
  
  while(x<5000) {
    renderFrame();
    updateWindowTitle();
    x++;
    }
  
  
      /* Cleanup 
    glXDestroyWindow(display, glxwindow);
    xcb_destroy_window(connection, window);
    glXDestroyContext(display, context);
    XCloseDisplay(display);
      */
  
  return 0;
}
开发者ID:lubosz,项目名称:smalldemo,代码行数:31,代码来源:xcb.c

示例8: twang_draw

static unsigned long
twang_draw (Display *dpy, Window window, void *closure)
{
  struct state *st = (struct state *) closure;

  if (st->img_loader)   /* still loading */
    {
      st->img_loader = load_image_async_simple (st->img_loader, 0, 0, 0, 0, 0);
      if (! st->img_loader) {  /* just finished */
        grabImage_done (st);
      }
      return st->delay;
    }

  if (!st->img_loader &&
      st->start_time + st->duration < time ((time_t *) 0)) {
    XWindowAttributes xgwa;
    XGetWindowAttributes (st->dpy, st->window, &xgwa);
    grabImage_start (st, &xgwa);
    return st->delay;
  }

  modelEvents (st);
  updateModel (st);
  renderFrame (st);
  return st->delay;
}
开发者ID:Zygo,项目名称:xscreensaver,代码行数:27,代码来源:twang.c

示例9: seekToFrame

bool AVISurface::startAtFrame(int frameNumber) {
	if (isPlaying())
		// If it's already playing, then don't allow it
		return false;

	if (frameNumber == -1)
		// Default to starting frame of first movie range
		frameNumber = _movieRangeInfo.front()->_startFrame;
	if (_isReversed && frameNumber == (int)_decoder->getFrameCount())
		--frameNumber;

	// Start the playback
	_decoder->start();

	// Seek to the starting frame
	seekToFrame(frameNumber);

	// If we're in reverse playback, set the decoder to play in reverse
	if (_isReversed)
		_decoder->setRate(Common::Rational(-1));

	renderFrame();

	return true;
}
开发者ID:DrItanium,项目名称:scummvm,代码行数:25,代码来源:avi_surface.cpp

示例10: renderFrame

void Animation::render(int xaxis, int yaxis, const Graphics::Bitmap &work, double scalex, double scaley){
    if (getState().position >= frames.size()){
        return;
    }

    Mugen::Effects effects = frames[getState().position]->effects;
    effects.scalex = scalex;
    effects.scaley = scaley;

    renderFrame(frames[getState().position], xaxis, yaxis, work, effects);

#if 0
    // Modify with frame adjustment
    const int placex = xaxis+frames[position]->xoffset;
    const int placey = yaxis+frames[position]->yoffset;
    try{
        frames[position]->sprite->render(placex,placey,work,frames[position]->effects);
        
        if (showDefense){
            renderCollision( frames[position]->defenseCollision, work, xaxis, yaxis, Bitmap::makeColor( 0,255,0 ) );
        }

        if (showOffense){
            renderCollision( frames[position]->attackCollision, work, xaxis, yaxis,  Bitmap::makeColor( 255,0,0 ) );
        }
    } catch (const LoadException & e){
        Global::debug(0) << "Error loading sprite: " << e.getReason() << endl;
        /* FIXME: do something sensible here */
        frames[position]->sprite = 0;
    }
#endif
}
开发者ID:boyjimeking,项目名称:paintown,代码行数:32,代码来源:animation.cpp

示例11: if

void Animation::render(bool facing, bool vfacing, const int xaxis, const int yaxis, const Graphics::Bitmap &work, const double scalex, const double scaley, Graphics::Bitmap::Filter * filter){
    if (getState().position >= frames.size()){
        return;
    }

    Frame * frame = frames[getState().position];
    Mugen::Effects effects = frame->effects;
    effects.scalex = scalex;
    effects.scaley = scaley;
    /* FIXME: should horizontal facing follow the same logic as vfacing below? */
    effects.facing = facing;

    /* case 1: explode vfacing is true and frame is normal. vfacing = -1
     * case 2: explode vfacing is true and frame is flipped. vfacing = 1
     * case 3: explode vfacing is false and frame is normal. vfacing = 1
     * case 4: explode vfacing is false and frame is flipped. vfacing = -1
     */
    /* TODO: verify case 2 */
    if (!effects.vfacing && vfacing){
        effects.vfacing = true;
    } else if (effects.vfacing && vfacing){
        effects.vfacing = false;
    } else if (!effects.vfacing && !vfacing){
        effects.vfacing = false;
    } else {
        effects.vfacing = true;
    }
    effects.filter = filter;

    renderFrame(frame, xaxis, yaxis, work, effects);
}
开发者ID:boyjimeking,项目名称:paintown,代码行数:31,代码来源:animation.cpp

示例12: run

    //==============================================================================
    void run()
    {
        {
            // Allow the message thread to finish setting-up the context before using it..
            MessageManagerLock mml (this);
            if (! mml.lockWasGained())
                return;
        }

        nativeContext->makeActive();
        initialiseOnThread();

       #if JUCE_USE_OPENGL_SHADERS && ! JUCE_OPENGL_ES
        shadersAvailable = OpenGLShaderProgram::getLanguageVersion() > 0;
       #endif

        while (! threadShouldExit())
        {
            const uint32 frameRenderStartTime = Time::getMillisecondCounter();

            if (renderFrame())
                waitForNextFrame (frameRenderStartTime);
        }

        shutdownOnThread();
    }
开发者ID:sonic59,项目名称:JuceDirect2D,代码行数:27,代码来源:juce_OpenGLContext.cpp

示例13: Control

LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
		: Control(engine, key),
		  _frameInfo(0),
		  _frameCount(0),
		  _startFrame(0),
		  _currentFrame(0),
		  _lastRenderedFrame(0),
		  _mouseIsCaptured(false),
		  _isReturning(false),
		  _accumulatedTime(0),
		  _returnRoutesCurrentFrame(0) {

	// Loop until we find the closing brace
	Common::String line = stream.readLine();
	trimCommentsAndWhiteSpace(&line);

	while (!stream.eos() && !line.contains('}')) {
		if (line.matchString("*descfile*", true)) {
			char levFileName[25];
			sscanf(line.c_str(), "%*[^(](%25[^)])", levFileName);

			parseLevFile(levFileName);
		} else if (line.matchString("*cursor*", true)) {
			char cursorName[25];
			sscanf(line.c_str(), "%*[^(](%25[^)])", cursorName);

			_cursorName = Common::String(cursorName);
		}

		line = stream.readLine();
		trimCommentsAndWhiteSpace(&line);
	}

	renderFrame(_currentFrame);
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:35,代码来源:lever_control.cpp

示例14: updateFrame

bool EngineManager::updateUnitily()
{
	updateFrame();
	renderFrame();
	presentFrame();
	return !isExitRequested();
}
开发者ID:lriki,项目名称:Lumino,代码行数:7,代码来源:EngineManager.cpp

示例15: calculateVectorAngle

bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (!_enabled) {
		return false;
	}
	
	bool cursorWasChanged = false;

	if (_mouseIsCaptured) {
		// Make sure the square distance between the last point and the current point is greater than 64
		// This is a heuristic. This determines how responsive the lever is to mouse movement.
		// TODO: Fiddle with the heuristic to get a good lever responsiveness 'feel'
		if (_lastMousePos.sqrDist(backgroundImageSpacePos) >= 64) {
			int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos);
			_lastMousePos = backgroundImageSpacePos;

			for (Common::List<Direction>::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); ++iter) {
				if (angle >= (int)iter->angle - ANGLE_DELTA && angle <= (int)iter->angle + ANGLE_DELTA) {
					_currentFrame = iter->toFrame;
					renderFrame(_currentFrame);
					break;
				}
			}
		}
	} else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) {
		_engine->getCursorManager()->changeCursor(_cursorName);
		cursorWasChanged = true;
	}

	return cursorWasChanged;
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:30,代码来源:lever_control.cpp


注:本文中的renderFrame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。