Definition at line 334 of file Carousel3D.h. Referenced by OglImCapture(). 00335 { 00336 if (oglIm->imData) 00337 free(oglIm->imData); 00338 00339 // Allocate memory for a 4 byte RGBA buffer 00340 if( !(oglIm->imData = (void *) malloc(w * h * 4))){ 00341 oglSys.ErrorBox("Error", "Could not allocate image memory"); 00342 exit( 0 );; 00343 } 00344 oglIm->w = w; 00345 oglIm->h = h; 00346 00347 // Specification of our image alignment 00348 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Contineous pixels 00349 glPixelStorei(GL_UNPACK_ROW_LENGTH, w); // Width of 1 line in our buffer 00350 glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 00351 glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); 00352 00353 glReadPixels( x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, oglIm->imData ); 00354 00355 glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 ); 00356 glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 ); 00357 glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ); 00358 oglIm->changed = 1; 00359 }
|