Main Page · Class Overview · Hierarchy · All Classes · Special Pages
Public Functions | Protected Functions
QCPPaintBufferGlPbuffer Class Reference

A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering. More...

Inheritance diagram for QCPPaintBufferGlPbuffer:
Inheritance graph

Public Functions

 QCPPaintBufferGlPbuffer (const QSize &size, double devicePixelRatio, int multisamples)
virtual QCPPainterstartPainting ()
virtual void draw (QCPPainter *painter) const
void clear (const QColor &color)
- Public Functions inherited from QCPAbstractPaintBuffer
 QCPAbstractPaintBuffer (const QSize &size, double devicePixelRatio)
QSize size () const
bool invalidated () const
double devicePixelRatio () const
void setSize (const QSize &size)
void setInvalidated (bool invalidated=true)
void setDevicePixelRatio (double ratio)
virtual void donePainting ()

Protected Functions

virtual void reallocateBuffer ()

Detailed Description

A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering.

This paint buffer is one of the OpenGL paint buffers which facilitate hardware accelerated plot rendering. It is based on OpenGL pixel buffers (pbuffer) and is used in Qt versions before 5.0. (See QCPPaintBufferGlFbo used in newer Qt versions.)

The OpenGL paint buffers are used if QCustomPlot::setOpenGl is set to true, and if they are supported by the system.

Constructor & Destructor Documentation

§ QCPPaintBufferGlPbuffer()

QCPPaintBufferGlPbuffer::QCPPaintBufferGlPbuffer ( const QSize &  size,
double  devicePixelRatio,
int  multisamples 

Creates a QCPPaintBufferGlPbuffer instance with the specified size and devicePixelRatio, if applicable.

The parameter multisamples defines how many samples are used per pixel. Higher values thus result in higher quality antialiasing. If the specified multisamples value exceeds the capability of the graphics hardware, the highest supported multisampling is used.

Member Function Documentation

§ startPainting()

QCPPainter * QCPPaintBufferGlPbuffer::startPainting ( )

Returns a QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method.

Once you are done using the painter, delete the painter and call donePainting.

While a painter generated with this method is active, you must not call setSize, setDevicePixelRatio or clear.

This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend.

Implements QCPAbstractPaintBuffer.

§ draw()

void QCPPaintBufferGlPbuffer::draw ( QCPPainter painter) const

Draws the contents of this buffer with the provided painter. This is the method that is used to finally join all paint buffers and draw them onto the screen.

Implements QCPAbstractPaintBuffer.

§ clear()

void QCPPaintBufferGlPbuffer::clear ( const QColor &  color)

Fills the entire buffer with the provided color. To have an empty transparent buffer, use the named color Qt::transparent.

This method must not be called if there is currently a painter (acquired with startPainting) active.

Implements QCPAbstractPaintBuffer.

§ reallocateBuffer()

void QCPPaintBufferGlPbuffer::reallocateBuffer ( )

Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio, if applicable (setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer.

Subclasses of QCPAbstractPaintBuffer must call their reimplementation of this method in their constructor, to perform the first allocation (this can not be done by the base class because calling pure virtual methods in base class constructors is not possible).

Implements QCPAbstractPaintBuffer.

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