StelPainter.cpp   StelPainter.cpp 
skipping to change at line 58 skipping to change at line 58
QCache<QByteArray, StringTexture> StelPainter::texCache(TEX_CACHE_LIMIT); QCache<QByteArray, StringTexture> StelPainter::texCache(TEX_CACHE_LIMIT);
QOpenGLShaderProgram* StelPainter::texturesShaderProgram=NULL; QOpenGLShaderProgram* StelPainter::texturesShaderProgram=NULL;
QOpenGLShaderProgram* StelPainter::basicShaderProgram=NULL; QOpenGLShaderProgram* StelPainter::basicShaderProgram=NULL;
QOpenGLShaderProgram* StelPainter::colorShaderProgram=NULL; QOpenGLShaderProgram* StelPainter::colorShaderProgram=NULL;
QOpenGLShaderProgram* StelPainter::texturesColorShaderProgram=NULL; QOpenGLShaderProgram* StelPainter::texturesColorShaderProgram=NULL;
StelPainter::BasicShaderVars StelPainter::basicShaderVars; StelPainter::BasicShaderVars StelPainter::basicShaderVars;
StelPainter::TexturesShaderVars StelPainter::texturesShaderVars; StelPainter::TexturesShaderVars StelPainter::texturesShaderVars;
StelPainter::BasicShaderVars StelPainter::colorShaderVars; StelPainter::BasicShaderVars StelPainter::colorShaderVars;
StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars; StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars;
StelPainter::GLState::GLState() StelPainter::GLState::GLState(QOpenGLFunctions* gl)
: blend(false),
blendSrc(GL_SRC_ALPHA), blendDst(GL_ONE_MINUS_SRC_ALPHA),
depthTest(false),
depthMask(false),
cullFace(false),
lineSmooth(false),
lineWidth(1.0f),
gl(gl)
{ {
blend = glIsEnabled(GL_BLEND);
glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
glGetIntegerv(GL_BLEND_DST_RGB, &blendDstRGB);
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDstAlpha);
} }
StelPainter::GLState::~GLState() void StelPainter::GLState::apply()
{ {
if (blend) if(blend)
{ gl->glEnable(GL_BLEND);
glEnable(GL_BLEND); else
glBlendFuncSeparate(blendSrcRGB, blendDstRGB, blendSrcAlpha, gl->glDisable(GL_BLEND);
blendDstAlpha); gl->glBlendFunc(blendSrc,blendDst);
} if(depthTest)
gl->glEnable(GL_DEPTH_TEST);
else else
gl->glDisable(GL_DEPTH_TEST);
gl->glDepthMask(depthMask);
if(cullFace)
gl->glEnable(GL_CULL_FACE);
else
gl->glDisable(GL_CULL_FACE);
#ifdef GL_LINE_SMOOTH
if(!QOpenGLContext::currentContext()->isOpenGLES())
{ {
glDisable(GL_BLEND); if (lineSmooth)
gl->glEnable(GL_LINE_SMOOTH);
else
gl->glDisable(GL_LINE_SMOOTH);
} }
#endif
}
void StelPainter::GLState::reset()
{
*this = GLState(gl);
apply();
} }
bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name) bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name)
{ {
bool ret = prog->link(); bool ret = prog->link();
if (!ret || (!prog->log().isEmpty() && !prog->log().contains("Link w as successful"))) if (!ret || (!prog->log().isEmpty() && !prog->log().contains("Link w as successful")))
qWarning() << QString("StelPainter: Warnings while linking % 1 shader program:\n%2").arg(name, prog->log()); qWarning() << QString("StelPainter: Warnings while linking % 1 shader program:\n%2").arg(name, prog->log());
return ret; return ret;
} }
StelPainter::StelPainter(const StelProjectorP& proj) : prj(proj) StelPainter::StelPainter(const StelProjectorP& proj) : QOpenGLFunctions(QOp enGLContext::currentContext()), glState(this)
{ {
Q_ASSERT(proj); Q_ASSERT(proj);
#ifndef NDEBUG #ifndef NDEBUG
Q_ASSERT(globalMutex); Q_ASSERT(globalMutex);
GLenum er = glGetError(); GLenum er = glGetError();
if (er!=GL_NO_ERROR) if (er!=GL_NO_ERROR)
{ {
if (er==GL_INVALID_OPERATION) if (er==GL_INVALID_OPERATION)
qFatal("Invalid openGL operation. It is likely that you used openGL calls without having a valid instance of StelPainter"); qFatal("Invalid openGL operation. It is likely that you used openGL calls without having a valid instance of StelPainter");
} }
// Lock the global mutex ensuring that no other instances of StelPai nter are currently being used // Lock the global mutex ensuring that no other instances of StelPai nter are currently being used
if (globalMutex->tryLock()==false) if (globalMutex->tryLock()==false)
{ {
qFatal("There can be only 1 instance of StelPainter at a giv en time"); qFatal("There can be only 1 instance of StelPainter at a giv en time");
} }
#endif #endif
glDisable(GL_DEPTH_TEST); //TODO: is this still required, and is there some Qt way to fix it?
glDisable(GL_CULL_FACE); 0x11111111 is a bit peculiar, how was it chosen?
// Fix some problem when using Qt OpenGL2 engine // Fix some problem when using Qt OpenGL2 engine
glStencilMask(0x11111111); glStencilMask(0x11111111);
// Deactivate drawing in depth buffer by default glState.apply(); //apply default OpenGL state
glDepthMask(GL_FALSE);
enableTexture2d(false);
setProjector(proj); setProjector(proj);
} }
void StelPainter::setProjector(const StelProjectorP& p) void StelPainter::setProjector(const StelProjectorP& p)
{ {
prj=p; prj=p;
// Init GL viewport to current projector values // Init GL viewport to current projector values
glViewport(prj->viewportXywh[0], prj->viewportXywh[1], prj->viewport Xywh[2], prj->viewportXywh[3]); glViewport(prj->viewportXywh[0], prj->viewportXywh[1], prj->viewport Xywh[2], prj->viewportXywh[3]);
glFrontFace(prj->needGlFrontFaceCW()?GL_CW:GL_CCW); glFrontFace(prj->needGlFrontFaceCW()?GL_CW:GL_CCW);
} }
StelPainter::~StelPainter() StelPainter::~StelPainter()
{ {
//reset opengl state
glState.reset();
#ifndef NDEBUG #ifndef NDEBUG
GLenum er = glGetError(); GLenum er = glGetError();
if (er!=GL_NO_ERROR) if (er!=GL_NO_ERROR)
{ {
if (er==GL_INVALID_OPERATION) if (er==GL_INVALID_OPERATION)
qFatal("Invalid openGL operation detected in ~StelPa inter()"); qFatal("Invalid openGL operation detected in ~StelPa inter()");
} }
#endif
#ifndef NDEBUG
// We are done with this StelPainter // We are done with this StelPainter
globalMutex->unlock(); globalMutex->unlock();
#endif #endif
} }
void StelPainter::setFont(const QFont& font) void StelPainter::setFont(const QFont& font)
{ {
currentFont = font; currentFont = font;
} }
skipping to change at line 164 skipping to change at line 186
Vec4f StelPainter::getColor() const Vec4f StelPainter::getColor() const
{ {
return currentColor; return currentColor;
} }
QFontMetrics StelPainter::getFontMetrics() const QFontMetrics StelPainter::getFontMetrics() const
{ {
return QFontMetrics(currentFont); return QFontMetrics(currentFont);
} }
void StelPainter::setBlending(bool enableBlending, GLenum blendSrc, GLenum
blendDst)
{
if(enableBlending != glState.blend)
{
glState.blend = enableBlending;
if(enableBlending)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
}
if(enableBlending)
{
if(blendSrc!=glState.blendSrc||blendDst!=glState.blendDst)
{
glState.blendSrc = blendSrc;
glState.blendDst = blendDst;
glBlendFunc(blendSrc,blendDst);
}
}
}
void StelPainter::setDepthTest(bool enable)
{
if(glState.depthTest != enable)
{
glState.depthTest = enable;
if(enable)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
}
}
void StelPainter::setDepthMask(bool enable)
{
if(glState.depthMask != enable)
{
glState.depthMask = enable;
if(enable)
glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
}
}
void StelPainter::setCullFace(bool enable)
{
if(glState.cullFace!=enable)
{
glState.cullFace = enable;
if(enable)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
}
}
void StelPainter::setLineSmooth(bool enable)
{
#ifdef GL_LINE_SMOOTH
if (!QOpenGLContext::currentContext()->isOpenGLES() && enable!=glSta
te.lineSmooth)
{
glState.lineSmooth = enable;
if(enable)
glEnable(GL_LINE_SMOOTH);
else
glDisable(GL_LINE_SMOOTH);
}
#else
Q_UNUSED(enable); //noop
#endif
}
void StelPainter::setLineWidth(float width)
{
if(glState.lineWidth != width)
{
glState.lineWidth = width;
glLineWidth(width);
}
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Standard methods for drawing primitives // Standard methods for drawing primitives
// Fill with black around the circle // Fill with black around the circle
void StelPainter::drawViewportShape(void) void StelPainter::drawViewportShape(void)
{ {
if (prj->maskType != StelProjector::MaskDisk) if (prj->maskType != StelProjector::MaskDisk)
return; return;
bool oldBlendState = glState.blend;
glDisable(GL_BLEND); glDisable(GL_BLEND);
setColor(0.f,0.f,0.f); setColor(0.f,0.f,0.f);
GLfloat innerRadius = 0.5*prj->viewportFovDiameter; GLfloat innerRadius = 0.5*prj->viewportFovDiameter;
GLfloat outerRadius = prj->getViewportWidth()+prj->getViewportHeight (); GLfloat outerRadius = prj->getViewportWidth()+prj->getViewportHeight ();
GLint slices = 239; GLint slices = 239;
GLfloat sinCache[240]; GLfloat sinCache[240];
GLfloat cosCache[240]; GLfloat cosCache[240];
GLfloat vertices[(240+1)*2][3]; GLfloat vertices[(240+1)*2][3];
skipping to change at line 222 skipping to change at line 327
{ {
vertices[i*2][0]= prj->viewportCenter[0] + outerRadius*sinCa che[i]; vertices[i*2][0]= prj->viewportCenter[0] + outerRadius*sinCa che[i];
vertices[i*2][1]= prj->viewportCenter[1] + outerRadius*cosCa che[i]; vertices[i*2][1]= prj->viewportCenter[1] + outerRadius*cosCa che[i];
vertices[i*2][2] = 0.0; vertices[i*2][2] = 0.0;
vertices[i*2+1][0]= prj->viewportCenter[0] + radiusHigh*sinC ache[i]; vertices[i*2+1][0]= prj->viewportCenter[0] + radiusHigh*sinC ache[i];
vertices[i*2+1][1]= prj->viewportCenter[1] + radiusHigh*cosC ache[i]; vertices[i*2+1][1]= prj->viewportCenter[1] + radiusHigh*cosC ache[i];
vertices[i*2+1][2] = 0.0; vertices[i*2+1][2] = 0.0;
} }
drawFromArray(TriangleStrip, (slices+1)*2, 0, false); drawFromArray(TriangleStrip, (slices+1)*2, 0, false);
enableClientStates(false); enableClientStates(false);
if(oldBlendState)
glEnable(GL_BLEND);
} }
void StelPainter::computeFanDisk(float radius, int innerFanSlices, int leve l, QVector<double>& vertexArr, QVector<float>& texCoordArr) void StelPainter::computeFanDisk(float radius, int innerFanSlices, int leve l, QVector<double>& vertexArr, QVector<float>& texCoordArr)
{ {
Q_ASSERT(level<64); Q_ASSERT(level<64);
float rad[64]; float rad[64];
int i,j; int i,j;
rad[level] = radius; rad[level] = radius;
for (i=level-1;i>=0;--i) for (i=level-1;i>=0;--i)
{ {
skipping to change at line 532 skipping to change at line 639
painter.setPen(Qt::white); painter.setPen(Qt::white);
painter.drawText(-strRect.x(), -strRect.y(), str); painter.drawText(-strRect.x(), -strRect.y(), str);
StringTexture* newTex = new StringTexture(new QOpenGLTexture(strImag e.toImage()), QSize(w, h)); StringTexture* newTex = new StringTexture(new QOpenGLTexture(strImag e.toImage()), QSize(w, h));
texCache.insert(hash, newTex, 3*w*h); texCache.insert(hash, newTex, 3*w*h);
// simply returning newTex is dangerous as the object is owned by th e cache now. (Coverity Scan barks.) // simply returning newTex is dangerous as the object is owned by th e cache now. (Coverity Scan barks.)
return texCache.object(hash); return texCache.object(hash);
} }
void StelPainter::drawText(float x, float y, const QString& str, float angl eDeg, float xshift, float yshift, bool noGravity) void StelPainter::drawText(float x, float y, const QString& str, float angl eDeg, float xshift, float yshift, bool noGravity)
{ {
//StelPainter::GLState state; // Will restore the opengl state at th e end of the function.
if (prj->gravityLabels && !noGravity) if (prj->gravityLabels && !noGravity)
{ {
drawTextGravity180(x, y, str, xshift, yshift); drawTextGravity180(x, y, str, xshift, yshift);
} }
else if (qApp->property("text_texture")==true) // CLI option -t give n? else if (qApp->property("text_texture")==true) // CLI option -t give n?
{ {
//qDebug() << "Text texture" << str; //qDebug() << "Text texture" << str;
// This is taken from branch text-use-opengl-buffer. This is essential on devices like Raspberry Pi (2016-03). // This is taken from branch text-use-opengl-buffer. This is essential on devices like Raspberry Pi (2016-03).
StringTexture* tex = getTexTexture(str, currentFont.pixelSiz e()); StringTexture* tex = getTexTexture(str, currentFont.pixelSiz e());
Q_ASSERT(tex); Q_ASSERT(tex);
if (!noGravity) if (!noGravity)
angleDeg += prj->defaultAngleForGravityText; angleDeg += prj->defaultAngleForGravityText;
tex->texture->bind(); tex->texture->bind();
enableTexture2d(true);
static float vertexData[8]; static float vertexData[8];
// compute the vertex coordinates applying the translation a nd the rotation // compute the vertex coordinates applying the translation a nd the rotation
static const float vertexBase[] = {0., 0., 1., 0., 0., 1., 1 ., 1.}; static const float vertexBase[] = {0., 0., 1., 0., 0., 1., 1 ., 1.};
if (std::fabs(angleDeg)>1.f*M_PI/180.f) if (std::fabs(angleDeg)>1.f*M_PI/180.f)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , GL_LINEAR);
const float cosr = std::cos(angleDeg * M_PI/180.); const float cosr = std::cos(angleDeg * M_PI/180.);
const float sinr = std::sin(angleDeg * M_PI/180.); const float sinr = std::sin(angleDeg * M_PI/180.);
for (int i = 0; i < 8; i+=2) for (int i = 0; i < 8; i+=2)
skipping to change at line 581 skipping to change at line 686
} }
} }
float* texCoords = new float[8]; float* texCoords = new float[8];
for (int i=0;i<4;i++) for (int i=0;i<4;i++)
{ {
texCoords[i*2+0] = tex->getTexSize().width() * (i % 2); texCoords[i*2+0] = tex->getTexSize().width() * (i % 2);
texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2); texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2);
} }
setTexCoordPointer(2, GL_FLOAT, texCoords); setTexCoordPointer(2, GL_FLOAT, texCoords);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); //text drawing requires blending, but we reset GL state afte
rwards if necessary
bool oldBlending = glState.blend;
GLenum oldSrc = glState.blendSrc, oldDst = glState.blendDst;
setBlending(true);
enableClientStates(true, true); enableClientStates(true, true);
setVertexPointer(2, GL_FLOAT, vertexData); setVertexPointer(2, GL_FLOAT, vertexData);
drawFromArray(TriangleStrip, 4, 0, false); drawFromArray(TriangleStrip, 4, 0, false);
setBlending(oldBlending, oldSrc, oldDst);
enableClientStates(false, false); enableClientStates(false, false);
tex->texture->release(); tex->texture->release();
delete[] texCoords; delete[] texCoords;
} }
else else
{ {
QOpenGLPaintDevice device; QOpenGLPaintDevice device;
device.setSize(QSize(prj->getViewportWidth(), prj->getViewpo rtHeight())); device.setSize(QSize(prj->getViewportWidth(), prj->getViewpo rtHeight()));
// This doesn't seem to work correctly, so implement the hac k below instead. // This doesn't seem to work correctly, so implement the hac k below instead.
// Maybe check again later, or check on mac with retina.. // Maybe check again later, or check on mac with retina..
// device.setDevicePixelRatio(prj->getDevicePixelsPerPixel() ); // device.setDevicePixelRatio(prj->getDevicePixelsPerPixel() );
// painter.setFont(currentFont); // painter.setFont(currentFont);
QPainter painter(&device); QPainter painter(&device);
painter.beginNativePainting();
QFont tmpFont = currentFont; QFont tmpFont = currentFont;
tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDeviceP ixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio()); tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDeviceP ixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio());
painter.setFont(tmpFont); painter.setFont(tmpFont);
painter.setPen(QColor(currentColor[0]*255, currentColor[1]*2 55, currentColor[2]*255, currentColor[3]*255)); painter.setPen(QColor(currentColor[0]*255, currentColor[1]*2 55, currentColor[2]*255, currentColor[3]*255));
float scaleRatio = StelApp::getInstance().getGlobalScalingRa tio(); float scaleRatio = StelApp::getInstance().getGlobalScalingRa tio();
xshift*=scaleRatio; xshift*=scaleRatio;
yshift*=scaleRatio; yshift*=scaleRatio;
skipping to change at line 631 skipping to change at line 739
m.translate(x, y); m.translate(x, y);
m.rotate(-angleDeg); m.rotate(-angleDeg);
painter.setTransform(m); painter.setTransform(m);
painter.drawText(xshift, yshift, str); painter.drawText(xshift, yshift, str);
} }
else else
{ {
painter.drawText(x+xshift, y+yshift, str); painter.drawText(x+xshift, y+yshift, str);
} }
painter.endNativePainting(); //important to call this before GL state restore
painter.end();
//fix for bug 1628072 caused by QTBUG-56798
#ifndef QT_NO_DEBUG
StelOpenGL::clearGLErrors();
#endif
//QPainter messes up some GL state, begin/endNativePainting
or save/restore does not help
glState.apply();
} }
} }
// Recursive method cutting a small circle in small segments // Recursive method cutting a small circle in small segments
inline void fIter(const StelProjectorP& prj, const Vec3d& p1, const Vec3d& p2, Vec3d& win1, Vec3d& win2, QLinkedList<Vec3d>& vertexList, const QLinked List<Vec3d>::iterator& iter, double radius, const Vec3d& center, int nbI=0, bool checkCrossDiscontinuity=true) inline void fIter(const StelProjectorP& prj, const Vec3d& p1, const Vec3d& p2, Vec3d& win1, Vec3d& win2, QLinkedList<Vec3d>& vertexList, const QLinked List<Vec3d>::iterator& iter, double radius, const Vec3d& center, int nbI=0, bool checkCrossDiscontinuity=true)
{ {
const bool crossDiscontinuity = checkCrossDiscontinuity && prj->inte rsectViewportDiscontinuity(p1+center, p2+center); const bool crossDiscontinuity = checkCrossDiscontinuity && prj->inte rsectViewportDiscontinuity(p1+center, p2+center);
if (crossDiscontinuity && nbI>=10) if (crossDiscontinuity && nbI>=10)
{ {
win1[2]=-2.; win1[2]=-2.;
skipping to change at line 1462 skipping to change at line 1579
return; return;
} }
} }
// Draw the given SphericalPolygon. // Draw the given SphericalPolygon.
void StelPainter::drawSphericalRegion(const SphericalRegion* poly, Spherica lPolygonDrawMode drawMode, const SphericalCap* clippingCap, const bool doSu bDivise, const double maxSqDistortion) void StelPainter::drawSphericalRegion(const SphericalRegion* poly, Spherica lPolygonDrawMode drawMode, const SphericalCap* clippingCap, const bool doSu bDivise, const double maxSqDistortion)
{ {
if (!prj->getBoundingCap().intersects(poly->getBoundingCap())) if (!prj->getBoundingCap().intersects(poly->getBoundingCap()))
return; return;
bool oldCullFace = glState.cullFace;
switch (drawMode) switch (drawMode)
{ {
case SphericalPolygonDrawModeBoundary: case SphericalPolygonDrawModeBoundary:
if (doSubDivise || prj->intersectViewportDiscontinui ty(poly->getBoundingCap())) if (doSubDivise || prj->intersectViewportDiscontinui ty(poly->getBoundingCap()))
drawGreatCircleArcs(poly->getOutlineVertexAr ray(), clippingCap); drawGreatCircleArcs(poly->getOutlineVertexAr ray(), clippingCap);
else else
drawStelVertexArray(poly->getOutlineVertexAr ray(), false); drawStelVertexArray(poly->getOutlineVertexAr ray(), false);
break; break;
case SphericalPolygonDrawModeFill: case SphericalPolygonDrawModeFill:
case SphericalPolygonDrawModeTextureFill: case SphericalPolygonDrawModeTextureFill:
case SphericalPolygonDrawModeTextureFillColormodulated: case SphericalPolygonDrawModeTextureFillColormodulated:
glEnable(GL_CULL_FACE); setCullFace(true);
// The polygon is already tesselated as triangles // The polygon is already tesselated as triangles
if (doSubDivise || prj->intersectViewportDiscontinui ty(poly->getBoundingCap())) if (doSubDivise || prj->intersectViewportDiscontinui ty(poly->getBoundingCap()))
// flag for color-modulated textured mode (e .g. for Milky Way/extincted) // flag for color-modulated textured mode (e .g. for Milky Way/extincted)
drawSphericalTriangles(poly->getFillVertexAr ray(), drawMode>=SphericalPolygonDrawModeTextureFill, drawMode==SphericalPo lygonDrawModeTextureFillColormodulated, clippingCap, doSubDivise, maxSqDist ortion); drawSphericalTriangles(poly->getFillVertexAr ray(), drawMode>=SphericalPolygonDrawModeTextureFill, drawMode==SphericalPo lygonDrawModeTextureFillColormodulated, clippingCap, doSubDivise, maxSqDist ortion);
else else
drawStelVertexArray(poly->getFillVertexArray (), false); drawStelVertexArray(poly->getFillVertexArray (), false);
glDisable(GL_CULL_FACE); setCullFace(oldCullFace);
break; break;
default: default:
Q_ASSERT(0); Q_ASSERT(0);
} }
} }
/************************************************************************* /*************************************************************************
draw a simple circle, 2d viewport coordinates in pixel draw a simple circle, 2d viewport coordinates in pixel
*************************************************************************/ *************************************************************************/
void StelPainter::drawCircle(float x, float y, float r) void StelPainter::drawCircle(float x, float y, float r)
skipping to change at line 1820 skipping to change at line 1939
vertexArray.append(Vec3d(x*radius, y*radius, height)); vertexArray.append(Vec3d(x*radius, y*radius, height));
s += ds; s += ds;
} }
setArrays(vertexArray.constData(), texCoordArray.constData()); setArrays(vertexArray.constData(), texCoordArray.constData());
drawFromArray(TriangleStrip, vertexArray.size()); drawFromArray(TriangleStrip, vertexArray.size());
if (orientInside) if (orientInside)
glCullFace(GL_BACK); glCullFace(GL_BACK);
} }
void StelPainter::enableTexture2d(bool b)
{
texture2dEnabled = b;
}
void StelPainter::initGLShaders() void StelPainter::initGLShaders()
{ {
qDebug() << "Initializing basic GL shaders... "; qDebug() << "Initializing basic GL shaders... ";
// Basic shader: just vertex filled with plain color // Basic shader: just vertex filled with plain color
QOpenGLShader vshader3(QOpenGLShader::Vertex); QOpenGLShader vshader3(QOpenGLShader::Vertex);
const char *vsrc3 = const char *vsrc3 =
"attribute mediump vec3 vertex;\n" "attribute mediump vec3 vertex;\n"
"uniform mediump mat4 projectionMatrix;\n" "uniform mediump mat4 projectionMatrix;\n"
"void main(void)\n" "void main(void)\n"
"{\n" "{\n"
 End of changes. 26 change blocks. 
35 lines changed or deleted 153 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/