Kstars

skymapgldraw.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Akarsh Simha <akarsh.simha@kdemail.net>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifdef _WIN32
8#include <windows.h>
9#endif
10
11#include "texturemanager.h"
12#include "skymapcomposite.h"
13#include "skyglpainter.h"
14#include "skymapgldraw.h"
15#include "skymap.h"
16
18{
19 if (!format().testOption(QGL::SampleBuffers))
20 qWarning() << "No sample buffer; can't use multisampling (antialiasing)";
21 if (!format().testOption(QGL::StencilBuffer))
22 qWarning() << "No stencil buffer; can't draw concave polygons";
23}
24
25void SkyMapGLDraw::initializeGL()
26{
27}
28
29void SkyMapGLDraw::resizeGL(int width, int height)
30{
31 Q_UNUSED(width)
32 Q_UNUSED(height)
33 //do nothing since we resize in SkyGLPainter::paintGL()
34}
35
37{
38 Q_UNUSED(event);
39 // This is machinery to prevent multiple concurrent paint events / recursive paint events
40 if (m_DrawLock)
41 return;
42 setDrawLock(true);
43
44 QPainter p;
45 p.begin(this);
47 calculateFPS();
48 m_SkyMap->setupProjector();
49 makeCurrent();
50
51 SkyGLPainter psky(this);
52 //FIXME: we may want to move this into the components.
53 psky.begin();
54
55 //Draw all sky elements
56 psky.drawSkyBackground();
57 m_KStarsData->skyComposite()->draw(&psky);
58 //Finish up
59 psky.end();
60
62 drawOverlays(p);
63 p.end();
64
65 setDrawLock(false);
66}
SkyMapComposite * skyComposite()
Definition kstarsdata.h:166
void draw(SkyPainter *skyp) override
Delegate draw requests to all sub components psky Reference to the QPainter on which to paint.
This class defines the methods that both rendering engines (GLPainter and QPainter) must implement.
static void setDrawLock(bool state)
Acquire / release a draw lock.
void drawOverlays(QPainter &p, bool drawFov=true)
Draw the overlays on top of the sky map.
SkyMapGLDraw(SkyMap *parent)
Constructor.
virtual void paintEvent(QPaintEvent *e)
Overridden paintEvent method.
This is the canvas on which the sky is painted.
Definition skymap.h:54
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1242
bool begin(QPaintDevice *device)
void beginNativePainting()
bool end()
void endNativePainting()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.