/*! \brief Returns the GL buffer associated with the Attribute * data. */ inline magnet::GL::Buffer<GLfloat>& getBuffer() { //Initialise on demand if (!_glData.size()) initGLData(); _usedInCurrentRender = true; return _glData; }
void LLCubeMap::init(const std::vector<LLPointer<LLImageRaw> >& rawimages) { if (!gGLManager.mIsDisabled) { initGL(); initRawData(rawimages); initGLData(); } }
int main( int argc, char** argv ) { bool setQuit = false; int capWidth = gw; int capHeight = gh; state.use_IPP = false; state.bqatest = false; unsigned int devN = 0; if( shrGetCmdLineArgumentu(argc, (const char **)argv, "device", &devN ) ) { printf("Using device %d\n", devN); } if( shrCheckCmdLineFlag( argc, (const char **)argv, "qatest") ) { printf("QA test mode.\n"); capture = NULL; state.bqatest = true; } else { printf("Attempting to initialize camera\n"); if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 ); else if( argc == 2 ) capture = cvCaptureFromAVI( argv[1] ); } if( !capture ) { fprintf(stderr,"Could not initialize capturing...\n"); fprintf(stderr,"Attempting to use PGM files..\n"); } else { printf("Camera Initialized\n"); printf("Setting Size\n"); #ifdef _MSC_VER Sleep(5000); #else sleep(5); // pause 5 seconds before setting size on Mac , otherwise unstable #endif cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, gw); cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, gh); } initGlut(argc,argv, gw, gh); initGLData(gw, gh, NULL); // Initialize openCL // loads the CL functions from the .cl files // also loads reference images../data/minicooper/frame10.pgm clCtx = initOCLFlow(vbo,devN); if( !capture ) { if( images[0].w != gw || images[0].h != gh || images[1].w != gw || images[1].h != gh ) { fprintf(stderr, "Bad image sizes supplied. Please use %d x %d images\n", gw, gh ); } // load the file into the texture (actually initOCLFLow loaded them into GPU but discarded them // so this is justa quick way to load them into the texture as well) unsigned int w, h; unsigned char *image_ub = NULL; shrLoadPGMub( "data/minicooper/frame10.pgm", (unsigned char **)&image_ub, &w, &h ); glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex); glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, gw, gh, GL_LUMINANCE, GL_UNSIGNED_BYTE, image_ub ); } glutMainLoop(); return 0; }