renderer: cleanups

This commit is contained in:
Hannes Janetzek 2014-07-22 23:03:32 +02:00
parent e645696adb
commit 123b0aa098
5 changed files with 11 additions and 7 deletions

View File

@ -96,6 +96,10 @@ public final class BufferObject extends Inlist<BufferObject> {
private final static BufferObject pool[] = new BufferObject[2]; private final static BufferObject pool[] = new BufferObject[2];
private final static int counter[] = new int[2]; private final static int counter[] = new int[2];
/**
* @param target can be GL20.GL_ARRAY_BUFFER or GL20.GL_ELEMENT_ARRAY_BUFFER
* @param size requested size in bytes. optional - can be 0.
*/
public static synchronized BufferObject get(int target, int size) { public static synchronized BufferObject get(int target, int size) {
int t = (target == GL20.GL_ARRAY_BUFFER) ? 0 : 1; int t = (target == GL20.GL_ARRAY_BUFFER) ? 0 : 1;

View File

@ -120,7 +120,7 @@ public abstract class ElementRenderer extends LayerRenderer {
continue; continue;
} }
log.debug("invalid layer {}", l.type); log.error("invalid layer {}", l.type);
break; break;
} }
@ -136,7 +136,7 @@ public abstract class ElementRenderer extends LayerRenderer {
l = TextureLayer.Renderer.draw(layers, l, v, div); l = TextureLayer.Renderer.draw(layers, l, v, div);
continue; continue;
} }
log.debug("invalid layer {}", l.type); log.error("invalid layer {}", l.type);
break; break;
} }
} }

View File

@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory;
public abstract class GLShader { public abstract class GLShader {
final static Logger log = LoggerFactory.getLogger(GLShader.class); final static Logger log = LoggerFactory.getLogger(GLShader.class);
private static GL20 GL; protected static GL20 GL;
public int program; public int program;

View File

@ -28,6 +28,7 @@ import org.oscim.backend.canvas.Color;
import org.oscim.map.Map; import org.oscim.map.Map;
import org.oscim.renderer.elements.ElementLayers; import org.oscim.renderer.elements.ElementLayers;
import org.oscim.renderer.elements.TextureItem; import org.oscim.renderer.elements.TextureItem;
import org.oscim.renderer.elements.TextureLayer;
import org.oscim.utils.pool.Inlist; import org.oscim.utils.pool.Inlist;
import org.oscim.utils.pool.Pool; import org.oscim.utils.pool.Pool;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -234,8 +235,7 @@ public class MapRenderer {
} }
public void onSurfaceChanged(int width, int height) { public void onSurfaceChanged(int width, int height) {
log.debug("onSurfaceChanged: new={}, {}x{}", //log.debug("onSurfaceChanged: new={}, {}x{}", mNewSurface, width, height);
mNewSurface, width, height);
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
return; return;
@ -266,7 +266,7 @@ public class MapRenderer {
int[] vboIds = GLUtils.glGenBuffers(2); int[] vboIds = GLUtils.glGenBuffers(2);
mQuadIndicesID = vboIds[0]; mQuadIndicesID = vboIds[0];
int maxIndices = maxQuads * 6; int maxIndices = maxQuads * TextureLayer.INDICES_PER_SPRITE;
short[] indices = new short[maxIndices]; short[] indices = new short[maxIndices];
for (int i = 0, j = 0; i < maxIndices; i += 6, j += 4) { for (int i = 0, j = 0; i < maxIndices; i += 6, j += 4) {
indices[i + 0] = (short) (j + 0); indices[i + 0] = (short) (j + 0);

View File

@ -42,7 +42,7 @@ public class ExtrusionLayers extends TileData {
} }
public ExtrusionLayer getLayers() { public ExtrusionLayer getLayers() {
return (ExtrusionLayer) layers; return layers;
} }
@Override @Override