]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
fix a bug where submodels are not uploaded in a VBO which can cause bad
[xonotic/darkplaces.git] / model_shared.c
index 89087d7adf19c3eaac53e40fb9df97f9168d4ce9..c54375043d7bfbcb469df518c51fb4d3e2575c09 100644 (file)
@@ -148,7 +148,6 @@ Mod_Init
 static void Mod_Print(void);
 static void Mod_Precache (void);
 static void Mod_Decompile_f(void);
-static void Mod_BuildVBOs(void);
 static void Mod_GenerateLightmaps_f(void);
 void Mod_Init (void)
 {
@@ -1149,6 +1148,8 @@ static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
 {
        if (!vid.support.arb_vertex_buffer_object)
                return;
+       if (mesh->vbo)
+               return;
 
        // element buffer is easy because it's just one array
        if (mesh->numtriangles)
@@ -2481,7 +2482,7 @@ void Mod_MakeSortedSurfaces(dp_model_t *mod)
        Mem_Free(numsurfacesfortexture);
 }
 
-static void Mod_BuildVBOs(void)
+void Mod_BuildVBOs(void)
 {
        if (gl_paranoid.integer && loadmodel->surfmesh.data_element3s && loadmodel->surfmesh.data_element3i)
        {
@@ -2498,6 +2499,9 @@ static void Mod_BuildVBOs(void)
 
        if (!vid.support.arb_vertex_buffer_object)
                return;
+       // only build a vbo if one has not already been created (this is important for brush models which load specially)
+       if (loadmodel->surfmesh.vbo)
+               return;
 
        // element buffer is easy because it's just one array
        if (loadmodel->surfmesh.num_triangles)