Stellarium 0.12.1
List of all members | Public Member Functions
StelQGLViewport Class Reference

Manages OpenGL viewport. More...

#include <StelQGLViewport.hpp>

Public Member Functions

 StelQGLViewport (StelQGLWidget *const glWidget, QGraphicsView *const parent)
 Construct a StelQGLViewport using specified widget. More...
 
 ~StelQGLViewport ()
 Destroy the StelQGLViewport. More...
 
void init (const bool npot, const QString &glVendor, const QString &glRenderer)
 Initialize the viewport. More...
 
QPaintEngine::Type qtPaintEngineType () const
 Get paint engine type used for Qt drawing. More...
 
void viewportHasBeenResized (const QSize newSize)
 Called when viewport size changes so we can replace the FBOs. More...
 
void setDefaultPainter (QPainter *const painter, const QGLContext *const context)
 Set the default painter to use when not drawing to FBO. More...
 
QImage screenshot () const
 Grab a screenshot. More...
 
QSize getViewportSize () const
 Return current viewport size in pixels. More...
 
StelTextureBackendgetViewportTextureBackend (class StelQGLRenderer *renderer)
 Get a texture of the viewport. More...
 
bool useFBO () const
 Are we using framebuffer objects? More...
 
void setFont (const QFont &font)
 Set font to use for drawing text. More...
 
void startFrame ()
 Start using drawing calls. More...
 
void suspendFrame ()
 Suspend drawing, not showing the result on the screen. More...
 
void finishFrame (const bool swapBuffers=true)
 Finish using draw calls. More...
 
void prepareToDrawViewport ()
 Code that must run before drawing the final result of the rendering to the viewport. More...
 
void disablePainting ()
 Disable Qt painting. More...
 
void enablePainting ()
 Enable Qt painting (with the current default painter, or constructing a fallback if no default). More...
 
QPainter * getPainter ()
 Return the painter currently used to paint, if any. More...
 

Detailed Description

Manages OpenGL viewport.

This class handles things like framebuffers and Qt painting to the viewport.

Definition at line 84 of file StelQGLViewport.hpp.

Constructor & Destructor Documentation

StelQGLViewport::StelQGLViewport ( StelQGLWidget *const  glWidget,
QGraphicsView *const  parent 
)
inline

Construct a StelQGLViewport using specified widget.

Parameters
glWidgetGL widget that contains the viewport.
parentParent widget of glWidget.

Definition at line 91 of file StelQGLViewport.hpp.

StelQGLViewport::~StelQGLViewport ( )
inline

Destroy the StelQGLViewport.

Definition at line 127 of file StelQGLViewport.hpp.

Member Function Documentation

void StelQGLViewport::disablePainting ( )
inline

Disable Qt painting.

Definition at line 332 of file StelQGLViewport.hpp.

void StelQGLViewport::enablePainting ( )
inline

Enable Qt painting (with the current default painter, or constructing a fallback if no default).

Definition at line 346 of file StelQGLViewport.hpp.

void StelQGLViewport::finishFrame ( const bool  swapBuffers = true)
inline

Finish using draw calls.

Definition at line 299 of file StelQGLViewport.hpp.

QPainter* StelQGLViewport::getPainter ( )
inline

Return the painter currently used to paint, if any.

Definition at line 354 of file StelQGLViewport.hpp.

QSize StelQGLViewport::getViewportSize ( ) const
inline

Return current viewport size in pixels.

Definition at line 242 of file StelQGLViewport.hpp.

StelTextureBackend* StelQGLViewport::getViewportTextureBackend ( class StelQGLRenderer renderer)

Get a texture of the viewport.

void StelQGLViewport::init ( const bool  npot,
const QString &  glVendor,
const QString &  glRenderer 
)
inline

Initialize the viewport.

Parameters
npotAre non-power-of-two textures supported?
glVendorThe GL_VENDOR string (usually specifies the GPU driver).
glRendererThe GL_RENDERER string (usually specifies the GPU).

Definition at line 143 of file StelQGLViewport.hpp.

void StelQGLViewport::prepareToDrawViewport ( )
inline

Code that must run before drawing the final result of the rendering to the viewport.

Definition at line 320 of file StelQGLViewport.hpp.

QPaintEngine::Type StelQGLViewport::qtPaintEngineType ( ) const
inline

Get paint engine type used for Qt drawing.

Definition at line 184 of file StelQGLViewport.hpp.

QImage StelQGLViewport::screenshot ( ) const
inline

Grab a screenshot.

Definition at line 235 of file StelQGLViewport.hpp.

void StelQGLViewport::setDefaultPainter ( QPainter *const  painter,
const QGLContext *const  context 
)
inline

Set the default painter to use when not drawing to FBO.

This is the only place where we might be getting a painter from outside world, so we require that it uses a GL or GL2 paint engine.

Parameters
painterPainter to set.
contextGL context used by the renderer, for error checking.

Definition at line 209 of file StelQGLViewport.hpp.

void StelQGLViewport::setFont ( const QFont &  font)
inline

Set font to use for drawing text.

Can be only called when Qt painting is enabled.

Definition at line 261 of file StelQGLViewport.hpp.

void StelQGLViewport::startFrame ( )
inline

Start using drawing calls.

Definition at line 269 of file StelQGLViewport.hpp.

void StelQGLViewport::suspendFrame ( )
inline

Suspend drawing, not showing the result on the screen.

Finishes using draw calls for this frame. Drawing can continue later. Only usable with FBOs.

Definition at line 292 of file StelQGLViewport.hpp.

bool StelQGLViewport::useFBO ( ) const
inline

Are we using framebuffer objects?

Definition at line 252 of file StelQGLViewport.hpp.

void StelQGLViewport::viewportHasBeenResized ( const QSize  newSize)
inline

Called when viewport size changes so we can replace the FBOs.

Definition at line 190 of file StelQGLViewport.hpp.


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