VTK  9.7.20260712
vtkOpenGLArrayTextureBufferAdapter Class Reference

Interfaces vtkDataArray to an OpenGL texture buffer. More...

#include <vtkOpenGLArrayTextureBufferAdapter.h>

Collaboration diagram for vtkOpenGLArrayTextureBufferAdapter:
[legend]

Public Member Functions

 vtkOpenGLArrayTextureBufferAdapter ()
 
 vtkOpenGLArrayTextureBufferAdapter (vtkDataArray *array, bool asScalars, bool *integerTexture=nullptr)
 
 vtkOpenGLArrayTextureBufferAdapter (const vtkOpenGLArrayTextureBufferAdapter &)=default
 
vtkOpenGLArrayTextureBufferAdapteroperator= (const vtkOpenGLArrayTextureBufferAdapter &)=default
 
void Upload (vtkOpenGLRenderWindow *renderWindow, bool force=false)
 
void ReleaseGraphicsResources (vtkWindow *window)
 
void SetUploaded (bool uploaded)
 Get/set the "already uploaded" guard.
 
bool GetUploaded () const
 Get/set the "already uploaded" guard.
 
void SetOwnsTexture (bool ownsTexture)
 Get/set who owns this adapter's Texture/Buffer.
 
bool GetOwnsTexture () const
 Get/set who owns this adapter's Texture/Buffer.
 
void SetPendingReset (bool pendingReset)
 Get/set the pending-reset flag used to recycle an adapter across rebuild cycles.
 
bool GetPendingReset () const
 Get/set the pending-reset flag used to recycle an adapter across rebuild cycles.
 

Public Attributes

std::vector< vtkSmartPointer< vtkDataArray > > Arrays
 
vtkSmartPointer< vtkTextureObjectTexture
 
vtkSmartPointer< vtkOpenGLBufferObjectBuffer
 
vtkOpenGLBufferObject::ObjectType BufferType
 
vtkOpenGLBufferObject::ObjectUsage BufferUsage
 
bool IntegerTexture
 
bool ScalarComponents
 

Detailed Description

Interfaces vtkDataArray to an OpenGL texture buffer.

The desktop OpenGL and GLES/WebGL2 upload paths are deliberately asymmetric because the two APIs store buffer-backed sampler data differently:

  • On desktop, a samplerBuffer is a real GL_TEXTURE_BUFFER, which OpenGL defines as a typed view over a buffer object: glTexBuffer binds the buffer's data store to the texture; there is no glTexImage* entry point for a buffer texture. The Buffer member is therefore the texture's actual storage (not a staging copy) and must outlive every fetch, so it is held for the lifetime of the texture rather than freed after upload. This keeps the flat texelFetch(samplerBuffer, int) indexing and the large GL_MAX_TEXTURE_BUFFER_SIZE limit.
  • On GLES/WebGL2 there is no GL_TEXTURE_BUFFER, so vtkTextureObject emulates it with an ordinary 2D texture that owns its storage and is filled directly from client memory via glTexImage2D (see vtkTextureObject::EmulateTextureBufferWith2DTexturesFromRaw). No buffer object is involved, so Buffer stays null on that path; the shader instead reconstructs a 1D index into the tiled 2D image.

Definition at line 44 of file vtkOpenGLArrayTextureBufferAdapter.h.

Constructor & Destructor Documentation

◆ vtkOpenGLArrayTextureBufferAdapter() [1/3]

vtkOpenGLArrayTextureBufferAdapter::vtkOpenGLArrayTextureBufferAdapter ( )

◆ vtkOpenGLArrayTextureBufferAdapter() [2/3]

vtkOpenGLArrayTextureBufferAdapter::vtkOpenGLArrayTextureBufferAdapter ( vtkDataArray * array,
bool asScalars,
bool * integerTexture = nullptr )

◆ vtkOpenGLArrayTextureBufferAdapter() [3/3]

vtkOpenGLArrayTextureBufferAdapter::vtkOpenGLArrayTextureBufferAdapter ( const vtkOpenGLArrayTextureBufferAdapter & )
default

Member Function Documentation

◆ operator=()

vtkOpenGLArrayTextureBufferAdapter & vtkOpenGLArrayTextureBufferAdapter::operator= ( const vtkOpenGLArrayTextureBufferAdapter & )
default

◆ Upload()

void vtkOpenGLArrayTextureBufferAdapter::Upload ( vtkOpenGLRenderWindow * renderWindow,
bool force = false )

◆ ReleaseGraphicsResources()

void vtkOpenGLArrayTextureBufferAdapter::ReleaseGraphicsResources ( vtkWindow * window)

◆ SetUploaded()

void vtkOpenGLArrayTextureBufferAdapter::SetUploaded ( bool uploaded)
inline

Get/set the "already uploaded" guard.

When true, Upload() skips the GPU transfer unless forced; callers clear it (SetUploaded(false)) whenever the bound array list changes to request a re-upload. It is the GLES-safe replacement for the old Buffer->IsReady() check, since on GLES the data goes straight into the texture and no buffer object is kept around to query. The setter does not call Modified().

Definition at line 74 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ GetUploaded()

bool vtkOpenGLArrayTextureBufferAdapter::GetUploaded ( ) const
inline

Get/set the "already uploaded" guard.

When true, Upload() skips the GPU transfer unless forced; callers clear it (SetUploaded(false)) whenever the bound array list changes to request a re-upload. It is the GLES-safe replacement for the old Buffer->IsReady() check, since on GLES the data goes straight into the texture and no buffer object is kept around to query. The setter does not call Modified().

Definition at line 75 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ SetOwnsTexture()

void vtkOpenGLArrayTextureBufferAdapter::SetOwnsTexture ( bool ownsTexture)
inline

Get/set who owns this adapter's Texture/Buffer.

True (the default) means the adapter owns them: it allocates them, may partially re-upload in place, and releases them in ReleaseGraphicsResources(). False means they are borrowed from a shared vtkOpenGLArrayTextureBufferCache entry that owns their lifetime; the adapter only references them and never frees or partially rewrites them. Upload() sets this automatically per call (false when it routes a single array through the cache, true otherwise). The setter does not call Modified().

Definition at line 88 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ GetOwnsTexture()

bool vtkOpenGLArrayTextureBufferAdapter::GetOwnsTexture ( ) const
inline

Get/set who owns this adapter's Texture/Buffer.

True (the default) means the adapter owns them: it allocates them, may partially re-upload in place, and releases them in ReleaseGraphicsResources(). False means they are borrowed from a shared vtkOpenGLArrayTextureBufferCache entry that owns their lifetime; the adapter only references them and never frees or partially rewrites them. Upload() sets this automatically per call (false when it routes a single array through the cache, true otherwise). The setter does not call Modified().

Definition at line 89 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ SetPendingReset()

void vtkOpenGLArrayTextureBufferAdapter::SetPendingReset ( bool pendingReset)
inline

Get/set the pending-reset flag used to recycle an adapter across rebuild cycles.

vtkDrawTexturedElements::BeginArrayRebuild() sets it on every adapter; the first Bind/Append of the new cycle then drops the stale source-array list (keeping the GL texture/buffer and layout records so the next Upload() can diff against them) and clears the flag. An adapter still flagged after the cycle was not re-listed this frame, so draw-time loops skip it rather than upload/activate a now-stale array. The setter does not call Modified().

Definition at line 101 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ GetPendingReset()

bool vtkOpenGLArrayTextureBufferAdapter::GetPendingReset ( ) const
inline

Get/set the pending-reset flag used to recycle an adapter across rebuild cycles.

vtkDrawTexturedElements::BeginArrayRebuild() sets it on every adapter; the first Bind/Append of the new cycle then drops the stale source-array list (keeping the GL texture/buffer and layout records so the next Upload() can diff against them) and clears the flag. An adapter still flagged after the cycle was not re-listed this frame, so draw-time loops skip it rather than upload/activate a now-stale array. The setter does not call Modified().

Definition at line 102 of file vtkOpenGLArrayTextureBufferAdapter.h.

Member Data Documentation

◆ Arrays

std::vector<vtkSmartPointer<vtkDataArray> > vtkOpenGLArrayTextureBufferAdapter::Arrays

Definition at line 47 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ Texture

vtkSmartPointer<vtkTextureObject> vtkOpenGLArrayTextureBufferAdapter::Texture

Definition at line 48 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ Buffer

vtkSmartPointer<vtkOpenGLBufferObject> vtkOpenGLArrayTextureBufferAdapter::Buffer

Definition at line 49 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ BufferType

vtkOpenGLBufferObject::ObjectType vtkOpenGLArrayTextureBufferAdapter::BufferType

Definition at line 50 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ BufferUsage

vtkOpenGLBufferObject::ObjectUsage vtkOpenGLArrayTextureBufferAdapter::BufferUsage

Definition at line 51 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ IntegerTexture

bool vtkOpenGLArrayTextureBufferAdapter::IntegerTexture

Definition at line 52 of file vtkOpenGLArrayTextureBufferAdapter.h.

◆ ScalarComponents

bool vtkOpenGLArrayTextureBufferAdapter::ScalarComponents

Definition at line 53 of file vtkOpenGLArrayTextureBufferAdapter.h.


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