Esempio n. 1
0
/* 
================== 
GL_ScreenShot_f
================== 
*/  
void GL_ScreenShot_f (void) 
{
	byte		*buffer;
#ifdef WIN32
	DWORD tID;
#endif

	buffer = malloc(vid.width*vid.height*3);

	qglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer ); 
#ifdef WIN32
	if (!strcmp (ri.Cmd_Argv(1), "jpg"))
	{
		GL_ScreenShot_JPG (buffer);
	}
	else
	{
#ifdef USE_THREADS
		//_beginthreadex (NULL, 0, (unsigned int (__stdcall *)(void *))png_write_thread, (void *)buffer, 0, &tID);
		CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)png_write_thread, (LPVOID)buffer, 0, &tID);
		ri.Con_Printf (PRINT_ALL, "Taking PNG screenshot...\n");
#else
		png_write_thread (buffer);
#endif
	}
#else
	GL_ScreenShot_JPG (buffer);
#endif
} 
Esempio n. 2
0
/*
================== 
GL_ScreenShot_f
================== 
*/  
void GL_ScreenShot_f (void) 
{
	byte		*buffer;
#ifdef WIN32
	DWORD tID;
#endif

	buffer = (byte *) malloc(viddef.width*viddef.height*3);

	glReadPixels (0, 0, viddef.width, viddef.height, GL_RGB, GL_UNSIGNED_BYTE, buffer ); 
#if defined(_WIN32) && defined(USE_PNG)
	if (!strcmp (Cmd_Argv(1), "jpg"))
	{
		//GL_ScreenShot_JPG (buffer);
	}
	else
	{
#ifdef USE_THREADS
		//_beginthreadex (NULL, 0, (unsigned int (__stdcall *)(void *))png_write_thread, (void *)buffer, 0, &tID);
		CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)png_write_thread, (LPVOID)buffer, 0, &tID);
		VID_Printf (PRINT_ALL, "Taking PNG screenshot...\n");
#else  // USE_THREADS
		png_write_thread (buffer);
#endif  // USE_THREADS
	}
#else  // WIN32

#ifdef USE_JPEG

	GL_ScreenShot_JPG (buffer);

#else  // USE_JPEG

	VID_Printf (PRINT_ALL, "No JPEG support, no screenshot...\n");

#endif  // USE_JPEG

#endif  // WIN32
}