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

Class for drawing 2D primitives using OpenGL 2. More...

#include <vtkOpenGL2ContextDevice2D.h>

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

Public Types

typedef vtkOpenGLContextDevice2D Superclass
 
- Public Types inherited from vtkOpenGLContextDevice2D
typedef vtkContextDevice2D Superclass
 
typedef vtkContextDevice2D Superclass
 
- Public Types inherited from vtkContextDevice2D
enum  TextureProperty { Nearest = 0x01, Linear = 0x02, Stretch = 0x04, Repeat = 0x08 }
 
typedef vtkObject Superclass
 
- Public Types inherited from vtkObject
typedef vtkObjectBase Superclass
 

Public Member Functions

virtual int IsA (const char *type)
 
vtkOpenGL2ContextDevice2DNewInstance () const
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 
virtual void DrawImage (float p[2], float scale, vtkImageData *image)
 
void DrawImage (const vtkRectf &pos, vtkImageData *image)
 
virtual void ReleaseGraphicsResources (vtkWindow *window)
 
virtual void DrawPointSprites (vtkImageData *sprite, float *points, int n, unsigned char *colors=0, int nc_comps=0)
 
- Public Member Functions inherited from vtkOpenGLContextDevice2D
vtkOpenGLContextDevice2DNewInstance () const
 
virtual void DrawQuad (float *points, int n)
 
virtual void DrawQuadStrip (float *points, int n)
 
virtual void DrawPolygon (float *, int)
 
virtual void DrawString (float *point, const vtkStdString &string)
 
virtual void DrawString (float *point, const vtkUnicodeString &string)
 
virtual void DrawMathTextString (float point[2], const vtkStdString &string)
 
void DrawImage (const vtkRectf &pos, vtkImageData *image)
 
virtual void SetColor4 (unsigned char color[4])
 
virtual void SetColor (unsigned char color[3])
 
virtual void SetTexture (vtkImageData *image, int properties=0)
 
virtual void SetPointSize (float size)
 
virtual void SetLineWidth (float width)
 
virtual void SetLineType (int type)
 
virtual void MultiplyMatrix (vtkMatrix3x3 *m)
 
virtual void SetMatrix (vtkMatrix3x3 *m)
 
virtual void GetMatrix (vtkMatrix3x3 *m)
 
virtual void PushMatrix ()
 
virtual void PopMatrix ()
 
virtual void SetClipping (int *x)
 
virtual void EnableClipping (bool enable)
 
virtual void Begin (vtkViewport *viewport)
 
virtual void End ()
 
virtual void BufferIdModeBegin (vtkAbstractContextBufferId *bufferId)
 
virtual void BufferIdModeEnd ()
 
bool SetStringRendererToFreeType ()
 
bool SetStringRendererToQt ()
 
bool HasGLSL ()
 
vtkOpenGLContextDevice2DNewInstance () const
 
virtual void DrawQuad (float *points, int n)
 
virtual void DrawQuadStrip (float *points, int n)
 
virtual void DrawPolygon (float *, int)
 
virtual void DrawString (float *point, const vtkStdString &string)
 
virtual void DrawString (float *point, const vtkUnicodeString &string)
 
virtual void DrawMathTextString (float point[2], const vtkStdString &string)
 
void DrawImage (const vtkRectf &pos, vtkImageData *image)
 
virtual void SetColor4 (unsigned char color[4])
 
virtual void SetColor (unsigned char color[3])
 
virtual void SetTexture (vtkImageData *image, int properties=0)
 
virtual void SetPointSize (float size)
 
virtual void SetLineWidth (float width)
 
virtual void SetLineType (int type)
 
virtual void MultiplyMatrix (vtkMatrix3x3 *m)
 
virtual void SetMatrix (vtkMatrix3x3 *m)
 
virtual void GetMatrix (vtkMatrix3x3 *m)
 
virtual void PushMatrix ()
 
virtual void PopMatrix ()
 
virtual void SetClipping (int *x)
 
virtual void EnableClipping (bool enable)
 
virtual void Begin (vtkViewport *viewport)
 
virtual void End ()
 
virtual void BufferIdModeBegin (vtkAbstractContextBufferId *bufferId)
 
virtual void BufferIdModeEnd ()
 
bool SetStringRendererToFreeType ()
 
bool SetStringRendererToQt ()
 
bool HasGLSL ()
 
virtual void DrawPoly (float *f, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawLines (float *f, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawPoints (float *points, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawMarkers (int shape, bool highlight, float *points, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void SetMaximumMarkerCacheSize (int)
 
virtual int GetMaximumMarkerCacheSize ()
 
virtual void DrawEllipseWedge (float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle)
 
virtual void DrawEllipticArc (float x, float y, float rX, float rY, float startAngle, float stopAngle)
 
virtual void ComputeStringBounds (const vtkStdString &string, float bounds[4])
 
virtual void ComputeStringBounds (const vtkUnicodeString &string, float bounds[4])
 
virtual vtkOpenGLRenderWindowGetRenderWindow ()
 
virtual void DrawPoly (float *f, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawLines (float *f, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawPoints (float *points, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void DrawMarkers (int shape, bool highlight, float *points, int n, unsigned char *colors=0, int nc_comps=0)
 
virtual void SetMaximumMarkerCacheSize (int)
 
virtual int GetMaximumMarkerCacheSize ()
 
virtual void DrawEllipseWedge (float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle)
 
virtual void DrawEllipticArc (float x, float y, float rX, float rY, float startAngle, float stopAngle)
 
virtual void ComputeStringBounds (const vtkStdString &string, float bounds[4])
 
virtual void ComputeStringBounds (const vtkUnicodeString &string, float bounds[4])
 
virtual vtkOpenGLRenderWindowGetRenderWindow ()
 
vtkMatrix4x4GetProjectionMatrix ()
 
vtkMatrix4x4GetModelMatrix ()
 
- Public Member Functions inherited from vtkContextDevice2D
vtkContextDevice2DNewInstance () const
 
virtual void DrawMathTextString (float *point, const vtkStdString &string)=0
 
virtual bool MathTextIsSupported ()
 
void ApplyPen (vtkPen *pen)
 
void ApplyBrush (vtkBrush *brush)
 
void ApplyTextProp (vtkTextProperty *prop)
 
virtual int GetWidth ()
 
virtual int GetHeight ()
 
virtual void DisableClipping ()
 
virtual bool GetBufferIdMode () const
 
virtual void SetViewportSize (const vtkVector2i &size)
 
virtual vtkVector2i GetViewportSize ()
 
virtual void SetViewportRect (const vtkRecti &rect)
 
virtual vtkRecti GetViewportRect ()
 
virtual vtkPenGetPen ()
 
virtual vtkBrushGetBrush ()
 
virtual vtkTextPropertyGetTextProp ()
 
- Public Member Functions inherited from vtkObject
vtkObjectNewInstance () const
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
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 *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
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)
 
int InvokeEvent (unsigned long event, void *callData)
 
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
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkOpenGL2ContextDevice2DSafeDownCast (vtkObjectBase *o)
 
static vtkOpenGL2ContextDevice2DNew ()
 
static bool IsSupported (vtkViewport *viewport)
 
- Static Public Member Functions inherited from vtkOpenGLContextDevice2D
static int IsTypeOf (const char *type)
 
static vtkOpenGLContextDevice2DSafeDownCast (vtkObjectBase *o)
 
static vtkOpenGLContextDevice2DNew ()
 
static int IsTypeOf (const char *type)
 
static vtkOpenGLContextDevice2DSafeDownCast (vtkObjectBase *o)
 
static vtkOpenGLContextDevice2DNew ()
 
- Static Public Member Functions inherited from vtkContextDevice2D
static int IsTypeOf (const char *type)
 
static vtkContextDevice2DSafeDownCast (vtkObjectBase *o)
 
static vtkContextDevice2DNew ()
 
- Static Public Member Functions inherited from vtkObject
static int IsTypeOf (const char *type)
 
static vtkObjectSafeDownCast (vtkObjectBase *o)
 
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static int IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkOpenGL2ContextDevice2D ()
 
virtual ~vtkOpenGL2ContextDevice2D ()
 
virtual bool LoadExtensions (vtkOpenGLExtensionManager *m)
 
- Protected Member Functions inherited from vtkOpenGLContextDevice2D
 vtkOpenGLContextDevice2D ()
 
virtual ~vtkOpenGLContextDevice2D ()
 
 vtkOpenGLContextDevice2D ()
 
virtual ~vtkOpenGLContextDevice2D ()
 
void ReadyVCBOProgram ()
 
void ReadyVBOProgram ()
 
void ReadyVTBOProgram ()
 
void ReadySCBOProgram ()
 
void ReadySBOProgram ()
 
void SetMatrices (vtkShaderProgram *prog)
 
void BuildVBO (vtkOpenGLHelper *cbo, float *v, int nv, unsigned char *coolors, int nc, float *tcoords)
 
void CoreDrawTriangles (std::vector< float > &tverts)
 
int GetNumberOfArcIterations (float rX, float rY, float startAngle, float stopAngle)
 
int GetNumberOfArcIterations (float rX, float rY, float startAngle, float stopAngle)
 
- Protected Member Functions inherited from vtkContextDevice2D
 vtkContextDevice2D ()
 
 ~vtkContextDevice2D ()
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
virtual void RegisterInternal (vtkObjectBase *, int check)
 
virtual void UnRegisterInternal (vtkObjectBase *, int check)
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
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 &)
 

Additional Inherited Members

- Protected Attributes inherited from vtkOpenGLContextDevice2D
int Geometry [2]
 
vtkRendererRenderer
 
vtkStringToImageTextRenderer
 
bool InRender
 
vtkOpenGLRenderWindowRenderWindow
 
vtkOpenGLHelperVCBO
 
vtkOpenGLHelperVBO
 
vtkOpenGLHelperVTBO
 
vtkOpenGLHelperSCBO
 
vtkOpenGLHelperSBO
 
PrivateStorage
 
- Protected Attributes inherited from vtkContextDevice2D
int Geometry [2]
 
vtkVector2i ViewportSize
 
vtkRecti ViewportRect
 
vtkAbstractContextBufferIdBufferId
 
vtkPenPen
 
vtkBrushBrush
 
vtkTextPropertyTextProp
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

Class for drawing 2D primitives using OpenGL 2.

This class takes care of drawing the 2D primitives for the vtkContext2D class. In general this class should not be used directly, but called by vtkContext2D which takes care of many of the higher level details.

It assumes that OpenGL 2 is available, which is taken care of by the vtkContextActor class. If OpenGL 2 is not available, but OpenGL rendering is required the vtkOpenGLContextDevice2D class should be used (employs GL 1.1).

See also
vtkOpenGLContextDevice2D
Tests:
vtkOpenGL2ContextDevice2D (Tests)

Definition at line 41 of file vtkOpenGL2ContextDevice2D.h.

Member Typedef Documentation

Definition at line 45 of file vtkOpenGL2ContextDevice2D.h.

Constructor & Destructor Documentation

vtkOpenGL2ContextDevice2D::vtkOpenGL2ContextDevice2D ( )
protected
virtual vtkOpenGL2ContextDevice2D::~vtkOpenGL2ContextDevice2D ( )
protectedvirtual

Member Function Documentation

static int vtkOpenGL2ContextDevice2D::IsTypeOf ( const char *  type)
static
virtual int vtkOpenGL2ContextDevice2D::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 vtkOpenGLContextDevice2D.

static vtkOpenGL2ContextDevice2D* vtkOpenGL2ContextDevice2D::SafeDownCast ( vtkObjectBase o)
static
virtual vtkObjectBase* vtkOpenGL2ContextDevice2D::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkOpenGLContextDevice2D.

vtkOpenGL2ContextDevice2D* vtkOpenGL2ContextDevice2D::NewInstance ( ) const
virtual void vtkOpenGL2ContextDevice2D::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkOpenGLContextDevice2D.

static vtkOpenGL2ContextDevice2D* vtkOpenGL2ContextDevice2D::New ( )
static

Creates a 2D Painter object.

static bool vtkOpenGL2ContextDevice2D::IsSupported ( vtkViewport viewport)
static

Return true if the current rendering context supports this device.

virtual void vtkOpenGL2ContextDevice2D::DrawPointSprites ( vtkImageData sprite,
float points,
int  n,
unsigned char *  colors = 0,
int  nc_comps = 0 
)
virtual

Draw a series of point sprites, images centred at the points supplied. The supplied vtkImageData is the sprite to be drawn, only squares will be drawn and the size is set using SetPointSize. Points are colored by colors array which has nc_comps components

Reimplemented from vtkOpenGLContextDevice2D.

virtual void vtkOpenGL2ContextDevice2D::DrawImage ( float  p[2],
float  scale,
vtkImageData image 
)
virtual

Draw the supplied image at the given x, y (p[0], p[1]) (bottom corner), scaled by scale (1.0 would match the image).

Reimplemented from vtkOpenGLContextDevice2D.

void vtkOpenGL2ContextDevice2D::DrawImage ( const vtkRectf pos,
vtkImageData image 
)
virtual

Draw the supplied image at the given position. The origin, width, and height are specified by the supplied vtkRectf variable pos. The image will be drawn scaled to that size.

Implements vtkContextDevice2D.

virtual void vtkOpenGL2ContextDevice2D::ReleaseGraphicsResources ( vtkWindow window)
virtual

Release any graphics resources that are being consumed by this device. The parameter window could be used to determine which graphic resources to release.

Reimplemented from vtkOpenGLContextDevice2D.

virtual bool vtkOpenGL2ContextDevice2D::LoadExtensions ( vtkOpenGLExtensionManager m)
protectedvirtual

Load the OpenGL extensions we need.

Reimplemented from vtkOpenGLContextDevice2D.


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