workaround for libgdx only creating one texture at once..

This commit is contained in:
Hannes Janetzek 2013-06-28 04:03:11 +02:00
parent fb25006b5a
commit 20ed6e333c
2 changed files with 21 additions and 12 deletions

View File

@ -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
* terms of the GNU Lesser General Public License as published by the Free Software
@ -14,10 +14,12 @@
*/
package org.oscim.backend;
//import com.badlogic.gdx.backends.android.AndroidGL20;
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(){
return INSTANCE;

View File

@ -238,7 +238,7 @@ public class GlUtils {
GL = GLAdapter.get();
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);
// throw new RuntimeException(op + ": glError " + error);
}
@ -366,15 +366,22 @@ public class GlUtils {
public static int[] glGenTextures(int num) {
GL = GLAdapter.get();
IntBuffer buf = GLRenderer.getIntBuffer(num);
buf.position(0);
buf.limit(num);
GL.glGenTextures(num, buf);
int[] ret = new int[num];
buf.position(0);
buf.limit(num);
buf.get(ret);
IntBuffer buf = GLRenderer.getIntBuffer(num);
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;
}