osg.Image

class osg.Image
Represents:c++ class
Wraps:osg::Image
Bases:osg.BufferData

Image class for encapsulating the storage texture image data.

Constructors:

osg.Image()

Methods:

:setFileName(std.string fileName)

Parameters:fileName (std.string) –
:getFileName()

Return type:std.string
:computeNumComponents()

Return the size in bytes of a block of compressed pixels.

Return type:int
:width()

Width of image. Helper function internally calling osg::Image::s().

Return type:int
:height()

Return type:int
:depth()

Depth of image. Helper function internally calling osg::Image::r().

Return type:int
:swap(osg.Image rhs)

Swap the data and settings between two image objects.

Parameters:rhs (osg.Image) –
:scaleImage(int s, int t, int r)

Scale image to specified size.

Parameters:
  • s (int) –
  • t (int) –
  • r (int) –
:setOrigin(osg.Image.Origin origin)

Set the origin of the image. The default value is osg.Image.BOTTOM_LEFT and is consistent with OpenGL. osg.Image.TOP_LEFT is used for imagery that follows standard Imagery convention, such as movies, and hasn’t been flipped yet. For such images one much flip the t axis of the tex coords to handle this origin position.

Parameters:origin (osg.Image.Origin) –
:getOrigin()

Get the origin of the image.

Return type:osg.Image.Origin
:setPixelFormat(GLenum.Value format)

Parameters:format (GLenum.Value) –
:getPixelFormat()

Return type:GLenum.Value
:data()

Return type:uint64
:setDataType(GLenum.Value format)

Parameters:format (GLenum.Value) –
:getDataType()

Return type:GLenum.Value
:setInternalTextureFormat(GLenum.Value format)

Parameters:format (GLenum.Value) –
:getInternalTextureFormat()

Return type:GLenum.Value
:getColor(osg.Vec2 texcoords)

Get the color value for specified texcoord.

Parameters:texcoords (osg.Vec2) –
Return type:osg.Vec4
:getColor(double s, double t)

Parameters:
  • s (double) –
  • t (double) –
Return type:

osg.Vec4

:getColor(double s, double t, double r)

Parameters:
  • s (double) –
  • t (double) –
  • r (double) –
Return type:

osg.Vec4

:setColor(osg.Vec4 color, osg.Vec2 texcoords)

Set the color value for specified texcoord. Note texcoord is clamped to edge.

Parameters:
:setColor(osg.Vec4 color, double s, double t)

Short version. setColor call with 0 as r argument.

Parameters:
  • color (osg.Vec4) –
  • s (double) –
  • t (double) –
:setColor(osg.Vec4 color, double s, double t, double r)

Set the color value for specified texcoord.

Parameters:
  • color (osg.Vec4) –
  • s (double) –
  • t (double) –
  • r (double) –
:flipHorizontal()

Flip the image horizontally, around s dimension.

:flipVertical()

Flip the image vertically, around t dimension.

:supportsTextureSubloading()

Returns false for texture formats that do not support texture subloading.

Return type:bool
:isImageTranslucent()

Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized).

Return type:bool
:setPixelBufferObject(osg.PixelBufferObject buffer)

Set the optional osg.PixelBufferObject used to map the image memory efficiently to graphics memory.

Parameters:buffer (osg.PixelBufferObject) –
:getPixelBufferObject()

Get the osg.PixelBufferObject.

Return type:osg.PixelBufferObject
:requiresUpdateCall()

Return whether the update(NodeVisitor* nv) should be required on each frame to enable proper working of osg.Image.

Return type:bool
:setAllocationMode(osg.Image.AllocationMode mode)

Set the method used for deleting data once it goes out of scope.

Parameters:mode (osg.Image.AllocationMode) –
:getAllocationMode()

Get the method used for deleting data once it goes out of scope.

Return type:osg.Image.AllocationMode
:allocateImage(int s, int t, int r, GLenum.Value pixelFormat, GLenum.Value type, int packing)

Allocate a pixel block of specified size and type.

Parameters:
:allocateImage(int s, int t, int r, GLenum.Value pixelFormat, GLenum.Value type)

Short version. allocateImage call with 1 as packing argument.

Parameters:
:readPixels(int x, int y, int width, int height, GLenum.Value pixelFormat, GLenum.Value type)

Read pixels from current frame buffer at specified position and size, using glReadPixels (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glReadPixels.xml). Create memory for storage if required, reuse existing pixel coords if possible.

Parameters:
:copySubImage(int s_offset, int t_offset, int r_offset, osg.Image source)

Copy a source osg.Image into a subpart of this osg.Image at specified position. Typically used to copy to an already allocated image, such as creating a 3D image from a stack 2D images. If this Image is empty then image data is created to accommodate the source image in its offset position. If source is nil then no operation happens, this osg.Image is left unchanged.

Parameters:
  • s_offset (int) –
  • t_offset (int) –
  • r_offset (int) –
  • source (osg.Image) –