StelPainter.cpp   StelPainter.cpp 
skipping to change at line 515 skipping to change at line 515
subTexHeight(0) {;} subTexHeight(0) {;}
~StringTexture() ~StringTexture()
{ {
if (texture != 0) if (texture != 0)
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
} }
}; };
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 the end of the function. //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 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..
skipping to change at line 601 skipping to change at line 601
{ {
// Use the 3rd component of the vector to store whether the vertex is valid // Use the 3rd component of the vector to store whether the vertex is valid
win3[2]= isValidVertex ? 1.0 : -1.; win3[2]= isValidVertex ? 1.0 : -1.;
fIter(prj, p1, newVertex, win1, win3, vertexList, vertexList .insert(iter, win3), radius, center, nbI+1, crossDiscontinuity || dist>50*5 0); fIter(prj, p1, newVertex, win1, win3, vertexList, vertexList .insert(iter, win3), radius, center, nbI+1, crossDiscontinuity || dist>50*5 0);
fIter(prj, newVertex, p2, win3, win2, vertexList, iter, radi us, center, nbI+1, crossDiscontinuity || dist>50*50 ); fIter(prj, newVertex, p2, win3, win2, vertexList, iter, radi us, center, nbI+1, crossDiscontinuity || dist>50*50 );
} }
} }
// Used by the method below // Used by the method below
QVector<Vec2f> StelPainter::smallCircleVertexArray; QVector<Vec2f> StelPainter::smallCircleVertexArray;
QVector<Vec4f> StelPainter::smallCircleColorArray;
void StelPainter::drawSmallCircleVertexArray() void StelPainter::drawSmallCircleVertexArray()
{ {
if (smallCircleVertexArray.isEmpty()) if (smallCircleVertexArray.isEmpty())
return; return;
Q_ASSERT(smallCircleVertexArray.size()>1); Q_ASSERT(smallCircleVertexArray.size()>1);
enableClientStates(true); enableClientStates(true, false, !smallCircleColorArray.isEmpty());
setVertexPointer(2, GL_FLOAT, smallCircleVertexArray.constData()); setVertexPointer(2, GL_FLOAT, smallCircleVertexArray.constData());
if (!smallCircleColorArray.isEmpty())
setColorPointer(4, GL_FLOAT, smallCircleColorArray.constData
());
drawFromArray(LineStrip, smallCircleVertexArray.size(), 0, false); drawFromArray(LineStrip, smallCircleVertexArray.size(), 0, false);
enableClientStates(false); enableClientStates(false);
smallCircleVertexArray.resize(0); smallCircleVertexArray.resize(0);
smallCircleColorArray.resize(0);
} }
static Vec3d pt1, pt2; static Vec3d pt1, pt2;
void StelPainter::drawGreatCircleArc(const Vec3d& start, const Vec3d& stop, const SphericalCap* clippingCap, void StelPainter::drawGreatCircleArc(const Vec3d& start, const Vec3d& stop, const SphericalCap* clippingCap,
void (*viewportEdgeIntersectCallback)(const Vec3d& screenPos, const Vec3d& direction, void* userData), void* userData) void (*viewportEdgeIntersectCallback)(const Vec3d& screenPos, const Vec3d& direction, void* userData), void* userData)
{ {
if (clippingCap) if (clippingCap)
{ {
pt1=start; pt1=start;
pt2=stop; pt2=stop;
skipping to change at line 696 skipping to change at line 700
{ {
// Break the line, draw the stored vertex and flush the list // Break the line, draw the stored vertex and flush the list
if (!smallCircleVertexArray.isEmpty()) if (!smallCircleVertexArray.isEmpty())
smallCircleVertexArray.append(Vec2f(p1[0], p 1[1])); smallCircleVertexArray.append(Vec2f(p1[0], p 1[1]));
drawSmallCircleVertexArray(); drawSmallCircleVertexArray();
} }
} }
Q_ASSERT(smallCircleVertexArray.isEmpty()); Q_ASSERT(smallCircleVertexArray.isEmpty());
} }
void StelPainter::drawPath(const QVector<Vec3d> &points, const QVector<Vec4
f> &colors)
{
// Because the path may intersect a viewport discontinuity, we canno
t render
// it in one OpenGL drawing call.
Q_ASSERT(smallCircleVertexArray.isEmpty());
Q_ASSERT(smallCircleColorArray.isEmpty());
Q_ASSERT(points.size() == colors.size());
Vec3d win;
for (int i = 0; i+1 != points.size(); i++)
{
const Vec3d p1 = points[i];
const Vec3d p2 = points[i + 1];
if (!prj->intersectViewportDiscontinuity(p1, p2))
{
prj->project(p1, win);
smallCircleVertexArray.append(Vec2f(win[0], win[1]))
;
smallCircleColorArray.append(colors[i]);
if (i+2==points.size())
{
prj->project(p2, win);
smallCircleVertexArray.append(Vec2f(win[0],
win[1]));
smallCircleColorArray.append(colors[i + 1]);
drawSmallCircleVertexArray();
}
}
else
{
// Break the line, draw the stored vertex and flush
the list
if (!smallCircleVertexArray.isEmpty())
{
prj->project(p1, win);
smallCircleVertexArray.append(Vec2f(win[0],
win[1]));
smallCircleColorArray.append(colors[i]);
}
drawSmallCircleVertexArray();
}
}
Q_ASSERT(smallCircleVertexArray.isEmpty());
Q_ASSERT(smallCircleColorArray.isEmpty());
}
// Project the passed triangle on the screen ensuring that it will look smo oth, even for non linear distortion // Project the passed triangle on the screen ensuring that it will look smo oth, even for non linear distortion
// by splitting it into subtriangles. // by splitting it into subtriangles.
void StelPainter::projectSphericalTriangle(const SphericalCap* clippingCap, const Vec3d* vertices, QVarLengthArray<Vec3f, 4096>* outVertices, void StelPainter::projectSphericalTriangle(const SphericalCap* clippingCap, const Vec3d* vertices, QVarLengthArray<Vec3f, 4096>* outVertices,
const Vec2f* texturePos, QVarLengthArray<Vec2f, 4096>* outTexturePo s, const Vec3f *colors, QVarLengthArray<Vec3f, 4096> *outColors, const Vec2f* texturePos, QVarLengthArray<Vec2f, 4096>* outTexturePo s, const Vec3f *colors, QVarLengthArray<Vec3f, 4096> *outColors,
double maxSqDistortion, int nbI, bool checkDisc1, bool checkDisc2, bool checkDisc3) const double maxSqDistortion, int nbI, bool checkDisc1, bool checkDisc2, bool checkDisc3) const
{ {
Q_ASSERT(fabs(vertices[0].length()-1.)<0.00001); Q_ASSERT(fabs(vertices[0].length()-1.)<0.00001);
Q_ASSERT(fabs(vertices[1].length()-1.)<0.00001); Q_ASSERT(fabs(vertices[1].length()-1.)<0.00001);
Q_ASSERT(fabs(vertices[2].length()-1.)<0.00001); Q_ASSERT(fabs(vertices[2].length()-1.)<0.00001);
if (clippingCap && clippingCap->containsTriangle(vertices)) if (clippingCap && clippingCap->containsTriangle(vertices))
skipping to change at line 1711 skipping to change at line 1756
glCullFace(GL_BACK); glCullFace(GL_BACK);
} }
void StelPainter::enableTexture2d(bool b) void StelPainter::enableTexture2d(bool b)
{ {
texture2dEnabled = b; texture2dEnabled = b;
} }
void StelPainter::initGLShaders() void StelPainter::initGLShaders()
{ {
qWarning() << "Intializing 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"
" gl_Position = projectionMatrix*vec4(vertex, 1.);\n" " gl_Position = projectionMatrix*vec4(vertex, 1.);\n"
"}\n"; "}\n";
vshader3.compileSourceCode(vsrc3); vshader3.compileSourceCode(vsrc3);
 End of changes. 7 change blocks. 
3 lines changed or deleted 55 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/