/*	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();
}
Beispiel #2
0
void FtpClient_OnDataRead( FtpClient* pClient )
{
    assert( pClient );

    switch( pClient->m_eDataAction )
    {
    case DATAACTION_APPE:
    case DATAACTION_STOR:
    {
        // read data from socket

        int rv = recv(pClient->m_iDataSocket,buffer,pClient->m_uiDataBufferSize,0);

        if( rv > 0 )
        {
            // write data to file

            int sv = FileSystem_WriteFile( &pClient->m_kContext, buffer, rv );

            // write failed? then abort transfer

            if( sv <= 0 )
                FtpClient_OnDataFailed(pClient,  pClient->m_pMessages[FTPMSG_LOCAL_WRITE_FAILED] );
            else
                pClient->m_uiDataOffset += sv;
        }
        else
        {
            // connection has been lost, shut down transfer (this will happen when transfer completes)

            FtpClient_OnDataComplete(pClient,0,NULL);
        }
    }
    break;

    default:
        FtpClient_OnDataFailed(pClient,NULL);
        break;
    }
}