• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
skymapgldraw.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  skymapgldraw.cpp - K Desktop Planetarium
3  -------------------
4  begin : Wed Dec 29 2010 04:07 AM UTC-6
5  copyright : (C) 2010 Akarsh Simha
6  email : akarsh.simha@kdemail.net
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifdef _WIN32
18 #include <windows.h>
19 #endif
20 
21 #include "texturemanager.h"
22 #include "skymapcomposite.h"
23 #include "skyglpainter.h"
24 #include "skymapgldraw.h"
25 #include "skymap.h"
26 
27 
28 SkyMapGLDraw::SkyMapGLDraw( SkyMap *sm ) :
29  QGLWidget( sm ),
30  SkyMapDrawAbstract( sm )
31 {
32  if( !format().testOption( QGL::SampleBuffers ) )
33  qWarning() << "No sample buffer; can't use multisampling (antialiasing)";
34  if( !format().testOption( QGL::StencilBuffer ) )
35  qWarning() << "No stencil buffer; can't draw concave polygons";
36 }
37 
38 void SkyMapGLDraw::initializeGL()
39 {
40 }
41 
42 void SkyMapGLDraw::resizeGL(int width, int height)
43 {
44  Q_UNUSED(width)
45  Q_UNUSED(height)
46  //do nothing since we resize in SkyGLPainter::paintGL()
47 }
48 
49 void SkyMapGLDraw::paintEvent( QPaintEvent *event )
50 {
51  Q_UNUSED(event);
52  // This is machinery to prevent multiple concurrent paint events / recursive paint events
53  if( m_DrawLock )
54  return;
55  setDrawLock( true );
56 
57  QPainter p;
58  p.begin(this);
59  p.beginNativePainting();
60  calculateFPS();
61  m_SkyMap->setupProjector();
62  makeCurrent();
63 
64  SkyGLPainter psky( this );
65  //FIXME: we may want to move this into the components.
66  psky.begin();
67 
68  //Draw all sky elements
69  psky.drawSkyBackground();
70  m_KStarsData->skyComposite()->draw( &psky );
71  //Finish up
72  psky.end();
73 
74  p.endNativePainting();
75  drawOverlays(p);
76  p.end();
77 
78  setDrawLock( false );
79 }
SkyMapGLDraw::SkyMapGLDraw
SkyMapGLDraw(SkyMap *parent)
Constructor.
Definition: skymapgldraw.cpp:28
SkyMapDrawAbstract::setDrawLock
static void setDrawLock(bool state)
Acquire / release a draw lock.
Definition: skymapdrawabstract.cpp:346
SkyMapDrawAbstract::m_KStarsData
KStarsData * m_KStarsData
Definition: skymapdrawabstract.h:149
SkyMapDrawAbstract::drawOverlays
void drawOverlays(QPainter &p, bool drawFov=true)
Draw the overlays on top of the sky map.
Definition: skymapdrawabstract.cpp:67
skyglpainter.h
SkyMapComposite::draw
virtual void draw(SkyPainter *skyp)
Delegate draw requests to all sub components psky Reference to the QPainter on which to paint...
Definition: skymapcomposite.cpp:170
SkyMapGLDraw::paintEvent
virtual void paintEvent(QPaintEvent *e)
Overridden paintEvent method.
Definition: skymapgldraw.cpp:49
SkyGLPainter::end
virtual void end()
End and finalize painting.
Definition: skyglpainter.cpp:638
SkyMap::setupProjector
void setupProjector()
Call to set up the projector before a draw cycle.
Definition: skymap.cpp:1010
SkyMapGLDraw::resizeGL
virtual void resizeGL(int, int)
Definition: skymapgldraw.cpp:42
texturemanager.h
skymapcomposite.h
SkyMapDrawAbstract::m_SkyMap
SkyMap * m_SkyMap
Definition: skymapdrawabstract.h:150
SkyMapGLDraw::initializeGL
virtual void initializeGL()
Definition: skymapgldraw.cpp:38
SkyMapDrawAbstract::m_DrawLock
static bool m_DrawLock
Definition: skymapdrawabstract.h:151
skymap.h
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:146
SkyGLPainter::drawSkyBackground
virtual void drawSkyBackground()
Draw the sky background.
Definition: skyglpainter.cpp:630
QGLWidget
SkyMapDrawAbstract::calculateFPS
void calculateFPS()
Calculate FPS and dump result to stderr using kDebug.
Definition: skymapdrawabstract.cpp:335
skymapgldraw.h
SkyMapDrawAbstract
This class defines the methods that both rendering engines (GLPainter and QPainter) must implement...
Definition: skymapdrawabstract.h:40
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:72
SkyGLPainter
Definition: skyglpainter.h:33
SkyGLPainter::begin
virtual void begin()
Begin painting.
Definition: skyglpainter.cpp:645
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal