![]() |
VR-Forces Developer's Guide
|
Interface for a texture. Used to pass in a texture to vrvGraphics.

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 |
| makVrv::DtTextureInterface::DtTextureInterface | ( | ) |
Constructor.
|
virtual |
Destructor.
|
delete |
not allowed - copy constructor
|
delete |
not allowed - equals operator
|
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.
|
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.
| key | Logical name used as the filename key (no file is read). |
| width | Texture width in pixels. |
| height | Texture height in pixels. |
Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.
|
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.
| pixels | Non-owning pointer to the CPU pixel buffer. |
Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.
|
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.
Reimplemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.
|
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.
| x | Left pixel offset of the region. |
| y | Top pixel offset of the region (row 0 = visual top). |
| width | Width of the region in pixels. |
| height | Height of the region in pixels. |
| rgbaPixels | Pointer to width * height * 4 bytes of RGBA data. |
Reimplemented in makVrv::DtGlTextureWrapper.
|
pure virtual |
Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.
|
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.
|
pure virtual |
Implemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.
Implemented in makVrv::DtOsgTextureWrapper, and makVrv::DtGlTextureWrapper.
Get the 32x32 stipple pattern representation of this texture.
Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.
|
pure virtual |
Returns whether or not this wrapper contains a valid texture.
Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.
|
pure virtual |
Returns color at a texel value.
Implemented in makVrv::DtGlTextureWrapper, and makVrv::DtOsgTextureWrapper.