workaround for libgdx only creating one texture at once..
This commit is contained in:
parent
fb25006b5a
commit
20ed6e333c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013
|
* Copyright 2013 Hannes Janetzek
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@ -14,10 +14,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.backend;
|
package org.oscim.backend;
|
||||||
|
|
||||||
//import com.badlogic.gdx.backends.android.AndroidGL20;
|
|
||||||
|
|
||||||
public class GLAdapter {
|
public class GLAdapter {
|
||||||
public static GL20 INSTANCE; //= new AndroidGL20();
|
public static GL20 INSTANCE;
|
||||||
|
|
||||||
|
public static boolean GDX_WEBGL_QUIRKS;
|
||||||
|
public static boolean NON_PREMUL_CANVAS;
|
||||||
|
|
||||||
public static GL20 get(){
|
public static GL20 get(){
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
|
|||||||
@ -238,7 +238,7 @@ public class GlUtils {
|
|||||||
GL = GLAdapter.get();
|
GL = GLAdapter.get();
|
||||||
|
|
||||||
int error;
|
int error;
|
||||||
while ((error = GL.glGetError()) != 0) { //GL20.GL_NO_ERROR) {
|
while ((error = GL.glGetError()) != 0) { // GL20.GL_NO_ERROR) {
|
||||||
Log.e(TAG, op + ": glError " + error);
|
Log.e(TAG, op + ": glError " + error);
|
||||||
// throw new RuntimeException(op + ": glError " + error);
|
// throw new RuntimeException(op + ": glError " + error);
|
||||||
}
|
}
|
||||||
@ -366,15 +366,22 @@ public class GlUtils {
|
|||||||
|
|
||||||
public static int[] glGenTextures(int num) {
|
public static int[] glGenTextures(int num) {
|
||||||
GL = GLAdapter.get();
|
GL = GLAdapter.get();
|
||||||
|
|
||||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
|
||||||
buf.position(0);
|
|
||||||
buf.limit(num);
|
|
||||||
GL.glGenTextures(num, buf);
|
|
||||||
int[] ret = new int[num];
|
int[] ret = new int[num];
|
||||||
buf.position(0);
|
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||||
buf.limit(num);
|
|
||||||
buf.get(ret);
|
if (GLAdapter.GDX_WEBGL_QUIRKS) {
|
||||||
|
for (int i = 0; i < num; i++) {
|
||||||
|
GL.glGenTextures(num, buf);
|
||||||
|
buf.position(0);
|
||||||
|
ret[i] = buf.get();
|
||||||
|
buf.position(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GL.glGenTextures(num, buf);
|
||||||
|
buf.position(0);
|
||||||
|
buf.get(ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user