66 extern_cfg (Bool, gl_blackedges); |
66 extern_cfg (Bool, gl_blackedges); |
67 extern_cfg (String, gl_bgcolor); |
67 extern_cfg (String, gl_bgcolor); |
68 static QList<short> g_warnedColors; |
68 static QList<short> g_warnedColors; |
69 static const QColor g_BFCFrontColor (40, 192, 40); |
69 static const QColor g_BFCFrontColor (40, 192, 40); |
70 static const QColor g_BFCBackColor (224, 40, 40); |
70 static const QColor g_BFCBackColor (224, 40, 40); |
|
71 static QMap<LDObject*, QString> g_objectOrigins; |
71 |
72 |
72 // ============================================================================= |
73 // ============================================================================= |
73 // |
74 // |
74 void checkGLError_private (const char* file, int line) |
75 void checkGLError_private (const char* file, int line) |
75 { |
76 { |
246 QVector<GLfloat> vbodata; |
247 QVector<GLfloat> vbodata; |
247 |
248 |
248 for (auto it = m_objectInfo.begin(); it != m_objectInfo.end(); ++it) |
249 for (auto it = m_objectInfo.begin(); it != m_objectInfo.end(); ++it) |
249 { |
250 { |
250 if (it.key()->document() == getCurrentDocument()) |
251 if (it.key()->document() == getCurrentDocument()) |
|
252 { |
|
253 print ("merge %1\n", it.key()->id()); |
251 vbodata += it->data[vbonum]; |
254 vbodata += it->data[vbonum]; |
|
255 } |
252 } |
256 } |
253 |
257 |
254 glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); |
258 glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); |
255 glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_DYNAMIC_DRAW); |
259 glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_STATIC_DRAW); |
256 glBindBuffer (GL_ARRAY_BUFFER, 0); |
260 glBindBuffer (GL_ARRAY_BUFFER, 0); |
257 checkGLError(); |
261 checkGLError(); |
258 m_vboChanged[vbonum] = false; |
262 m_vboChanged[vbonum] = false; |
259 m_vboSizes[vbonum] = vbodata.size(); |
263 m_vboSizes[vbonum] = vbodata.size(); |
260 } |
264 } |
274 |
278 |
275 // ============================================================================= |
279 // ============================================================================= |
276 // |
280 // |
277 void GLCompiler::compileObject (LDObject* obj) |
281 void GLCompiler::compileObject (LDObject* obj) |
278 { |
282 { |
279 print ("compiling #%1 (%2, %3)\n", obj->id(), obj->typeName(), obj->origin()); |
283 if (obj->document()->isImplicit()) |
|
284 return; |
|
285 |
|
286 g_objectOrigins[obj] = obj->document()->getDisplayName() + ":" + QString::number (obj->lineNumber()); |
|
287 |
|
288 if (obj->id() == 563) |
|
289 print ("compile %1\n", g_objectOrigins[obj]); |
|
290 |
280 ObjectVBOInfo info; |
291 ObjectVBOInfo info; |
281 dropObject (obj); |
292 dropObject (obj); |
282 compileSubObject (obj, obj, &info); |
293 compileSubObject (obj, obj, &info); |
283 m_objectInfo[obj] = info; |
294 m_objectInfo[obj] = info; |
284 needMerge(); |
295 needMerge(); |
285 print ("#%1 compiled.\n", obj->id()); |
|
286 } |
296 } |
287 |
297 |
288 // ============================================================================= |
298 // ============================================================================= |
289 // |
299 // |
290 void GLCompiler::compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo) |
300 void GLCompiler::compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo) |