Ejemplo n.º 1
0
// FlowField2D constructor
int FlowField2D::SaveFlowField2D(char* filename){
    int   fd_g,pf;
    ostream*     o_stream = &cout;
    ofstream*    f_stream = (ofstream*)(o_stream);
    
    ssize_t max_write = 1024L*1024L*1024L;                                                                                                      
    ssize_t one_write = 0L;                                                                                                                     
    ssize_t len  = 0L;                                                                                                                        
    off_t  off = 0L;                                                                                                                           
    LoadSwapFile2D(filename,GetX(),GetY(),sizeof(FlowNode2D< FP, NUM_COMPONENTS>),&pf,&fd_g,f_stream);
    char*  TmpPtr=(char*)GetMatrixPtr();                                                                                                             
    if(GetMatrixSize() > max_write) {                                                                                                                 
        for(off = 0L,one_write = max_write; len < GetMatrixSize(); off += max_write) {                                                                
           len += pwrite64(fd_g,TmpPtr+off,one_write,off);                                                                                       
           if(GetMatrixSize() - len < max_write)                                                                                                      
             one_write = GetMatrixSize() - len;                                                                                                       
           }                                                                                                                                   
          if(len != GetMatrixSize())                                                                                                                    
          *f_stream << "Error: len(" << len << ") != MatrixSize(" << GetMatrixSize() << ") " << endl << flush;                                               
    } else {                                                                                                                                   
        len = pwrite64(fd_g,GetMatrixPtr(),GetMatrixSize(),0L);                                                                                               
    }
    close(fd_g);
    return len;
}
Ejemplo n.º 2
0
void XShader::SetShader( const MATRIX& mMVP,
						float r, float g, float b, float a )
{
	
	glUseProgram( m_glProgram );
	glUniformMatrix4fv( m_locUniforms[UNIFORM_MVP_MATRIX], 1, 0, GetMatrixPtr( mMVP ) );
	if( m_locUniforms[UNIFORM_COLOR] >= 0 )
		glUniform4f( m_locUniforms[UNIFORM_COLOR], r, g, b, a );
}
Ejemplo n.º 3
0
void XShader::SetUniformMVP( const MATRIX& mMVP )
{
	
	glUseProgram( m_glProgram );
	glUniformMatrix4fv( m_locUniforms[UNIFORM_MVP_MATRIX], 1, 0, GetMatrixPtr( mMVP ) );
}