void Shader::Init(const char *name, const Defines &defines, const Constants &constants) { string sn(name); sn += GetExtension(); StringReplace(sn, "\\", "/"); ifstream in(sn, ifstream::in); if(in) { stringstream strStream; strStream << in.rdbuf(); string source(strStream.str()); source.erase(source.find_last_of('}')+1, source.length()); InsertDefines(source, defines); InsertConstants(source, constants); const string path = sn.substr(0, sn.find_last_of("/") + 1); ExpandIncludes(path, source); FindUniformBlocks(source); AddHeader(source); Init2(source.c_str(), name); } else { LOG(ERROR) << "[Shader::Init] No shader file found: " << sn; } in.close(); }
/************************************************* Function: main Description: 主函数 Calls: scanf printf Called By: 编译器 Input: 无 Output: 无 Return: 0 *************************************************/ int main(void) { int a[2][3]; int b[3][2]; int res[2][2] = {0}; Init1(a); Init2(b); //Output(res); Mul(a, b, res); Output(res); }
int CDecoderVideo::Init(JNIEnv* env, int iWidth, int iHeight){ int iRet=0; _icnt=0; int min_stride = ((iWidth + 15) & (~15)); int min_sliceheight = ((iHeight + 15) & (~15)); int iSizeOut = (min_sliceheight * min_stride * 3) >> 1; m_byDecoded = env->NewByteArray(iSizeOut); m_pbyDecoded = env->GetByteArrayElements(m_byDecoded, 0); m_iRGB = env->NewIntArray(iWidth*iHeight); m_piRGB = env->GetIntArrayElements(m_iRGB, 0); _pCC = (ColorConvert32*)ColorConvert32::NewL(); if (!(_pCC->Init((iWidth + 1)&(~1), (iHeight + 1)&(~1), (iWidth + 1)&(~1), iWidth, (iHeight + 1)&(~1), (iWidth + 1)&(~1), CCROTATE_NONE))) // if (!(_pCC->Init(iWidth, iHeight, iWidth, iWidth, iHeight, iWidth, CCROTATE_NONE))) { // Color converter failed Init __android_log_write(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "Color Conversion Failed"); return iRet; } //_pCC->SetYuvFullRange(true); _pCC->SetMemHeight((iHeight+1)&(~1)); _pCC->SetMode(0); // Do not scaling uint32 rgbbufsize = (uint32)(_pCC->GetOutputBufferSize()); m_byRGB = env->NewByteArray(rgbbufsize); __android_log_print(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "SizeBuffer Color:%d", rgbbufsize); m_pbyRGB = env->GetByteArrayElements(m_byRGB, 0); _pvDec = PVM4VDecoder::New(); if (_pvDec!=NULL){ int32 iSize =0; _H263Header = NULL;//(uint8*)oscl_malloc(iSize); int iMode = H263_MODE; //int iret = GetVideoHeader(1, _H263Header, iSize); //__android_log_print(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "GetVideoHeader:%d", iret); //_pvDec->InitVideoDecoder(&_H263Header, &iSize, 1, (int32*)&iWidth, (int32*)&iHeight, &iMode); bool bRes = Init2(&_H263Header, &iSize, 1, (int32*)&iWidth, (int32*)&iHeight, &iMode); if (!bRes){ __android_log_write(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "Failed"); return false; } /*_pvDec->SetPostProcType(0); _pvDec->SetReferenceYUV((uint8*)m_pbyDecoded); */ __android_log_write(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "Initialized"); iRet=1; } else __android_log_write(ANDROID_LOG_DEBUG, "CDecoderVideo::Init", "Can't alloc encoder"); return iRet; }
Host::Host(unsigned long BAUD, int port_in) : rxring(HOST_RECV_BUFSIZE, rxbuf), txring(HOST_SEND_BUFSIZE, txbuf) { input_ready = 0; port = port_in; #ifdef HIGHPORTS #ifdef HAS_BT if(port == 2) Init2(BAUD); else #endif #endif Init0(BAUD); }
bool wxPropertyGridManager::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxChar* name ) { bool res = wxPanel::Create( parent, id, pos, size, (style&0xFFFF0000)|wxWANTS_CHARS, name ); Init2(style); return res; }
int main(int argc, char *argv[]){ glutInit(&argc, argv); glutInitWindowPosition(100, 100); glutInitWindowSize(300, 300); glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE); win1 = glutCreateWindow("OpenGL Practica 2_2 window 1 Laura del Pino Díaz"); Init1(); glutDisplayFunc(Display1); // define la funcion de rendering glutMouseFunc(MouseVentana1); win1 = glutCreateWindow("OpenGL Practica 2_2 window 1 Laura del Pino Díaz"); Init2(); glutDisplayFunc(Display2); // define la funcion de rendering glutMouseFunc(MouseVentana2); glutMainLoop(); return 0; }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB); glutInitWindowSize(WinWid, WinHei); glutInitWindowPosition(100, 200); int hwnd = glutCreateWindow("Lesson 15 2"); glutKeyboardFunc(Keyboard); glutDisplayFunc(Draw); glutTimerFunc(50, Timer, 0); Init(); glutInitWindowSize(WinWid2, WinHei2); glutInitWindowPosition(150, 250); int hwnd2 = glutCreateWindow("Window"); glutDisplayFunc(Draw2); //glutTimerFunc(50, Timer, 1); glutSetWindow(hwnd); glutReshapeWindow(500, 300); glutPositionWindow(200, 100); glutSetWindow(hwnd2); Init2(); glutSetWindow(hwnd); glutReshapeWindow(400, 400); //glutHideWindow(); //glutIconifyWindow(); //glutShowWindow(); //glutFullScreen(); glutSetCursor(GLUT_CURSOR_DESTROY); glutMainLoop(); return 0; }
bool VDCallbackTimer::Init(IVDTimerCallback *pCB, uint32 period_ms) { return Init2(pCB, period_ms * 10000); }
int main( int argc, char *argv[] ) { char *height_name; char *edge_name; tga_t *heightmap; tga_t *edgemap; int i, j; int num; FILE *h; printf( "===== envpot - build and optimize a environment data =====\n" ); SetCmdArgs( argc, argv ); height_name = GetCmdOpt2( "-h" ); edge_name = GetCmdOpt2( "-e" ); if ( !height_name ) Error( "no heightmap.\n" ); if ( !edge_name ) Error( "no edgemap.\n" ); h = fopen( height_name, "r" ); if ( !h ) Error( "can't open heightmap.\n" ); heightmap = TGA_Read( h ); fclose( h ); h = fopen( edge_name, "r" ); if ( !h ) Error( "can't open edgemap.\n" ); edgemap = TGA_Read( h ); fclose( h ); InitEdgeMap( edgemap ); // InitHeightMap( heightmap ); // SetupCells(); #if 0 num = 0; for ( i = 0; i < 10; i++ ) { for ( j = 0; j < 10; j++ ) { // Vec3dInit( vertices[num++], (random()%1000)/1000.0, 0.0, (random()%1000)/1000.0 ); Vec3dInit( vertices[num++], j/10.0, 0.0, i/10.0 ); } } for ( i = 0; i < 5; i++ ) { for ( j = 0; j < 5; j++ ) { // Vec3dInit( vertices[num++], (random()%1000)/1000.0, 0.0, (random()%1000)/1000.0 ); Vec3dInit( vertices[num++], 0.05+j/10.0, 0.0, 0.05+i/10.0 ); } } vertexnum = num; #endif // Vec2dInit( vertices[0].v, 0.0, 0.0 ); // Vec2dInit( vertices[1].v, 0.0, 1.0 ); // Vec2dInit( vertices[2].v, -1.0, 0.5 ); // Vec2dInit( vertices[3].v, 1.0, 0.5 ); // Vec2dInit( vertices[4].v, 2.0, 0.5 ); // vertexnum = 5; Init2(); handle = fopen( "env_tris", "w" ); Test2(); fprintf( handle, "end" ); fclose( handle ); handle = fopen( "env_vertices", "w" ); WriteVertices(); fclose( handle ); }