fix invalid textures on resume
This commit is contained in:
parent
43e9c6ebd9
commit
2926b340c4
@ -30,8 +30,7 @@ public class Layers {
|
|||||||
PolygonRenderer.init();
|
PolygonRenderer.init();
|
||||||
TextureRenderer.init();
|
TextureRenderer.init();
|
||||||
BitmapRenderer.init();
|
BitmapRenderer.init();
|
||||||
|
TextureItem.init(0);
|
||||||
TextureItem.init(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mixed Polygon- and LineLayer
|
// mixed Polygon- and LineLayer
|
||||||
|
@ -26,7 +26,7 @@ import org.oscim.utils.GlUtils;
|
|||||||
import org.oscim.utils.pool.Inlist;
|
import org.oscim.utils.pool.Inlist;
|
||||||
import org.oscim.utils.pool.SyncPool;
|
import org.oscim.utils.pool.SyncPool;
|
||||||
|
|
||||||
// FIXME
|
// FIXME needs rewrite!
|
||||||
|
|
||||||
public class TextureItem extends Inlist<TextureItem> {
|
public class TextureItem extends Inlist<TextureItem> {
|
||||||
private final static String TAG = TextureItem.class.getName();
|
private final static String TAG = TextureItem.class.getName();
|
||||||
@ -114,21 +114,26 @@ public class TextureItem extends Inlist<TextureItem> {
|
|||||||
static class TextureItemPool extends SyncPool<TextureItem> {
|
static class TextureItemPool extends SyncPool<TextureItem> {
|
||||||
|
|
||||||
public TextureItemPool() {
|
public TextureItemPool() {
|
||||||
super(20);
|
super(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int num) {
|
public void init(int num) {
|
||||||
//int[] textureIds = GlUtils.glGenTextures(num);
|
if (pool != null){
|
||||||
//
|
Log.d(TAG, "still textures in pool! " + fill);
|
||||||
//for (int i = 0; i < num; i++) {
|
pool = null;
|
||||||
// initTexture(textureIds[i]);
|
}
|
||||||
// TextureItem to = new TextureItem(textureIds[i]);
|
|
||||||
// pool = Inlist.push(pool, to);
|
int[] textureIds = GlUtils.glGenTextures(num);
|
||||||
//}
|
|
||||||
//fill = num;
|
|
||||||
|
|
||||||
fill = 0;
|
for (int i = 0; i < num; i++) {
|
||||||
|
TextureItem to = new TextureItem(textureIds[i]);
|
||||||
|
initTexture(to);
|
||||||
|
|
||||||
|
pool = Inlist.push(pool, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
fill = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureItem get(int width, int height) {
|
public TextureItem get(int width, int height) {
|
||||||
@ -288,9 +293,11 @@ public class TextureItem extends Inlist<TextureItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void init(int num) {
|
static void init(int num) {
|
||||||
|
Log.d(TAG, "init textures " + num);
|
||||||
pool.init(num);
|
|
||||||
mTexCnt = num;
|
mTexCnt = num;
|
||||||
|
pool.init(num);
|
||||||
|
|
||||||
|
//mTexCnt = num;
|
||||||
|
|
||||||
mBitmaps.clear();
|
mBitmaps.clear();
|
||||||
mTextures.clear();
|
mTextures.clear();
|
||||||
|
@ -365,6 +365,9 @@ public class GlUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int[] glGenTextures(int num) {
|
public static int[] glGenTextures(int num) {
|
||||||
|
if (num <= 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
GL = GLAdapter.get();
|
GL = GLAdapter.get();
|
||||||
int[] ret = new int[num];
|
int[] ret = new int[num];
|
||||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user