Bool imageBufferToTexture(CompScreen *screen, CompTexture *texture, const char *image, unsigned int width, unsigned int height) { #if IMAGE_BYTE_ORDER == MSBFirst return imageToTexture(screen, texture, image, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV); #else return imageToTexture(screen, texture, image, width, height, GL_BGRA, GL_UNSIGNED_BYTE); #endif }
virtual void execute () { assert (theater != NULL); assert (camouflage_file_name != ""); if (debug) std::fprintf (stderr, "Loading camouflage: %s ", camouflage_file_name.c_str ()); if (camouflages.find (camouflage_file_name) != camouflages.end ()) { if (debug) std::fprintf (stderr, "from cache.\n"); current_camouflage = camouflages [camouflage_file_name]; } else { if (debug) std::fprintf (stderr, "from file.\n"); if (! file_exists (camouflage_file_name)) { std::fprintf (stderr, "Cannot find camouflage %s. Line %i.\n", camouflage_file_name.c_str (), yylineno); exit (1); } osg::Image * image_from_file = osgDB::readImageFile (camouflage_file_name); osg::Texture2D * camouflage_from_file = imageToTexture(image_from_file); camouflages [camouflage_file_name] = camouflage_from_file; current_camouflage = camouflage_from_file; if (debug) std::fprintf (stderr, "Loaded.\n"); } }
Bool imageDataToTexture(CompScreen *screen, CompTexture *texture, const char *image, unsigned int width, unsigned int height, GLenum format, GLenum type) { return imageToTexture(screen, texture, image, width, height, format, type); }