Пример #1
0
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();
}
Пример #2
0
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);
	}
}
Пример #3
0
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);
}
Пример #4
0
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);
}
Пример #5
0
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;
}
Пример #6
0
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();
}
Пример #7
0
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;
}
Пример #8
0
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;
}
Пример #9
0
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;
}
Пример #10
0
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
}
Пример #11
0
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);
}
Пример #12
0
    //==============================================================================
    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();
    }
Пример #13
0
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);
}
Пример #14
0
bool EngineManager::updateUnitily()
{
	updateFrame();
	renderFrame();
	presentFrame();
	return !isExitRequested();
}
Пример #15
0
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;
}
Пример #16
0
bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
	if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
		return false;

	bool cursorWasChanged = false;

	if (_mouseIsCaptured) {
		// Make sure the square distance between the last point and the current point is greater than 16
		// This is a heuristic. This determines how responsive the lever is to mouse movement.
		if (_lastMousePos.sqrDist(backgroundImageSpacePos) >= 16) {
			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);
					_engine->getScriptManager()->setStateValue(_key, _currentFrame);
					break;
				}
			}
		}
		_engine->getCursorManager()->changeCursor(_cursor);
		cursorWasChanged = true;
	} else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) {
		_engine->getCursorManager()->changeCursor(_cursor);
		cursorWasChanged = true;
	}

	return cursorWasChanged;
}
Пример #17
0
//extern int	g_iHeartTest;
void Engine::handleCommand(int cmd)
{
    switch (cmd)
    {
		//save player data.
		 case APP_CMD_SAVE_STATE:
 // The system has asked us to save our current state.  Do so.
			 {
				//this->mApp->savedState = malloc(sizeof(int));
				//int*l_pNumHeart = (int*)this->mApp->savedState;
				//*l_pNumHeart = g_iHeartTest;
				//mApp->stateSaved = sizeof(int);
			 }
			 break;
		// The window is being shown, get it ready.
		// Note that on ICS, the EGL size will often be correct for the new size here
		// But on HC it will not be.  We need to defer checking the new res until the
		// first render with the new surface!
        case APP_CMD_INIT_WINDOW:
        case APP_CMD_WINDOW_RESIZED:
			mEgl.setWindow(mApp->window);
        	break;

        case APP_CMD_TERM_WINDOW:
            // The window is being hidden or closed, clean it up.
			mEgl.setWindow(NULL);
			break;

        case APP_CMD_GAINED_FOCUS:
			g_bLostFocus = false;
			mEgl.setWindow(mApp->window);
			if( cGameApp::m_spSoundParser )
				cGameApp::m_spSoundParser->Pause(false);
			break;
		case APP_CMD_STOP:
        case APP_CMD_LOST_FOCUS:
			if(cGameApp::m_spSoundParser)
			{
				//cGameApp::m_spSoundParser->Stop();
				cGameApp::m_spSoundParser->Pause(true);
			}
			g_bLostFocus = true;
			break;
		case APP_CMD_PAUSE:
        	// Move out of gameplay mode if we are in it.  But if we are
			// in another dialog mode, leave it as-is
            if (mGameplayMode)
				setGameplayMode(false);
            break;

		// ICS does not appear to require this, but on GB phones,
		// not having this causes rotation changes to be delayed or
		// ignored when we're in a non-rendering mode like autopause.
		// The forced renders appear to allow GB to process the rotation
		case APP_CMD_CONFIG_CHANGED:
			renderFrame(true);
			break;
    }
}
Пример #18
0
void Animation::render(int xaxis, int yaxis, const Graphics::Bitmap & work, const Mugen::Effects & effects){
    if (getState().position >= frames.size()){
        return;
    }

    Mugen::Effects combined = frames[getState().position]->effects + effects;
    renderFrame(frames[getState().position], xaxis, yaxis, work, combined);
}
Пример #19
0
void Draw(ESContext *esContext)
{
	//

	renderFrame();

	eglSwapBuffers(esContext->eglDisplay, esContext->eglSurface);
} 
Пример #20
0
/////////// JNICALL .._step ////////////
JNIEXPORT void JNICALL Java_ondrej_platek_bind_NativeRenderer_step(JNIEnv * env, jobject mythis) {
    AppCtx * c =  reinterpret_cast<AppCtx*>(extractInt(env, mythis, "pAppCtx"));
    if(c == NULL) {
      LOGE("NativeRender_step context is NULL");
    }
    else {
        renderFrame(c);
    }
}
Пример #21
0
//-------------------------------------------------------------------------
char runGame()
{
	int offset;
	char i, willyCollideSprites = ColNoCol;
	BOOL willyCollideBackground = NO;
	if(m_keysFound == m_keysToFind)
	{
		++m_keysFound;
		for(i = level2Sprite[m_level].index ;; ++i)
		{
			SpriteData *sprt = &spriteData[i];
			if(sprt->spriteClass & SPClass_Door)
			{
				sprt->curEnabled = 1;
				m_doorToggle = 0;
				break;
			}
			else if(sprt->spriteClass & SPClass_Eugene)
			{
				sprt->curDirection = 1;
				sprt->curLocalStorage = 1;
			}
		}
	}
	else
	{
		for(i = 0; i < MaxKeysPerLevel; ++i)
		{
			offset = screenRowStart[keyPositions[m_level][i].y]+keyPositions[m_level][i].x ;
			if(WorldEmpty != SCREEN_RAM[offset])
				incColourRamBy(offset, (i+1));
		}
	}
	
	if(!--m_airAmount)
		return ColDie;
	
	moveSprites();
	
	if(LEVEL_Solar_Power_Generator == m_level)
	 	buildPowerBeamPath();

	if(GSTATE_Demo != m_gameState)
		willyCollideBackground = moveWilly();
	
	renderFrame();
	
	if(willyCollideBackground || (willyCollideSprites = checkSpriteCollisions()))
	{
		if(willyCollideSprites & ColDoor)
			return ColDoor;
			
		return ColDie;
	}
	
	return ColNoCol;
}
Пример #22
0
bool AVISurface::handleEvents(CMovieEventList &events) {
	if (!isPlaying())
		return true;

	CMovieRangeInfo *info = _movieRangeInfo.front();
	_priorFrame = _currentFrame;
	_currentFrame += _isReversed ? -1 : 1;

	int newFrame = _currentFrame;
	if ((info->_isReversed && newFrame < info->_endFrame) ||
		(!info->_isReversed && newFrame > info->_endFrame)) {
		if (info->_isRepeat) {
			newFrame = info->_startFrame;
		} else {
			info->getMovieEnd(events);
			_movieRangeInfo.remove(info);
			delete info;

			if (_movieRangeInfo.empty()) {
				// No more ranges, so stop playback
				stop();
			} else {
				// Not empty, so move onto new first one
				info = _movieRangeInfo.front();
				newFrame = info->_startFrame;
				setReversed(info->_isReversed);
			}
		}
	}

	if (isPlaying()) {
		if (newFrame != getFrame()) {
			// The frame has been changed, so move to new position
			seekToFrame(newFrame);
			renderFrame();
		}

		// Get any events for the given position
		info->getMovieFrame(events, newFrame);
		return renderFrame();
	} else {
		return false;
	}
}
Пример #23
0
void MainWindow::doNextFrame()
{
    if (renderFrame()) {
        frame++;
        runItTimer->start();
    } else
        close();
    QString statusmsg = QString("Rendering photo %1 frame %2").arg(photo).arg(frame);
    ui->statusBar->showMessage(statusmsg, 5000);
}
Пример #24
0
/**
 * Just the current frame in the display.
 */
static void engine_draw_frame(struct engine* engine) {
    if (engine->display == NULL) {
        // No display.
        return;
    }

    renderFrame();

    eglSwapBuffers(engine->display, engine->surface);
}
Пример #25
0
JNIEXPORT int JNICALL Java_com_fbrs_electraengine_GL2JNILib_step(JNIEnv * env, jobject obj, jfloatArray rotate, jfloatArray translate)
{
	jboolean *isCopy;
	jfloat * rot = env->GetFloatArrayElements(rotate, isCopy);
	jfloat * trans = env->GetFloatArrayElements(translate, isCopy);
	renderFrame(glm::vec3((float)rot[0],(float) rot[1], (float)rot[2]), glm::vec3((float)trans[0], (float)trans[1], (float)trans[2]));
	env->ReleaseFloatArrayElements(rotate, rot, 0);
	env->ReleaseFloatArrayElements(translate, trans, 0);
	return EngineFlag();
}
Пример #26
0
	bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
	{
		BX_TRACE("PPAPI Interfaces");

		m_instance = _instance;
		m_instInterface = _instInterface;
		m_graphicsInterface = _graphicsInterface;
		m_instancedArrays = glGetInstancedArraysInterfacePPAPI();
		m_query = glGetQueryInterfacePPAPI();
		m_postSwapBuffers = _postSwapBuffers;

		int32_t attribs[] =
		{
			PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
			PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
			PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
			PP_GRAPHICS3DATTRIB_SAMPLES, 0,
			PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
			PP_GRAPHICS3DATTRIB_WIDTH, BGFX_DEFAULT_WIDTH,
			PP_GRAPHICS3DATTRIB_HEIGHT, BGFX_DEFAULT_HEIGHT,
			PP_GRAPHICS3DATTRIB_NONE
		};

		m_context = m_graphicsInterface->Create(m_instance, 0, attribs);
		if (0 == m_context)
		{
			BX_TRACE("Failed to create context!");
			return false;
		}

		m_instInterface->BindGraphics(m_instance, m_context);
		glSetCurrentContextPPAPI(m_context);
		m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);

		if (NULL != m_instancedArrays)
		{
			glVertexAttribDivisor   = naclVertexAttribDivisor;
			glDrawArraysInstanced   = naclDrawArraysInstanced;
			glDrawElementsInstanced = naclDrawElementsInstanced;
		}

		if (NULL != m_query)
		{
			glGenQueries          = naclGenQueries;
			glDeleteQueries       = naclDeleteQueries;
			glBeginQuery          = naclBeginQuery;
			glEndQuery            = naclEndQuery;
			glGetQueryObjectiv    = naclGetQueryObjectiv;
			glGetQueryObjectui64v = naclGetQueryObjectui64v;
		}

		// Prevent render thread creation.
		RenderFrame::Enum result = renderFrame();
		return RenderFrame::NoContext == result;
	}
Пример #27
0
void AVISurface::seekToFrame(uint frameNumber) {
	if ((int)frameNumber != getFrame()) {
		_decoders[0]->seekToFrame(frameNumber);
		if (_decoders[1])
			_decoders[1]->seekToFrame(frameNumber);

		_currentFrame = (int)frameNumber;
	}

	renderFrame();
}
Пример #28
0
void gameLoop(XStuff* xs, GameState* gs, InputState* is) {
	
	checkResize(xs,gs);
	
	preFrame(gs);
	
	handleInput(gs, is);
	
	setUpView(gs);
	
	// update world state
	
	
	// depth and picking pre-pass
	glDepthFunc(GL_LESS);
	glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	
	depthPrepass(xs, gs, is);
	
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
	glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer);
	
	checkCursor(gs, is);
	
	glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer);
	
	
	// clear color buffer for actual rendering
	//glClear(GL_COLOR_BUFFER_BIT);
	glerr("pre shader create 1d");
	glDepthFunc(GL_LEQUAL);
	glerr("pre shader create e");
	
	renderFrame(xs, gs, is);

	glBindFramebuffer(GL_FRAMEBUFFER, 0);
	glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer);
	
	
	// draw to the screen
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	
	shadingPass(gs);
	
	renderUI(xs, gs);
	
	gs->screen.resized = 0;
	
	glXSwapBuffers(xs->display, xs->clientWin);

}
Пример #29
0
void draw()
{
   //glViewport(0, 0, g_context.width, g_context.height);
   //glClear(GL_COLOR_BUFFER_BIT);

   renderFrame();
   // glUniform1f(g_context.u_time_loc, glutGet(GLUT_ELAPSED_TIME) / 1000.f);
   //glDrawArrays(GL_TRIANGLES, 0, 3);
   
   glutSwapBuffers();
}
Пример #30
0
int main(int argc, const char * argv[]) {
    initGL();
    loadShader();
    _scene.initialize("current_mesh_texture.ply");
    InputHandler inputHandler(_window, _window.GetInput(), &_camera);
    while (_window.IsOpened()) {
        inputHandler.handleInput();
        renderFrame();
        _window.Display();
    }
    return 0;
}