|
本帖最后由 oirrm 于 2014-6-7 09:36 编辑
- osg::ref_ptr<osg::Image> image = new osg::Image;
- image->setImage(WidthSize,HeightSize,1,
- GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE,
- new unsigned char[4* WidthSize *HeightSize],
- osg::Image::USE_NEW_DELETE);
- unsigned char* ptr = image->data();
- memset(ptr,0,4 * WidthSize * HeightSize);
- for(int i = 0 ; i < HeightSize; i++)
- {
- for(int j = 0; j < WidthSize ; j++)
- {
- *(ptr ) = 255;
- *(ptr + 1) = 0;
- *(ptr + 2) = 255;
- *(ptr + 3) = 255;
- }
- }
- osgDB::writeImageFile(*image,"E:\\rect.png");
复制代码 |
|