Image
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_IMAGE
#define OSG_IMAGE 1
#include <osg/BufferObject>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec3i>
#include <osg/Vec4>
#include <osg/FrameStamp>
#include <osg/StateAttribute>
#include <string>
#include <vector>
#ifndef GL_VERSION_1_2
// 1.2 definitions...
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#endif
#ifndef GL_COMPRESSED_ALPHA
#define GL_COMPRESSED_ALPHA 0x84E9
#define GL_COMPRESSED_LUMINANCE 0x84EA
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMPRESSED_RGB 0x84ED
#define GL_COMPRESSED_RGBA 0x84EE
#endif
#ifndef GL_ABGR_EXT
#define GL_ABGR_EXT 0x8000
#endif
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
#define GL_RED 0x1903
#define GL_GREEN 0x1904
#define GL_BLUE 0x1905
#define GL_DEPTH_COMPONENT 0x1902
#endif
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
#define GL_STENCIL_INDEX 0x1901
#endif
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
#define GL_ALPHA4 0x803B
#define GL_ALPHA8 0x803C
#define GL_ALPHA12 0x803D
#define GL_ALPHA16 0x803E
#define GL_BITMAP 0x1A00
#define GL_COLOR_INDEX 0x1900
#define GL_INTENSITY12 0x804C
#define GL_INTENSITY16 0x804D
#define GL_INTENSITY 0x8049
#define GL_INTENSITY4 0x804A
#define GL_INTENSITY8 0x804B
#define GL_LUMINANCE12 0x8041
#define GL_LUMINANCE12_ALPHA4 0x8046
#define GL_LUMINANCE12_ALPHA12 0x8047
#define GL_LUMINANCE16 0x8042
#define GL_LUMINANCE16_ALPHA16 0x8048
#define GL_LUMINANCE4 0x803F
#define GL_LUMINANCE4_ALPHA4 0x8043
#define GL_LUMINANCE6_ALPHA2 0x8044
#define GL_LUMINANCE8 0x8040
#define GL_LUMINANCE8_ALPHA8 0x8045
#define GL_RGBA8 0x8058
#define GL_RGBA16 0x805B
#define GL_PACK_ROW_LENGTH 0x0D02
#endif
#ifndef GL_PACK_SKIP_IMAGES
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
#define GL_UNPACK_SKIP_IMAGES 0x806D
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
#endif
#ifndef GL_OES_compressed_ETC1_RGB8_texture
#define GL_ETC1_RGB8_OES 0x8D64
#endif
#ifndef GL_ARB_ES3_compatibility
#define GL_COMPRESSED_RGB8_ETC2 0x9274
#define GL_COMPRESSED_SRGB8_ETC2 0x9275
#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
#define GL_COMPRESSED_R11_EAC 0x9270
#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
#define GL_COMPRESSED_RG11_EAC 0x9272
#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
#endif
#ifndef GL_KHR_texture_compression_astc_hdr
#define GL_KHR_texture_compression_astc_hdr 1
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
#endif /* GL_KHR_texture_compression_astc_hdr */
#ifndef GL_DEPTH_COMPONENT
#define GL_DEPTH_COMPONENT 0x1902
#endif
#ifndef GL_VERSION_1_4
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#endif
#ifndef GL_DEPTH_COMPONENT32F
#define GL_DEPTH_COMPONENT32F 0x8CAC
#endif
#ifndef GL_DEPTH_COMPONENT32F_NV
#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
#endif
namespace osg {
// forward declare
class NodeVisitor;
class OSG_EXPORT Image : public BufferData
{
public :
Image();
Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return new Image(); }
virtual Object* clone(const CopyOp& copyop) const { return new Image(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Image*>(obj)!=0; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Image"; }
virtual osg::Image* asImage() { return this; }
virtual const osg::Image* asImage() const { return this; }
virtual const GLvoid* getDataPointer() const { return data(); }
virtual unsigned int getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); }
virtual int compare(const Image& rhs) const;
void setFileName(const std::string& fileName);
inline const std::string& getFileName() const { return _fileName; }
enum WriteHint {
NO_PREFERENCE,
STORE_INLINE,
EXTERNAL_FILE
};
void setWriteHint(WriteHint writeHint) { _writeHint = writeHint; }
WriteHint getWriteHint() const { return _writeHint; }
enum AllocationMode {
NO_DELETE,
USE_NEW_DELETE,
USE_MALLOC_FREE
};
void setAllocationMode(AllocationMode mode) { _allocationMode = mode; }
AllocationMode getAllocationMode() const { return _allocationMode; }
virtual void allocateImage(int s,int t,int r,
GLenum pixelFormat,GLenum type,
int packing=1);
virtual void setImage(int s,int t,int r,
GLint internalTextureformat,
GLenum pixelFormat,GLenum type,
unsigned char* data,
AllocationMode mode,
int packing=1, int rowLength=0);
virtual void readPixels(int x,int y,int width,int height,
GLenum pixelFormat, GLenum type, int packing=1);
virtual void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type = GL_UNSIGNED_BYTE, unsigned int face = 0);
void swap(osg::Image& rhs);
void scaleImage(int s,int t,int r) { scaleImage(s,t,r, getDataType()); }
virtual void scaleImage(int s,int t,int r, GLenum newDataType);
virtual void copySubImage(int s_offset, int t_offset, int r_offset, const osg::Image* source);
enum Origin
{
BOTTOM_LEFT,
TOP_LEFT
};
void setOrigin(Origin origin) { _origin = origin; }
Origin getOrigin() const { return _origin; }
inline int s() const { return _s; }
inline int t() const { return _t; }
inline int r() const { return _r; }
void setRowLength(int length);
inline int getRowLength() const { return _rowLength; }
void setInternalTextureFormat(GLint internalFormat);
inline GLint getInternalTextureFormat() const { return _internalTextureFormat; }
void setPixelFormat(GLenum pixelFormat);
inline GLenum getPixelFormat() const { return _pixelFormat; }
void setDataType(GLenum dataType);
inline GLenum getDataType() const { return _dataType; }
void setPacking(unsigned int packing) { _packing = packing; }
inline unsigned int getPacking() const { return _packing; }
bool isCompressed() const;
inline void setPixelAspectRatio(float pixelAspectRatio) { _pixelAspectRatio = pixelAspectRatio; }
inline float getPixelAspectRatio() const { return _pixelAspectRatio; }
inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); }
inline unsigned int getRowSizeInBytes() const { return computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing); }
inline unsigned int getRowStepInBytes() const { return computeRowWidthInBytes(_rowLength==0?_s:_rowLength,_pixelFormat,_dataType,_packing); }
inline unsigned int getImageSizeInBytes() const { return getRowSizeInBytes()*_t; }
inline unsigned int getImageStepInBytes() const { return getRowStepInBytes()*_t; }
inline unsigned int getTotalSizeInBytes() const { return getImageSizeInBytes()*_r; }
unsigned int getTotalSizeInBytesIncludingMipmaps() const;
bool valid() const { return _s!=0 && _t!=0 && _r!=0 && _data!=0 && _dataType!=0; }
inline unsigned char* data() { return _data; }
inline const unsigned char* data() const { return _data; }
inline unsigned char* data(unsigned int column, unsigned int row = 0, unsigned int image = 0)
{
if (!_data) return NULL;
return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes();
}
inline const unsigned char* data(unsigned int column, unsigned int row = 0, unsigned int image = 0) const
{
if (!_data) return NULL;
return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes();
}
bool isDataContiguous() const { return _rowLength==0 || _rowLength==_s; }
class OSG_EXPORT DataIterator
{
public:
DataIterator(const Image* image);
DataIterator(const DataIterator& ri);
~DataIterator() {}
void operator ++ ();
bool valid() const { return _currentPtr!=0; }
const unsigned char* data() const { return _currentPtr; }
unsigned int size() const { return _currentSize; }
protected:
void assign();
const osg::Image* _image;
int _rowNum;
int _imageNum;
unsigned int _mipmapNum;
const unsigned char* _currentPtr;
unsigned int _currentSize;
};
Vec4 getColor(unsigned int s,unsigned t=0,unsigned r=0) const;
Vec4 getColor(const Vec2& texcoord) const { return getColor(Vec3(texcoord.x(),texcoord.y(),0.0f)); }
Vec4 getColor(const Vec3& texcoord) const;
void setColor(const osg::Vec4& color, unsigned int s, unsigned int t=0, unsigned int r=0);
void setColor(const osg::Vec4& color, const osg::Vec2& texcoord ) { setColor(color, osg::Vec3(texcoord, 0.0f)); }
void setColor(const osg::Vec4& color, const osg::Vec3& texcoord );
void flipHorizontal();
void flipVertical();
void flipDepth();
void ensureValidSizeForTexturing(GLint maxTextureSize);
static bool isPackedType(GLenum type);
static GLenum computePixelFormat(GLenum pixelFormat);
static GLenum computeFormatDataType(GLenum pixelFormat);
static osg::Vec3i computeBlockFootprint(GLenum pixelFormat);
static unsigned int computeBlockSize(GLenum pixelFormat, GLenum packing);
static unsigned int computeNumComponents(GLenum pixelFormat);
static unsigned int computePixelSizeInBits(GLenum pixelFormat,GLenum type);
static unsigned int computeRowWidthInBytes(int width,GLenum pixelFormat,GLenum type,int packing);
static unsigned int computeImageSizeInBytes(int width,int height, int depth, GLenum pixelFormat, GLenum type, int packing = 1, int slice_packing = 1, int image_packing = 1);
static int roudUpToMultiple(int s, int pack);
static int computeNearestPowerOfTwo(int s,float bias=0.5f);
static int computeNumberOfMipmapLevels(int s,int t = 1, int r = 1);
typedef std::vector< unsigned int > MipmapDataType;
inline bool isMipmap() const {return !_mipmapData.empty();};
unsigned int getNumMipmapLevels() const
{
return static_cast<unsigned int>(_mipmapData.size())+1;
};
inline void setMipmapLevels(const MipmapDataType& mipmapDataVector) { _mipmapData = mipmapDataVector; }
inline const MipmapDataType& getMipmapLevels() const { return _mipmapData; }
inline unsigned int getMipmapOffset(unsigned int mipmapLevel) const
{
if(mipmapLevel == 0)
return 0;
else if (mipmapLevel < getNumMipmapLevels())
return _mipmapData[mipmapLevel-1];
return 0;
};
inline unsigned char* getMipmapData(unsigned int mipmapLevel)
{
return _data+getMipmapOffset(mipmapLevel);
}
inline const unsigned char* getMipmapData(unsigned int mipmapLevel) const
{
return _data+getMipmapOffset(mipmapLevel);
}
bool supportsTextureSubloading() const;
virtual bool isImageTranslucent() const;
void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); }
PixelBufferObject* getPixelBufferObject() { return dynamic_cast<PixelBufferObject*>(getBufferObject()); }
const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(getBufferObject()); }
virtual bool requiresUpdateCall() const { return false; }
virtual void update(NodeVisitor* /*nv*/) {}
struct OSG_EXPORT UpdateCallback : public osg::StateAttributeCallback
{
virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv);
};
virtual bool sendFocusHint(bool /*focus*/) { return false; }
virtual bool sendPointerEvent(int /*x*/, int /*y*/, int /*buttonMask*/) { return false; }
virtual bool sendKeyEvent(int /*key*/, bool /*keyDown*/) { return false; }
virtual void setFrameLastRendered(const osg::FrameStamp* /*frameStamp*/) {}
class DimensionsChangedCallback : public osg::Referenced {
public:
DimensionsChangedCallback() : osg::Referenced() {}
virtual void operator()(osg::Image* image) = 0;
};
typedef std::vector< osg::ref_ptr<DimensionsChangedCallback> > DimensionsChangedCallbackVector;
void addDimensionsChangedCallback(DimensionsChangedCallback* cb);
void removeDimensionsChangedCallback(DimensionsChangedCallback* cb);
protected :
virtual ~Image();
Image& operator = (const Image&) { return *this; }
void handleDimensionsChangedCallbacks()
{
for(DimensionsChangedCallbackVector::iterator i = _dimensionsChangedCallbacks.begin(); i != _dimensionsChangedCallbacks.end(); ++i)
{
(*i)->operator()(this);
}
}
std::string _fileName;
WriteHint _writeHint;
Origin _origin;
int _s, _t, _r;
int _rowLength;
GLint _internalTextureFormat;
GLenum _pixelFormat;
GLenum _dataType;
unsigned int _packing;
float _pixelAspectRatio;
AllocationMode _allocationMode;
unsigned char* _data;
void deallocateData();
void setData(unsigned char* data,AllocationMode allocationMode);
MipmapDataType _mipmapData;
DimensionsChangedCallbackVector _dimensionsChangedCallbacks;
};
class Geode;
extern OSG_EXPORT Geode* createGeodeForImage(Image* image);
template<class T> Geode* createGeodeForImage(const ref_ptr<T>& image) { return createGeodeForImage(image.get()); }
extern OSG_EXPORT Geode* createGeodeForImage(Image* image, float s, float t);
template<class T> Geode* createGeodeForImage(const ref_ptr<T>& image, float s, float t) { return createGeodeForImage(image.get(), s, t); }
}
#endif // __SG_IMAGE_H
BufferObject
FrameStamp
StateAttribute
Vec2
Vec3
Vec3i
Vec4
osg::BufferData::getBufferObject
BufferObject * getBufferObject()
Definition BufferObject:529
osg::BufferData::BufferData
BufferData()
Definition BufferObject:498
osg::BufferData::setBufferObject
void setBufferObject(BufferObject *bufferObject)
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::FrameStamp
Definition FrameStamp:35
osg::Geode
Definition Geode:29
osg::Image::DataIterator::data
const unsigned char * data() const
Definition Image:389
osg::Image::DataIterator::_rowNum
int _rowNum
Definition Image:400
osg::Image::DataIterator::_imageNum
int _imageNum
Definition Image:401
osg::Image::DataIterator::_currentSize
unsigned int _currentSize
Definition Image:404
osg::Image::DataIterator::DataIterator
DataIterator(const Image *image)
osg::Image::DataIterator::_image
const osg::Image * _image
Definition Image:399
osg::Image::DataIterator::~DataIterator
~DataIterator()
Definition Image:380
osg::Image::DataIterator::valid
bool valid() const
Definition Image:386
osg::Image::DataIterator::assign
void assign()
osg::Image::DataIterator::DataIterator
DataIterator(const DataIterator &ri)
osg::Image::DataIterator::_currentPtr
const unsigned char * _currentPtr
Definition Image:403
osg::Image::DataIterator::size
unsigned int size() const
Definition Image:392
osg::Image::DataIterator::_mipmapNum
unsigned int _mipmapNum
Definition Image:402
osg::Image::DimensionsChangedCallback
Definition Image:534
osg::Image::DimensionsChangedCallback::DimensionsChangedCallback
DimensionsChangedCallback()
Definition Image:536
osg::Image::DimensionsChangedCallback::operator()
virtual void operator()(osg::Image *image)=0
osg::Image
Definition Image:179
osg::Image::setPixelBufferObject
void setPixelBufferObject(PixelBufferObject *buffer)
Definition Image:499
osg::Image::valid
bool valid() const
Definition Image:347
osg::Image::libraryName
virtual const char * libraryName() const
Definition Image:191
osg::Image::sendKeyEvent
virtual bool sendKeyEvent(int, bool)
Definition Image:529
osg::Image::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition Image:190
osg::Image::deallocateData
void deallocateData()
osg::Image::flipHorizontal
void flipHorizontal()
osg::Image::readPixels
virtual void readPixels(int x, int y, int width, int height, GLenum pixelFormat, GLenum type, int packing=1)
osg::Image::getRowSizeInBytes
unsigned int getRowSizeInBytes() const
Definition Image:327
osg::Image::setRowLength
void setRowLength(int length)
osg::Image::clone
virtual Object * clone(const CopyOp &copyop) const
Definition Image:189
osg::Image::getPixelBufferObject
PixelBufferObject * getPixelBufferObject()
Definition Image:502
osg::Image::getNumMipmapLevels
unsigned int getNumMipmapLevels() const
Definition Image:463
osg::Image::update
virtual void update(NodeVisitor *)
Definition Image:511
osg::Image::_mipmapData
MipmapDataType _mipmapData
Definition Image:579
osg::Image::isPackedType
static bool isPackedType(GLenum type)
osg::Image::Origin
Origin
Definition Image:274
osg::Image::TOP_LEFT
@ TOP_LEFT
Definition Image:276
osg::Image::BOTTOM_LEFT
@ BOTTOM_LEFT
Definition Image:275
osg::Image::getColor
Vec4 getColor(unsigned int s, unsigned t=0, unsigned r=0) const
osg::Image::removeDimensionsChangedCallback
void removeDimensionsChangedCallback(DimensionsChangedCallback *cb)
osg::Image::s
int s() const
Definition Image:291
osg::Image::setInternalTextureFormat
void setInternalTextureFormat(GLint internalFormat)
osg::Image::getColor
Vec4 getColor(const Vec2 &texcoord) const
Definition Image:411
osg::Image::setMipmapLevels
void setMipmapLevels(const MipmapDataType &mipmapDataVector)
Definition Image:469
osg::Image::setPacking
void setPacking(unsigned int packing)
Definition Image:311
osg::Image::getPixelBufferObject
const PixelBufferObject * getPixelBufferObject() const
Definition Image:505
osg::Image::_r
int _r
Definition Image:564
osg::Image::getImageStepInBytes
unsigned int getImageStepInBytes() const
Definition Image:338
osg::Image::t
int t() const
Definition Image:294
osg::Image::WriteHint
WriteHint
Definition Image:206
osg::Image::NO_PREFERENCE
@ NO_PREFERENCE
Definition Image:207
osg::Image::STORE_INLINE
@ STORE_INLINE
Definition Image:208
osg::Image::EXTERNAL_FILE
@ EXTERNAL_FILE
Definition Image:209
osg::Image::data
unsigned char * data(unsigned int column, unsigned int row=0, unsigned int image=0)
Definition Image:359
osg::Image::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition Image:198
osg::Image::sendFocusHint
virtual bool sendFocusHint(bool)
Definition Image:523
osg::Image::setDataType
void setDataType(GLenum dataType)
osg::Image::getMipmapOffset
unsigned int getMipmapOffset(unsigned int mipmapLevel) const
Definition Image:473
osg::Image::getAllocationMode
AllocationMode getAllocationMode() const
Definition Image:225
osg::Image::handleDimensionsChangedCallbacks
void handleDimensionsChangedCallbacks()
Definition Image:551
osg::Image::readImageFromCurrentTexture
virtual void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type=GL_UNSIGNED_BYTE, unsigned int face=0)
osg::Image::computeImageSizeInBytes
static unsigned int computeImageSizeInBytes(int width, int height, int depth, GLenum pixelFormat, GLenum type, int packing=1, int slice_packing=1, int image_packing=1)
osg::Image::scaleImage
virtual void scaleImage(int s, int t, int r, GLenum newDataType)
osg::Image::cloneType
virtual Object * cloneType() const
Definition Image:188
osg::Image::getDataType
GLenum getDataType() const
Definition Image:309
osg::Image::_rowLength
int _rowLength
Definition Image:565
osg::Image::computeFormatDataType
static GLenum computeFormatDataType(GLenum pixelFormat)
osg::Image::setOrigin
void setOrigin(Origin origin)
Definition Image:284
osg::Image::getPacking
unsigned int getPacking() const
Definition Image:312
osg::Image::AllocationMode
AllocationMode
Definition Image:215
osg::Image::NO_DELETE
@ NO_DELETE
Definition Image:216
osg::Image::USE_MALLOC_FREE
@ USE_MALLOC_FREE
Definition Image:218
osg::Image::USE_NEW_DELETE
@ USE_NEW_DELETE
Definition Image:217
osg::Image::computeNumberOfMipmapLevels
static int computeNumberOfMipmapLevels(int s, int t=1, int r=1)
osg::Image::ensureValidSizeForTexturing
void ensureValidSizeForTexturing(GLint maxTextureSize)
osg::Image::_t
int _t
Definition Image:564
osg::Image::_packing
unsigned int _packing
Definition Image:569
osg::Image::getOrigin
Origin getOrigin() const
Definition Image:287
osg::Image::copySubImage
virtual void copySubImage(int s_offset, int t_offset, int r_offset, const osg::Image *source)
osg::Image::getPixelAspectRatio
float getPixelAspectRatio() const
Definition Image:321
osg::Image::Image
Image(const Image &image, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::Image::setData
void setData(unsigned char *data, AllocationMode allocationMode)
osg::Image::getMipmapData
unsigned char * getMipmapData(unsigned int mipmapLevel)
Definition Image:482
osg::Image::computePixelFormat
static GLenum computePixelFormat(GLenum pixelFormat)
osg::Image::setColor
void setColor(const osg::Vec4 &color, unsigned int s, unsigned int t=0, unsigned int r=0)
osg::Image::getTotalSizeInBytesIncludingMipmaps
unsigned int getTotalSizeInBytesIncludingMipmaps() const
osg::Image::computeNumComponents
static unsigned int computeNumComponents(GLenum pixelFormat)
osg::Image::getTotalSizeInBytes
unsigned int getTotalSizeInBytes() const
Definition Image:341
osg::Image::_dimensionsChangedCallbacks
DimensionsChangedCallbackVector _dimensionsChangedCallbacks
Definition Image:581
osg::Image::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition Image:197
osg::Image::_data
unsigned char * _data
Definition Image:573
osg::Image::isCompressed
bool isCompressed() const
osg::Image::asImage
virtual const osg::Image * asImage() const
Definition Image:195
osg::Image::computeBlockSize
static unsigned int computeBlockSize(GLenum pixelFormat, GLenum packing)
osg::Image::~Image
virtual ~Image()
osg::Image::setPixelAspectRatio
void setPixelAspectRatio(float pixelAspectRatio)
Definition Image:318
osg::Image::getRowStepInBytes
unsigned int getRowStepInBytes() const
Definition Image:331
osg::Image::isImageTranslucent
virtual bool isImageTranslucent() const
osg::Image::_s
int _s
Definition Image:564
osg::Image::_origin
Origin _origin
Definition Image:562
osg::Image::_pixelAspectRatio
float _pixelAspectRatio
Definition Image:570
osg::Image::computePixelSizeInBits
static unsigned int computePixelSizeInBits(GLenum pixelFormat, GLenum type)
osg::Image::getWriteHint
WriteHint getWriteHint() const
Definition Image:213
osg::Image::getMipmapData
const unsigned char * getMipmapData(unsigned int mipmapLevel) const
Definition Image:487
osg::Image::sendPointerEvent
virtual bool sendPointerEvent(int, int, int)
Definition Image:526
osg::Image::setColor
void setColor(const osg::Vec4 &color, const osg::Vec2 &texcoord)
Definition Image:420
osg::Image::setColor
void setColor(const osg::Vec4 &color, const osg::Vec3 &texcoord)
osg::Image::asImage
virtual osg::Image * asImage()
Definition Image:194
osg::Image::getFileName
const std::string & getFileName() const
Definition Image:204
osg::Image::setPixelFormat
void setPixelFormat(GLenum pixelFormat)
osg::Image::flipDepth
void flipDepth()
osg::Image::flipVertical
void flipVertical()
osg::Image::getMipmapLevels
const MipmapDataType & getMipmapLevels() const
Definition Image:471
osg::Image::setFrameLastRendered
virtual void setFrameLastRendered(const osg::FrameStamp *)
Definition Image:532
osg::Image::className
virtual const char * className() const
Definition Image:192
osg::Image::supportsTextureSubloading
bool supportsTextureSubloading() const
osg::Image::setImage
virtual void setImage(int s, int t, int r, GLint internalTextureformat, GLenum pixelFormat, GLenum type, unsigned char *data, AllocationMode mode, int packing=1, int rowLength=0)
osg::Image::data
const unsigned char * data(unsigned int column, unsigned int row=0, unsigned int image=0) const
Definition Image:365
osg::Image::_fileName
std::string _fileName
Definition Image:559
osg::Image::compare
virtual int compare(const Image &rhs) const
osg::Image::setAllocationMode
void setAllocationMode(AllocationMode mode)
Definition Image:222
osg::Image::getImageSizeInBytes
unsigned int getImageSizeInBytes() const
Definition Image:334
osg::Image::computeRowWidthInBytes
static unsigned int computeRowWidthInBytes(int width, GLenum pixelFormat, GLenum type, int packing)
osg::Image::setWriteHint
void setWriteHint(WriteHint writeHint)
Definition Image:212
osg::Image::getInternalTextureFormat
GLint getInternalTextureFormat() const
Definition Image:303
osg::Image::computeNearestPowerOfTwo
static int computeNearestPowerOfTwo(int s, float bias=0.5f)
osg::Image::r
int r() const
Definition Image:297
osg::Image::setFileName
void setFileName(const std::string &fileName)
osg::Image::MipmapDataType
std::vector< unsigned int > MipmapDataType
Definition Image:459
osg::Image::_dataType
GLenum _dataType
Definition Image:568
osg::Image::data
unsigned char * data()
Definition Image:352
osg::Image::scaleImage
void scaleImage(int s, int t, int r)
Definition Image:258
osg::Image::_internalTextureFormat
GLint _internalTextureFormat
Definition Image:566
osg::Image::isMipmap
bool isMipmap() const
Definition Image:461
osg::Image::requiresUpdateCall
virtual bool requiresUpdateCall() const
Definition Image:508
osg::Image::getRowLength
int getRowLength() const
Definition Image:300
osg::Image::roudUpToMultiple
static int roudUpToMultiple(int s, int pack)
osg::Image::addDimensionsChangedCallback
void addDimensionsChangedCallback(DimensionsChangedCallback *cb)
osg::Image::_pixelFormat
GLenum _pixelFormat
Definition Image:567
osg::Image::swap
void swap(osg::Image &rhs)
osg::Image::getPixelFormat
GLenum getPixelFormat() const
Definition Image:306
osg::Image::computeBlockFootprint
static osg::Vec3i computeBlockFootprint(GLenum pixelFormat)
osg::Image::allocateImage
virtual void allocateImage(int s, int t, int r, GLenum pixelFormat, GLenum type, int packing=1)
osg::Image::data
const unsigned char * data() const
Definition Image:357
osg::Image::DimensionsChangedCallbackVector
std::vector< osg::ref_ptr< DimensionsChangedCallback > > DimensionsChangedCallbackVector
Definition Image:540
osg::Image::getColor
Vec4 getColor(const Vec3 &texcoord) const
osg::Image::_writeHint
WriteHint _writeHint
Definition Image:560
osg::Image::_allocationMode
AllocationMode _allocationMode
Definition Image:572
osg::Image::isDataContiguous
bool isDataContiguous() const
Definition Image:372
osg::Image::Image
Image()
osg::Image::getPixelSizeInBits
unsigned int getPixelSizeInBits() const
Definition Image:324
osg::NodeVisitor
Definition NodeVisitor:82
osg::Object
Definition Object:61
osg::PixelBufferObject
Definition BufferObject:668
osg::Referenced
Definition Referenced:44
osg::Referenced::Referenced
Referenced()
osg::StateAttributeCallback
Definition Callback:246
osg::StateAttribute
Definition StateAttribute:77
osg::Vec2f::x
value_type & x()
Definition Vec2f:67
osg::Vec2f::y
value_type & y()
Definition Vec2f:68
osg::Vec3i
Definition Vec3i:22
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osg
Definition AlphaFunc:19
osg::Vec2
Vec2f Vec2
Definition Vec2:21
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::createGeodeForImage
OSG_EXPORT Geode * createGeodeForImage(Image *image)
osg::Vec4
Vec4f Vec4
Definition Vec4:21
NULL
#define NULL
Definition osg/Export:55
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39
osg::Image::UpdateCallback
Definition Image:518