| 1237 | } |
| 1238 | |
| 1239 | void window::clearGraphicsMemory(){ |
| 1240 | cout << "Clearing graphics memory" << endl; |
| 1241 | |
| 1242 | while (currentlyRendering){ |
| 1243 | __asm__("nop"); //wait for rendering to finish |
| 1244 | } |
| 1245 | //do not allow further rendering: |
| 1246 | setGraphicsLock(true); |
| 1247 | |
| 1248 | graphicsList.clear(); |
| 1249 | graphicsList.shrink_to_fit(); |
| 1250 | |
| 1251 | for (int i = 0; i < vectorShapeGLuint.size(); i++){ |
| 1252 | glDeleteVertexArrays(1, &vectorShapeGLuint[i]); |
| 1253 | } |
| 1254 | vectorShapeGLuint.clear(); |
| 1255 | vectorShapeGLuint.shrink_to_fit(); |
| 1256 | |
| 1257 | for (int i = 0; i < vectorCircleuint.size(); i++){ |
| 1258 | glDeleteVertexArrays(1, &vectorCircleuint[i]); |
| 1259 | } |
| 1260 | vectorCircleuint.clear(); |
| 1261 | vectorCircleuint.shrink_to_fit(); |
| 1262 | vectorCircleSegments.clear(); |
| 1263 | vectorCircleSegments.shrink_to_fit(); |
| 1264 | |
| 1265 | for (int i = 0; i < vectorTextGLuint.size(); i++){ |
| 1266 | glDeleteVertexArrays(1, &vectorTextGLuint[i]); |
| 1267 | } |
| 1268 | vectorTextGLuint.clear(); |
| 1269 | vectorTextGLuint.shrink_to_fit(); |
| 1270 | |
| 1271 | for (int i = 0; i < vectorTextures.size(); i++){ |
| 1272 | glDeleteTextures(1, &vectorTextures[i]); |
| 1273 | } |
| 1274 | vectorTextures.clear(); |
| 1275 | vectorTextures.shrink_to_fit(); |
| 1276 | |
| 1277 | backgroundImgIndex = 0; |
| 1278 | backgroundImageOn = false; |
| 1279 | |
| 1280 | for (int i = 0; i < customShaderPrograms.size(); i++){ |
| 1281 | shader->shaderProgramDestroy(customShaderPrograms[i]); |
| 1282 | } |
| 1283 | customShaderPrograms.clear(); |
| 1284 | customShaderPrograms.shrink_to_fit(); |
| 1285 | |
| 1286 | glDeleteTextures(1, &videoTexture); |
| 1287 | videoTexture = -1; |
| 1288 | |
| 1289 | videoSurfaceBuffer.clear(); |
| 1290 | videoSurfaceBuffer.shrink_to_fit(); |
| 1291 | |
| 1292 | glDeleteVertexArrays(1, &videoVerticies); |
| 1293 | videoStarted = false; |
| 1294 | videoReady = false; |
| 1295 | fCount = 0; |
| 1296 |
no test coverage detected