Ejemplo n.º 1
0
void CGraphics_SDL::Swap()
{
	if(m_DoScreenshot)
	{
		ScreenshotDirect(m_aScreenshotName);
		m_DoScreenshot = false;
	}

    if (m_fpCallback)
    {
        unsigned char *pPixelData = (unsigned char *)mem_alloc(m_ScreenWidth*(m_ScreenHeight+1)*3, 1);
        GLint Alignment;
        glGetIntegerv(GL_PACK_ALIGNMENT, &Alignment);
        glPixelStorei(GL_PACK_ALIGNMENT, 1);
        glReadPixels(0,0, m_ScreenWidth, m_ScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, pPixelData);
        glPixelStorei(GL_PACK_ALIGNMENT, Alignment);

        m_fpCallback(pPixelData, m_pCallbackUser);

        mem_free(pPixelData);
    }


	SDL_GL_SwapBuffers();

	if(g_Config.m_GfxFinish)
		glFinish();
}
Ejemplo n.º 2
0
void CGraphics_SDL::Swap()
{
	if(m_DoScreenshot)
	{
		// find filename
		char aFilename[128];
		static int Index = 1;

		time_t Time;
		char aDate[20];

		time(&Time);
		tm* TimeInfo = localtime(&Time);
		strftime(aDate, sizeof(aDate), "%Y-%m-%d_%I-%M", TimeInfo);

		for(; Index < 10000; Index++)
		{
			IOHANDLE io;
			str_format(aFilename, sizeof(aFilename), "screenshots/screenshot%s-%05d.png", aDate, Index);
			io = m_pStorage->OpenFile(aFilename, IOFLAG_READ);
			if(io)
				io_close(io);
			else
				break;
		}

		ScreenshotDirect(aFilename);
		m_DoScreenshot = false;
	}
	
	SDL_GL_SwapBuffers();
	
	if(g_Config.m_GfxFinish)
		glFinish();		
}
Ejemplo n.º 3
0
void CGraphics_SDL::Swap()
{
	if(m_DoScreenshot)
	{
		ScreenshotDirect(m_aScreenshotName);
		m_DoScreenshot = false;
	}
	
	SDL_GL_SwapBuffers();
	
	if(g_Config.m_GfxFinish)
		glFinish();		
}
Ejemplo n.º 4
0
void CGraphics_Threaded::Swap()
{
	// TODO: screenshot support
	if(m_DoScreenshot)
	{
		ScreenshotDirect(m_aScreenshotName);
		m_DoScreenshot = false;
	}

	// add swap command
	CCommandBuffer::SCommand_Swap Cmd;
	m_pCommandBuffer->AddCommand(Cmd);

	// kick the command buffer
	KickCommandBuffer();
}
Ejemplo n.º 5
0
void CGraphics_Threaded::Swap()
{
	// TODO: screenshot support
	if(m_DoScreenshot)
	{
		if(WindowActive())
			ScreenshotDirect(m_aScreenshotName);
		m_DoScreenshot = false;
	}

	// add swap command
	CCommandBuffer::SCommand_Swap Cmd;
	Cmd.m_Finish = g_Config.m_GfxFinish;
	m_pCommandBuffer->AddCommand(Cmd);

	// kick the command buffer
	KickCommandBuffer();
}