VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
makVrv::DtTextureInterface Class Referenceabstract

Interface for a texture. Used to pass in a texture to vrvGraphics.

Inheritance diagram for makVrv::DtTextureInterface:
Inheritance graph
[legend]

Public Member Functions

 DtTextureInterface ()
 
virtual ~DtTextureInterface ()
 
 DtTextureInterface (const DtTextureInterface &)=delete
 
DtTextureInterface & operator= (const DtTextureInterface &)=delete
 
virtual bool loadTextureFromFile (const std::string &fileName)=0
 
virtual bool allocateGpuStorage (const std::string &key, int width, int height)
 
virtual void setCpuBackingBuffer (const uint8_t *pixels)
 
virtual bool markCpuBackingBufferDirty ()
 
virtual bool enqueueSubRegion (int x, int y, int width, int height, const uint8_t *rgbaPixels)
 
virtual bool loadTextureFromFile (const std::string &fileName, const DtFileCache::LoadFileOptions &loadFileOptions)=0
 
virtual const std::string & filename () const =0
 
virtual float textureWidth () const =0
 
virtual void scaleTexture (int w, int h)=0
 
virtual bool getStipplePattern (char **stipplePattern)=0
 
virtual bool valid () const =0
 
virtual DtVector4< float > color (unsigned int x, unsigned int y) const =0
 

Constructor & Destructor Documentation

makVrv::DtTextureInterface::DtTextureInterface ( )

Constructor.

virtual makVrv::DtTextureInterface::~DtTextureInterface ( )
virtual

Destructor.

makVrv::DtTextureInterface::DtTextureInterface ( const DtTextureInterface &  )
delete

not allowed - copy constructor

Member Function Documentation

DtTextureInterface& makVrv::DtTextureInterface::operator= ( const DtTextureInterface &  )
delete

not allowed - equals operator

virtual bool makVrv::DtTextureInterface::loadTextureFromFile ( const std::string &  fileName)
pure virtual

Attempt to load a texture from file OSG overrides Returns true if loaded successfully // XXX TODO Add async loading.

Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.

virtual bool makVrv::DtTextureInterface::allocateGpuStorage ( const std::string &  key,
int  width,
int  height 
)
inlinevirtual

Allocate uninitialised GPU texture storage of the given dimensions. No pixel data is uploaded. After this call, use setCpuBackingBuffer() to attach a CPU-side pixel buffer and markCpuBackingBufferDirty() to trigger GPU upload of that buffer. Default implementation returns false.

Parameters
keyLogical name used as the filename key (no file is read).
widthTexture width in pixels.
heightTexture height in pixels.
Returns
True on success.

Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.

virtual void makVrv::DtTextureInterface::setCpuBackingBuffer ( const uint8_t *  pixels)
inlinevirtual

Attach a CPU-side pixel buffer that will be uploaded to the GPU on each call to markCpuBackingBufferDirty(). Caller retains ownership; pointer must remain valid for the lifetime of this texture. Only meaningful for textures created via allocateGpuStorage(). Default no-op.

Parameters
pixelsNon-owning pointer to the CPU pixel buffer.

Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.

virtual bool makVrv::DtTextureInterface::markCpuBackingBufferDirty ( )
inlinevirtual

Signal that the CPU backing buffer has changed and must be re-uploaded to the GPU on the next render frame. Default no-op. Requires that setCpuBackingBuffer() has been called previously.

Returns
True if the dirty flag was set successfully.

Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.

virtual bool makVrv::DtTextureInterface::enqueueSubRegion ( int  x,
int  y,
int  width,
int  height,
const uint8_t *  rgbaPixels 
)
inlinevirtual

Queue a sub-region upload for the next render frame.

Only the changed region is transferred to the GPU rather than the full texture, making this significantly cheaper than markCpuBackingBufferDirty() when only a small area has changed. Pixel data is copied immediately; the caller may reuse its buffer after return. Requires that allocateGpuStorage() has been called. Default implementation returns false.

Parameters
xLeft pixel offset of the region.
yTop pixel offset of the region (row 0 = visual top).
widthWidth of the region in pixels.
heightHeight of the region in pixels.
rgbaPixelsPointer to width * height * 4 bytes of RGBA data.
Returns
True if the upload was queued successfully.

Reimplemented in makVrv::DtGlTextureWrapper.

virtual bool makVrv::DtTextureInterface::loadTextureFromFile ( const std::string &  fileName,
const DtFileCache::LoadFileOptions &  loadFileOptions 
)
pure virtual
virtual const std::string& makVrv::DtTextureInterface::filename ( ) const
pure virtual

Returns the name of the file that the texture was created from. Returns "" by default, for example if the texture was not initialized.

Implemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.

virtual float makVrv::DtTextureInterface::textureWidth ( ) const
pure virtual
virtual void makVrv::DtTextureInterface::scaleTexture ( int  w,
int  h 
)
pure virtual
virtual bool makVrv::DtTextureInterface::getStipplePattern ( char **  stipplePattern)
pure virtual

Get the 32x32 stipple pattern representation of this texture.

Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.

virtual bool makVrv::DtTextureInterface::valid ( ) const
pure virtual

Returns whether or not this wrapper contains a valid texture.

Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.

virtual DtVector4<float> makVrv::DtTextureInterface::color ( unsigned int  x,
unsigned int  y 
) const
pure virtual

Returns color at a texel value.

Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.


The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)