engine/EngineVideoLegacy2.c
/*	Grab six views for environment mapping tests
*/
Grab six views for environment mapping tests
Grab six views for environment mapping tests
void R_Envmap_f(void)
{
	uint8_t buffer[256*256*4];
	glDrawBuffer(GL_FRONT);
	glReadBuffer(GL_FRONT);
	r_refdef.bEnvironmentMap = true;
	r_refdef.vrect.x		=
	r_refdef.vrect.y		= 0;
	r_refdef.vrect.width	=
	r_refdef.vrect.height	= 256;
	Math_VectorClear(r_refdef.viewangles);
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile ("env0.rgb", buffer, sizeof(buffer));
	r_refdef.viewangles[1] = 90;
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile ("env1.rgb", buffer, sizeof(buffer));
	r_refdef.viewangles[1] = 180;
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile ("env2.rgb", buffer, sizeof(buffer));
	r_refdef.viewangles[1] = 270;
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile ("env3.rgb", buffer, sizeof(buffer));
	r_refdef.viewangles[0] = -90.0f;
	r_refdef.viewangles[1] = 0;
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile("env4.rgb", buffer, sizeof(buffer));
	r_refdef.viewangles[0] = 90;
	r_refdef.viewangles[1] = 0;
	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
	R_RenderView ();
	glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
	FileSystem_WriteFile("env5.rgb",buffer,sizeof(buffer));
	r_refdef.bEnvironmentMap = false;
	glDrawBuffer(GL_BACK);
	glReadBuffer(GL_BACK);
	GL_EndRendering();
}
void R_Envmap_f ( void ) { uint8_t buffer [ 256 * 256 * 4 ] ; glDrawBuffer ( GL_FRONT ) ; glReadBuffer ( GL_FRONT ) ; r_refdef . bEnvironmentMap = true ; r_refdef . vrect . x = r_refdef . vrect . y = 0 ; r_refdef . vrect . width = r_refdef . vrect . height = 256 ; Math_VectorClear ( r_refdef . viewangles ) ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . viewangles [ 1 ] = 90 ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . viewangles [ 1 ] = 180 ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . viewangles [ 1 ] = 270 ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . viewangles [ 0 ] = -90.0f ; r_refdef . viewangles [ 1 ] = 0 ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . viewangles [ 0 ] = 90 ; r_refdef . viewangles [ 1 ] = 0 ; GL_BeginRendering ( & glx , & gly , & glwidth , & glheight ) ; R_RenderView ( ) ; glReadPixels ( 0 , 0 , 256 , 256 , GL_RGBA , GL_UNSIGNED_BYTE , buffer ) ; FileSystem_WriteFile ( " " , buffer , sizeof ( buffer ) ) ; r_refdef . bEnvironmentMap = false ; glDrawBuffer ( GL_BACK ) ; glReadBuffer ( GL_BACK ) ; GL_EndRendering ( ) ; }
Grab six views for environment mapping tests
Grab six views for environment mapping tests