20 #ifndef _STELQGL1RENDERER_HPP_
21 #define _STELQGL1RENDERER_HPP_
26 #include "StelApp.hpp"
27 #include "StelCore.hpp"
28 #include "StelQGLRenderer.hpp"
29 #include "StelProjector.hpp"
30 #include "StelProjectorClasses.hpp"
31 #include "StelQGL1InterleavedArrayVertexBufferBackend.hpp"
71 Q_ASSERT_X(!initialized, Q_FUNC_INFO,
72 "StelQGL1Renderer is already initialized");
80 qWarning() <<
"StelQGL1Renderer::init : parent init failed";
103 (
const PrimitiveType primitiveType,
const QVector<StelVertexAttribute>& attributes)
113 bool dontProject =
false)
119 Q_ASSERT_X(backend != NULL, Q_FUNC_INFO,
120 "StelQGL1Renderer: Vertex buffer created by different renderer backend "
124 if(indexBuffer != NULL)
127 Q_ASSERT_X(glIndexBuffer != NULL, Q_FUNC_INFO,
128 "StelQGL1Renderer: Index buffer created by different renderer "
129 "backend or uninitialized");
130 if(indexBuffer->length() == 0)
136 else if(backend->
length() == 0)
143 glMatrixMode(GL_TEXTURE);
145 glMatrixMode(GL_PROJECTION);
147 glMatrixMode(GL_MODELVIEW);
151 glDisable(GL_LIGHTING);
152 glDisable(GL_MULTISAMPLE);
153 glDisable(GL_DITHER);
154 glDisable(GL_ALPHA_TEST);
155 glEnable(GL_LINE_SMOOTH);
157 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
158 glShadeModel(GL_SMOOTH);
167 projector = (NULL != projector ? projector : &(*(projector2DDummy)));
169 if(!dontProject && (NULL == dynamic_cast<StelProjector2d*>(projector)))
172 statistics[BATCH_PROJECTIONS_CPU_TOTAL] += 1.0;
177 statistics[BATCH_PROJECTIONS_NONE_TOTAL] += 1.0;
187 const Vec4i viewXywh = projector->getViewportXywh();
188 glViewport(viewXywh[0], viewXywh[1], viewXywh[2], viewXywh[3]);
190 backend->
draw(*
this, projector->getProjectionMatrix(), glIndexBuffer);
196 glMatrixMode(GL_TEXTURE);
198 glMatrixMode(GL_PROJECTION);
200 glMatrixMode(GL_MODELVIEW);
209 if(!
gl.hasOpenGLFeature(QGLFunctions::Multitexture))
213 int textureUnitCount;
214 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &textureUnitCount);
215 return std::max(textureUnitCount, STELQGLRENDERER_MAX_TEXTURE_UNITS);
221 Q_ASSERT_X(initialized, Q_FUNC_INFO,
"uninitialized StelQGL1Renderer");
231 #endif // _STELQGL1RENDERER_HPP_