Hopefully fixed the problem regarding objects not getting drawn at first

Sat, 18 May 2013 23:47:33 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 18 May 2013 23:47:33 +0300
changeset 216
c8882ff62d61
parent 215
eab460199114
child 217
cad8c046f27a

Hopefully fixed the problem regarding objects not getting drawn at first

src/gldraw.cpp file | annotate | diff | comparison | revisions
src/ldtypes.cpp file | annotate | diff | comparison | revisions
src/ldtypes.h file | annotate | diff | comparison | revisions
--- a/src/gldraw.cpp	Sat May 18 21:36:01 2013 +0300
+++ b/src/gldraw.cpp	Sat May 18 23:47:33 2013 +0300
@@ -1240,6 +1240,8 @@
 		
 		glEndList ();
 	}
+	
+	obj->m_glinit = true;
 }
 
 // =============================================================================
@@ -1278,8 +1280,14 @@
 
 // =============================================================================
 void GLRenderer::deleteLists (LDObject* obj) {
+	// Delete the lists but only if they have been initialized
+	if (!obj->m_glinit)
+		return;
+	
 	for (const GL::ListType listType : g_glListTypes)
 		glDeleteLists (obj->glLists[listType], 1);
+	
+	obj->m_glinit = false;
 }
 
 // =============================================================================
--- a/src/ldtypes.cpp	Sat May 18 21:36:01 2013 +0300
+++ b/src/ldtypes.cpp	Sat May 18 23:47:33 2013 +0300
@@ -64,6 +64,7 @@
 	parent = null;
 	m_hidden = false;
 	m_selected = false;
+	m_glinit = false;
 }
 
 LDGibberish::LDGibberish (str _zContent, str _zReason) {
--- a/src/ldtypes.h	Sat May 18 21:36:01 2013 +0300
+++ b/src/ldtypes.h	Sat May 18 23:47:33 2013 +0300
@@ -169,9 +169,12 @@
 	bool					selected		() const { return m_selected; }
 	void					setSelected	(bool selected) { m_selected = selected; }
 
+protected:
+	bool m_glinit;
+	friend class GLRenderer;
+
 private:
-	bool m_hidden;
-	bool m_selected;
+	bool m_hidden, m_selected;
 };
 
 // =============================================================================

mercurial