VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkQWidgetTexture Class Reference

Allows a QWidget to be used as a texture in VTK with OpenGL. More...

#include <vtkQWidgetTexture.h>

Inheritance diagram for vtkQWidgetTexture:
[legend]
Collaboration diagram for vtkQWidgetTexture:
[legend]

Public Types

typedef vtkTextureObject Superclass
 
- Public Types inherited from vtkTextureObject
enum  {
  Lequal = 0, Gequal, Less, Greater,
  Equal, NotEqual, AlwaysTrue, Never,
  NumberOfDepthTextureCompareFunctions
}
 
enum  {
  ClampToEdge = 0, Repeat, MirroredRepeat, ClampToBorder,
  NumberOfWrapModes
}
 
enum  {
  Nearest = 0, Linear, NearestMipmapNearest, NearestMipmapLinear,
  LinearMipmapNearest, LinearMipmapLinear, NumberOfMinificationModes
}
 
enum  {
  Native = 0, Fixed8, Fixed16, Fixed24,
  Fixed32, Float16, Float32, NumberOfDepthFormats
}
 
typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkQWidgetTextureNewInstance () const
 
void SetWidget (QWidget *w)
 Set/Get the QWidget that this TextureObject will render/use. More...
 
QWidget * GetWidget ()
 
QGraphicsScene * GetScene ()
 get the QScene used for rendering, this is where events will be forwarded to. More...
 
void Activate () override
 Activate and Bind the texture. More...
 
void ReleaseGraphicsResources (vtkWindow *win) override
 Free resources. More...
 
- Public Member Functions inherited from vtkTextureObject
vtkTextureObjectNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
void SetContext (vtkOpenGLRenderWindow *)
 Get/Set the context. More...
 
vtkOpenGLRenderWindowGetContext ()
 
virtual unsigned int GetWidth ()
 Get the texture dimensions. More...
 
virtual unsigned int GetHeight ()
 
virtual unsigned int GetDepth ()
 
virtual unsigned int GetSamples ()
 
virtual int GetComponents ()
 
unsigned int GetTuples ()
 
virtual int GetNumberOfDimensions ()
 
virtual void SetSamples (unsigned int)
 
virtual unsigned int GetTarget ()
 Returns OpenGL texture target to which the texture is/can be bound. More...
 
virtual unsigned int GetHandle ()
 Returns the OpenGL handle. More...
 
int GetTextureUnit ()
 Return the texture unit used for this texture. More...
 
void Bind ()
 Bind the texture, must have been created using Create(). More...
 
void Deactivate ()
 Deactivate and UnBind the texture. More...
 
bool IsBound ()
 Tells if the texture object is bound to the active texture image unit. More...
 
void SendParameters ()
 Send all the texture object parameters to the hardware if not done yet. More...
 
virtual void SetAutoParameters (int)
 
virtual int GetAutoParameters ()
 
bool Create2DFromRaw (unsigned int width, unsigned int height, int numComps, int dataType, void *data)
 Create a 2D texture from client memory numComps must be in [1-4]. More...
 
bool CreateDepthFromRaw (unsigned int width, unsigned int height, int internalFormat, int rawType, void *raw)
 Create a 2D depth texture using a raw pointer. More...
 
bool CreateTextureBuffer (unsigned int numValues, int numComps, int dataType, vtkOpenGLBufferObject *bo)
 Create a texture buffer basically a 1D texture that can be very large for passing data into the fragment shader. More...
 
bool CreateCubeFromRaw (unsigned int width, unsigned int height, int numComps, int dataType, void *data[6])
 Create a cube texture from 6 buffers from client memory. More...
 
bool Create1D (int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
 Create a 1D texture using the PBO. More...
 
bool Create1DFromRaw (unsigned int width, int numComps, int dataType, void *data)
 Create 1D texture from client memory. More...
 
bool Create2D (unsigned int width, unsigned int height, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
 Create a 2D texture using the PBO. More...
 
bool Create3D (unsigned int width, unsigned int height, unsigned int depth, int numComps, vtkPixelBufferObject *pbo, bool shaderSupportsTextureInt)
 Create a 3D texture using the PBO. More...
 
bool Create3DFromRaw (unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType, void *data)
 Create a 3D texture from client memory numComps must be in [1-4]. More...
 
bool AllocateProxyTexture3D (unsigned int const width, unsigned int const height, unsigned int const depth, int const numComps, int const dataType)
 Create a 3D texture using the GL_PROXY_TEXTURE_3D target. More...
 
vtkPixelBufferObjectDownload ()
 This is used to download raw data from the texture into a pixel buffer. More...
 
vtkPixelBufferObjectDownload (unsigned int target, unsigned int level)
 
bool CreateDepth (unsigned int width, unsigned int height, int internalFormat, vtkPixelBufferObject *pbo)
 Create a 2D depth texture using a PBO. More...
 
bool AllocateDepth (unsigned int width, unsigned int height, int internalFormat)
 Create a 2D depth texture but does not initialize its values. More...
 
bool AllocateDepthStencil (unsigned int width, unsigned int height)
 Create a 2D septh stencil texture but does not initialize its values. More...
 
bool Allocate1D (unsigned int width, int numComps, int vtkType)
 Create a 1D color texture but does not initialize its values. More...
 
bool Allocate2D (unsigned int width, unsigned int height, int numComps, int vtkType, int level=0)
 Create a 2D color texture but does not initialize its values. More...
 
bool Allocate3D (unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtkType)
 Create a 3D color texture but does not initialize its values. More...
 
bool Create2D (unsigned int width, unsigned int height, int numComps, int vtktype, bool)
 Create texture without uploading any data. More...
 
bool Create3D (unsigned int width, unsigned int height, unsigned int depth, int numComps, int vtktype, bool)
 
int GetVTKDataType ()
 Get the data type for the texture as a vtk type int i.e. More...
 
int GetDataType (int vtk_scalar_type)
 Get the data type for the texture as GLenum type. More...
 
void SetDataType (unsigned int glType)
 
int GetDefaultDataType (int vtk_scalar_type)
 
unsigned int GetInternalFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
 Get/Set internal format (OpenGL internal format) that should be used. More...
 
void SetInternalFormat (unsigned int glInternalFormat)
 
unsigned int GetDefaultInternalFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
 
unsigned int GetFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
 Get/Set format (OpenGL internal format) that should be used. More...
 
void SetFormat (unsigned int glFormat)
 
unsigned int GetDefaultFormat (int vtktype, int numComps, bool shaderSupportsTextureInt)
 
void ResetFormatAndType ()
 Reset format, internal format, and type of the texture. More...
 
unsigned int GetMinificationFilterMode (int vtktype)
 
unsigned int GetMagnificationFilterMode (int vtktype)
 
unsigned int GetWrapSMode (int vtktype)
 
unsigned int GetWrapTMode (int vtktype)
 
unsigned int GetWrapRMode (int vtktype)
 
virtual void SetRequireDepthBufferFloat (bool)
 Optional, require support for floating point depth buffer formats. More...
 
virtual bool GetRequireDepthBufferFloat ()
 
virtual bool GetSupportsDepthBufferFloat ()
 
virtual void SetRequireTextureFloat (bool)
 Optional, require support for floating point texture formats. More...
 
virtual bool GetRequireTextureFloat ()
 
virtual bool GetSupportsTextureFloat ()
 
virtual void SetRequireTextureInteger (bool)
 Optional, require support for integer texture formats. More...
 
virtual bool GetRequireTextureInteger ()
 
virtual bool GetSupportsTextureInteger ()
 
virtual int GetWrapS ()
 Wrap mode for the first texture coordinate "s" Valid values are: More...
 
virtual void SetWrapS (int)
 
virtual int GetWrapT ()
 Wrap mode for the first texture coordinate "t" Valid values are: More...
 
virtual void SetWrapT (int)
 
virtual int GetWrapR ()
 Wrap mode for the first texture coordinate "r" Valid values are: More...
 
virtual void SetWrapR (int)
 
virtual int GetMinificationFilter ()
 Minification filter mode. More...
 
virtual void SetMinificationFilter (int)
 
virtual int GetMagnificationFilter ()
 Magnification filter mode. More...
 
virtual void SetMagnificationFilter (int)
 
void SetLinearMagnification (bool val)
 Tells if the magnification mode is linear (true) or nearest (false). More...
 
bool GetLinearMagnification ()
 
virtual void SetBorderColor (float, float, float, float)
 Border Color (RGBA). More...
 
virtual void SetBorderColor (float[4])
 
virtual float * GetBorderColor ()
 
virtual void GetBorderColor (float &, float &, float &, float &)
 
virtual void GetBorderColor (float[4])
 
virtual void SetMinLOD (float)
 Lower-clamp the computed LOD against this value. More...
 
virtual float GetMinLOD ()
 
virtual void SetMaxLOD (float)
 Upper-clamp the computed LOD against this value. More...
 
virtual float GetMaxLOD ()
 
virtual void SetBaseLevel (int)
 Level of detail of the first texture image. More...
 
virtual int GetBaseLevel ()
 
virtual void SetMaxLevel (int)
 Level of detail of the first texture image. More...
 
virtual int GetMaxLevel ()
 
virtual bool GetDepthTextureCompare ()
 Tells if the output of a texture unit with a depth texture uses comparison or not. More...
 
virtual void SetDepthTextureCompare (bool)
 
virtual int GetDepthTextureCompareFunction ()
 In case DepthTextureCompare is true, specify the comparison function in use. More...
 
virtual void SetDepthTextureCompareFunction (int)
 
virtual bool GetGenerateMipmap ()
 Tells the hardware to generate mipmap textures from the first texture image at BaseLevel. More...
 
virtual void SetGenerateMipmap (bool)
 
virtual void SetMaximumAnisotropicFiltering (float)
 Set/Get the maximum anisotropic filtering to use. More...
 
virtual float GetMaximumAnisotropicFiltering ()
 
int GetMaximumTextureSize3D ()
 Overload which uses the internal context to query the maximum 3D texture size. More...
 
void CopyToFrameBuffer (vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 Copy the texture (src) in the current framebuffer. More...
 
void CopyToFrameBuffer (int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstXmax, int dstYmax, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 
void CopyToFrameBuffer (int srcXmin, int srcYmin, int srcXmax, int srcYmax, int dstXmin, int dstYmin, int dstSizeX, int dstSizeY, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 
void CopyToFrameBuffer (float *tcoords, float *verts, vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
 
void CopyFromFrameBuffer (int srcXmin, int srcYmin, int dstXmin, int dstYmin, int width, int height)
 Copy a sub-part of a logical buffer of the framebuffer (color or depth) to the texture object. More...
 
void GetShiftAndScale (float &shift, float &scale)
 Get the shift and scale required in the shader to return the texture values to their original range. More...
 
void Resize (unsigned int width, unsigned int height)
 
virtual bool GetUseSRGBColorSpace ()
 Is this texture using the sRGB color space. More...
 
virtual void SetUseSRGBColorSpace (bool)
 
virtual void UseSRGBColorSpaceOn ()
 
virtual void UseSRGBColorSpaceOff ()
 
void AssignToExistingTexture (unsigned int handle, unsigned int target)
 Assign the TextureObject to a externally provided Handle and Target. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
void PrintRevisions (ostream &)
 Legacy. More...
 

Static Public Member Functions

static vtkQWidgetTextureNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkQWidgetTextureSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkTextureObject
static vtkTextureObjectNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkTextureObjectSafeDownCast (vtkObjectBase *o)
 
static int GetMaximumTextureSize (vtkOpenGLRenderWindow *context)
 Query and return maximum texture size (dimension) supported by the OpenGL driver for a particular context. More...
 
static int GetMaximumTextureSize3D (vtkOpenGLRenderWindow *context)
 
static bool IsSupported (vtkOpenGLRenderWindow *, bool, bool, bool)
 Returns if the context supports the required extensions. More...
 
static bool IsSupported (vtkOpenGLRenderWindow *)
 Check for feature support, without any optional features. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkQWidgetTexture ()
 
 ~vtkQWidgetTexture () override
 
void AllocateFromWidget ()
 
- Protected Member Functions inherited from vtkTextureObject
 vtkTextureObject ()
 
 ~vtkTextureObject () override
 
void CreateTexture ()
 Creates a texture handle if not already created. More...
 
void DestroyTexture ()
 Destroy the texture. More...
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

QGraphicsScene * Scene
 
QOffscreenSurface * OffscreenSurface
 
QOpenGLFramebufferObject * Framebuffer
 
QWidget * Widget
 
std::function< void()> RedrawMethod
 
- Protected Attributes inherited from vtkTextureObject
vtkGenericOpenGLResourceFreeCallbackResourceCallback
 
int NumberOfDimensions
 
unsigned int Width
 
unsigned int Height
 
unsigned int Depth
 
unsigned int Samples
 
bool UseSRGBColorSpace
 
float MaximumAnisotropicFiltering
 
unsigned int Target
 
unsigned int Format
 
unsigned int InternalFormat
 
unsigned int Type
 
int Components
 
vtkWeakPointer< vtkOpenGLRenderWindowContext
 
unsigned int Handle
 
bool OwnHandle
 
bool RequireTextureInteger
 
bool SupportsTextureInteger
 
bool RequireTextureFloat
 
bool SupportsTextureFloat
 
bool RequireDepthBufferFloat
 
bool SupportsDepthBufferFloat
 
int WrapS
 
int WrapT
 
int WrapR
 
int MinificationFilter
 
int MagnificationFilter
 
float MinLOD
 
float MaxLOD
 
int BaseLevel
 
int MaxLevel
 
float BorderColor [4]
 
bool DepthTextureCompare
 
int DepthTextureCompareFunction
 
bool GenerateMipmap
 
int AutoParameters
 
vtkTimeStamp SendParametersTime
 
vtkOpenGLHelperShaderProgram
 
vtkOpenGLBufferObjectBufferObject
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

Allows a QWidget to be used as a texture in VTK with OpenGL.

This class works by rendering the QWidget into a Framebuffer and then sending the OpenGL texture handle to VTK for rendering.

Definition at line 34 of file vtkQWidgetTexture.h.

Member Typedef Documentation

◆ Superclass

Definition at line 38 of file vtkQWidgetTexture.h.

Constructor & Destructor Documentation

◆ vtkQWidgetTexture()

vtkQWidgetTexture::vtkQWidgetTexture ( )
protected

◆ ~vtkQWidgetTexture()

vtkQWidgetTexture::~vtkQWidgetTexture ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkQWidgetTexture* vtkQWidgetTexture::New ( )
static

◆ IsTypeOf()

static vtkTypeBool vtkQWidgetTexture::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkQWidgetTexture::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkTextureObject.

◆ SafeDownCast()

static vtkQWidgetTexture* vtkQWidgetTexture::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkQWidgetTexture::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkTextureObject.

◆ NewInstance()

vtkQWidgetTexture* vtkQWidgetTexture::NewInstance ( ) const

◆ SetWidget()

void vtkQWidgetTexture::SetWidget ( QWidget *  w)

Set/Get the QWidget that this TextureObject will render/use.

◆ GetWidget()

QWidget* vtkQWidgetTexture::GetWidget ( )
inline

Definition at line 45 of file vtkQWidgetTexture.h.

◆ GetScene()

QGraphicsScene* vtkQWidgetTexture::GetScene ( )
inline

get the QScene used for rendering, this is where events will be forwarded to.

Definition at line 52 of file vtkQWidgetTexture.h.

◆ Activate()

void vtkQWidgetTexture::Activate ( )
overridevirtual

Activate and Bind the texture.

Ovrloaded to handle the opengl related setup at the same time. as We know the context will be active then.

Reimplemented from vtkTextureObject.

◆ ReleaseGraphicsResources()

void vtkQWidgetTexture::ReleaseGraphicsResources ( vtkWindow win)
overridevirtual

Free resources.

Reimplemented from vtkTextureObject.

◆ AllocateFromWidget()

void vtkQWidgetTexture::AllocateFromWidget ( )
protected

Member Data Documentation

◆ Scene

QGraphicsScene* vtkQWidgetTexture::Scene
protected

Definition at line 69 of file vtkQWidgetTexture.h.

◆ OffscreenSurface

QOffscreenSurface* vtkQWidgetTexture::OffscreenSurface
protected

Definition at line 70 of file vtkQWidgetTexture.h.

◆ Framebuffer

QOpenGLFramebufferObject* vtkQWidgetTexture::Framebuffer
protected

Definition at line 71 of file vtkQWidgetTexture.h.

◆ Widget

QWidget* vtkQWidgetTexture::Widget
protected

Definition at line 72 of file vtkQWidgetTexture.h.

◆ RedrawMethod

std::function<void()> vtkQWidgetTexture::RedrawMethod
protected

Definition at line 75 of file vtkQWidgetTexture.h.


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