GLUtils: workaround for texture memory leaks on desktop, fixes #2

This commit is contained in:
Emux 2016-06-17 11:01:55 +03:00
parent e0f02323bb
commit 0a465abbfe

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
* *
@ -248,7 +249,12 @@ public class GLUtils {
return null; return null;
int[] ret = new int[num]; int[] ret = new int[num];
IntBuffer buf = MapRenderer.getIntBuffer(num); // Workaround for texture memory leaks on desktop
IntBuffer buf;
if (GLAdapter.GDX_DESKTOP_QUIRKS)
buf = ByteBuffer.allocateDirect(num * 4).order(ByteOrder.nativeOrder()).asIntBuffer();
else
buf = MapRenderer.getIntBuffer(num);
if (GLAdapter.GDX_WEBGL_QUIRKS) { if (GLAdapter.GDX_WEBGL_QUIRKS) {
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {