fixing lwjgl stuff
This commit is contained in:
parent
5521583bd8
commit
30839efffd
@ -1,3 +1,4 @@
|
||||
package org.oscim.android;
|
||||
///*
|
||||
// * Copyright 2010, 2011, 2012 mapsforge.org
|
||||
// * Copyright 2013 Hannes Janetzek
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="assets"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="lib" path="/vtm-gdx/libs/gdx.jar" sourcepath="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/gdx-backend-android.jar" sourcepath="libs/gdx-backend-android-sources.jar"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="assets"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/gdx-backend-android.jar" sourcepath="libs/gdx-backend-android-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="/vtm-gdx/libs/gdx.jar" sourcepath="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
</classpath>
|
||||
|
@ -14,6 +14,7 @@ import android.os.Bundle;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
import com.badlogic.gdx.backends.android.AndroidGL20;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
public class MainActivity extends AndroidApplication {
|
||||
|
||||
@ -34,6 +35,7 @@ public class MainActivity extends AndroidApplication {
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
cfg.useGL20 = true;
|
||||
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
initialize(new GdxMap(), cfg);
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="assets"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl.jar" sourcepath="libs/gdx-backend-lwjgl-sources.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-natives.jar"/>
|
||||
<classpathentry kind="lib" path="/vtm/libs/vtm-jni-natives.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="assets"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl.jar" sourcepath="libs/gdx-backend-lwjgl-sources.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-natives.jar"/>
|
||||
<classpathentry kind="lib" path="/vtm/libs/vtm-jni-natives.jar"/>
|
||||
</classpath>
|
||||
|
@ -7,6 +7,7 @@ import java.nio.IntBuffer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.oscim.backend.Log;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@ -27,6 +28,10 @@ public class AwtBitmap implements Bitmap {
|
||||
|
||||
AwtBitmap(InputStream inputStream) throws IOException {
|
||||
this.bitmap = ImageIO.read(inputStream);
|
||||
this.width = this.bitmap.getWidth();
|
||||
this.height = this.bitmap.getHeight();
|
||||
if(!this.bitmap.isAlphaPremultiplied())
|
||||
this.bitmap.coerceData(true);
|
||||
}
|
||||
@Override
|
||||
public int getWidth() {
|
||||
@ -49,20 +54,23 @@ public class AwtBitmap implements Bitmap {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
private static IntBuffer tmpBuffer = BufferUtils.newIntBuffer(256 * 256);
|
||||
private static int[] tmpPixel = new int[256 * 256];
|
||||
private static IntBuffer tmpBuffer = BufferUtils.newIntBuffer(512 * 256);
|
||||
private static int[] tmpPixel = new int[512 * 256];
|
||||
|
||||
@Override
|
||||
public int uploadToTexture(boolean replace) {
|
||||
int[] pixels;
|
||||
IntBuffer buffer;
|
||||
|
||||
if (width == 256 && height == 256){
|
||||
if (width == 512 && height == 256){
|
||||
pixels = tmpPixel;
|
||||
buffer = tmpBuffer;
|
||||
buffer.clear();
|
||||
Log.d("AwtBitmap", "default texture");
|
||||
}else{
|
||||
pixels = new int[width * height];
|
||||
buffer = BufferUtils.newIntBuffer(width * height);
|
||||
Log.d("AwtBitmap", "create texture buffer " + width + "x" + height);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* 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
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.oscim.awt;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Canvas;
|
||||
@ -44,17 +62,48 @@ public class AwtCanvas implements Canvas {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawText(String string, float x, float y, Paint stroke) {
|
||||
AwtPaint p = (AwtPaint)stroke;
|
||||
public void drawText(String text, float x, float y, Paint paint) {
|
||||
|
||||
canvas.setFont(p.font);
|
||||
canvas.setColor(p.color);
|
||||
// if (paint.isTransparent()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
canvas.drawString(string, (int)x, (int)y);
|
||||
AwtPaint awtPaint = (AwtPaint)paint;
|
||||
|
||||
//AwtPaint awtPaint = AwtGraphicFactory.getAwtPaint(paint);
|
||||
|
||||
if (awtPaint.stroke == null) {
|
||||
canvas.setColor(awtPaint.color);
|
||||
canvas.setFont(awtPaint.font);
|
||||
canvas.drawString(text, x, y);
|
||||
} else {
|
||||
setColorAndStroke(awtPaint);
|
||||
|
||||
TextLayout textLayout = new TextLayout(text, awtPaint.font, canvas.getFontRenderContext());
|
||||
AffineTransform affineTransform = new AffineTransform();
|
||||
affineTransform.translate(x, y);
|
||||
canvas.draw(textLayout.getOutline(affineTransform));
|
||||
}
|
||||
}
|
||||
|
||||
private void setColorAndStroke(AwtPaint awtPaint) {
|
||||
canvas.setColor(awtPaint.color);
|
||||
if (awtPaint.stroke != null) {
|
||||
canvas.setStroke(awtPaint.stroke);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawText(String string, float x, float y, Paint stroke) {
|
||||
// AwtPaint p = (AwtPaint)stroke;
|
||||
//
|
||||
// canvas.setFont(p.font);
|
||||
// canvas.setColor(p.color);
|
||||
//
|
||||
// canvas.drawString(string, (int)x, (int)y);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -52,7 +52,7 @@ public class AwtGraphics extends CanvasAdapter {
|
||||
static final Graphics2D canvas;
|
||||
|
||||
static {
|
||||
image = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
|
||||
image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
canvas = image.createGraphics();
|
||||
canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
|
||||
//canvas.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
||||
@ -72,7 +72,8 @@ public class AwtGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
static synchronized float getTextWidth(FontMetrics fm, String text) {
|
||||
return (float)fm.getStringBounds(text, canvas).getWidth();
|
||||
//return (float)fm.getStringBounds(text, canvas).getWidth();
|
||||
return fm.stringWidth(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,22 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* 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
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.awt;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.text.AttributedCharacterIterator.Attribute;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
//import org.oscim.graphics.Align;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
//import org.oscim.graphics.Cap;
|
||||
//import org.oscim.graphics.FontFamily;
|
||||
//import org.oscim.graphics.FontStyle;
|
||||
import org.oscim.backend.canvas.Paint;
|
||||
//import org.oscim.graphics.Style;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
public class AwtPaint implements Paint {
|
||||
|
||||
private static int getCap(Cap cap) {
|
||||
switch (cap) {
|
||||
case BUTT:
|
||||
return BasicStroke.CAP_BUTT;
|
||||
case ROUND:
|
||||
return BasicStroke.CAP_ROUND;
|
||||
case SQUARE:
|
||||
return BasicStroke.CAP_SQUARE;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("unknown cap: " + cap);
|
||||
}
|
||||
|
||||
static final Font defaultFont;
|
||||
static {
|
||||
Map<Attribute, Object> textAttributes = new HashMap<Attribute, Object>();
|
||||
@ -25,13 +53,16 @@ public class AwtPaint implements Paint {
|
||||
textAttributes.put(TextAttribute.SIZE, 13);
|
||||
|
||||
defaultFont = Font.getFont(textAttributes);
|
||||
|
||||
}
|
||||
|
||||
Font font = defaultFont; //new Font("Default", Font.PLAIN, 13);
|
||||
|
||||
Font font = defaultFont; // new Font("Default", Font.PLAIN, 13);
|
||||
Stroke stroke;
|
||||
FontMetrics fm;
|
||||
Color color = new Color(0.1f,0.1f,0.1f,1);
|
||||
Color color = new Color(0.1f, 0.1f, 0.1f, 1);
|
||||
|
||||
private int cap;
|
||||
private float strokeWidth;
|
||||
private Align mAlign;
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
@ -58,13 +89,11 @@ public class AwtPaint implements Paint {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
this.color = new Color(
|
||||
((color >> 16) & 0xff)/255f,
|
||||
((color >> 8) & 0xff)/255f,
|
||||
((color >> 0) & 0xff)/255f,
|
||||
((color >> 24) & 0xff)/255f
|
||||
);
|
||||
public void setColor(int c) {
|
||||
color = new Color(((c >> 16) & 0xff) / 255f,
|
||||
((c >> 8) & 0xff) / 255f,
|
||||
((c >> 0) & 0xff) / 255f,
|
||||
((c >> 24) & 0xff) / 255f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,14 +104,17 @@ public class AwtPaint implements Paint {
|
||||
|
||||
@Override
|
||||
public void setStrokeCap(Cap cap) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.cap = getCap(cap);
|
||||
createStroke();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStrokeWidth(float width) {
|
||||
//int size = font.getSize();
|
||||
//font = font.deriveFont(size + width * 4);
|
||||
strokeWidth = width;
|
||||
createStroke();
|
||||
|
||||
// int size = font.getSize();
|
||||
// font = font.deriveFont(size + width * 4);
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@ -96,8 +128,7 @@ public class AwtPaint implements Paint {
|
||||
|
||||
@Override
|
||||
public void setTextAlign(Align align) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mAlign = align;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,12 +147,13 @@ public class AwtPaint implements Paint {
|
||||
public float measureText(String text) {
|
||||
if (fm == null)
|
||||
fm = AwtGraphics.getFontMetrics(this.font);
|
||||
|
||||
float w = AwtGraphics.getTextWidth(fm, text);
|
||||
//Gdx.app.log("text width:", text + " " + w);
|
||||
return w;
|
||||
//return fm.getStringBounds(text, A).getWidth();
|
||||
//return AwtGraphics.getTextWidth(fm, text);
|
||||
//return fm.stringWidth(text);
|
||||
// return fm.getStringBounds(text, A).getWidth();
|
||||
// return AwtGraphics.getTextWidth(fm, text);
|
||||
// return fm.stringWidth(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,7 +163,6 @@ public class AwtPaint implements Paint {
|
||||
|
||||
float height = fm.getHeight();
|
||||
|
||||
//Gdx.app.log("text height", " " + height);
|
||||
return height;
|
||||
}
|
||||
|
||||
@ -141,9 +172,14 @@ public class AwtPaint implements Paint {
|
||||
fm = AwtGraphics.getFontMetrics(this.font);
|
||||
|
||||
float desc = fm.getDescent();
|
||||
//Gdx.app.log("text descent", " " + desc);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
private void createStroke() {
|
||||
if (strokeWidth <= 0) {
|
||||
return;
|
||||
}
|
||||
stroke = new BasicStroke(strokeWidth, cap, BasicStroke.JOIN_ROUND, 0, null, 0);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import org.oscim.awt.AwtGraphics;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.renderer.GLRenderer;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
public class Main {
|
||||
|
||||
@ -17,12 +19,16 @@ public class Main {
|
||||
cfg.width = 1280;
|
||||
cfg.height = 800;
|
||||
cfg.stencil= 8;
|
||||
cfg.foregroundFPS = 20;
|
||||
//cfg.samples = 4;
|
||||
|
||||
// set our globals
|
||||
CanvasAdapter.g = AwtGraphics.INSTANCE;
|
||||
GLAdapter.INSTANCE = new GdxGLAdapter();
|
||||
Tile.SIZE = 256;
|
||||
GLRenderer.alwaysAllocBuffer = true;
|
||||
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
|
||||
new LwjglApplication(new GdxMap(), cfg);
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="/vtm-gdx/libs/gdx.jar" sourcepath="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gdx-backend-gwt.jar" sourcepath="war/WEB-INF/lib/gdx-backend-gwt-sources.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gdx-backend-gwt-sources.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm"/>
|
||||
<classpathentry kind="output" path="war/WEB-INF/classes"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm-gdx"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vtm"/>
|
||||
<classpathentry kind="output" path="war/WEB-INF/classes"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gdx-backend-gwt-sources.jar"/>
|
||||
<classpathentry kind="lib" path="war/WEB-INF/lib/gdx-backend-gwt.jar" sourcepath="war/WEB-INF/lib/gdx-backend-gwt-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/vtm-gdx/libs/gdx.jar" sourcepath="/vtm-gdx/libs/gdx-sources.jar"/>
|
||||
</classpath>
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
|
||||
<inherits name='GdxMap' />
|
||||
<entry-point class='org.oscim.gdx.client.GwtLauncher' />
|
||||
<set-configuration-property name="gdx.assetpath" value="../vtm/assets" />
|
||||
</module>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<module>
|
||||
<entry-point class="org.oscim.gdx.client.GwtLauncher"/>
|
||||
<set-configuration-property name="gdx.assetpath" value="../vtm/assets"/>
|
||||
<inherits name="GdxMap"/>
|
||||
<inherits name="com.badlogic.gdx.backends.gdx_backends_gwt"/>
|
||||
</module>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/gdx.jar" sourcepath="libs/gdx-sources.jar"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/vtm"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/gdx.jar" sourcepath="libs/gdx-sources.jar"/>
|
||||
</classpath>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.oscim.gdx;
|
||||
|
||||
import org.oscim.backend.AssetAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.Log;
|
||||
import org.oscim.backend.input.MotionEvent;
|
||||
import org.oscim.layers.tile.vector.MapTileLayer;
|
||||
@ -9,7 +8,7 @@ import org.oscim.renderer.GLRenderer;
|
||||
import org.oscim.renderer.GLState;
|
||||
import org.oscim.theme.InternalRenderTheme;
|
||||
import org.oscim.tilesource.TileSource;
|
||||
import org.oscim.tilesource.oscimap4.OSciMap4TileSource;
|
||||
import org.oscim.tilesource.oscimap2.OSciMap2TileSource;
|
||||
import org.oscim.view.MapRenderCallback;
|
||||
import org.oscim.view.MapView;
|
||||
import org.oscim.view.MapViewPosition;
|
||||
@ -18,11 +17,6 @@ import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
|
||||
@ -30,22 +24,20 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
private final GLRenderer mMapRenderer;
|
||||
|
||||
public GdxMap() {
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
|
||||
AssetAdapter.g = new GdxAssetAdapter();
|
||||
|
||||
mMapView = new MapView(this);
|
||||
mMapRenderer = new GLRenderer(mMapView);
|
||||
}
|
||||
|
||||
Stage ui;
|
||||
Label fps;
|
||||
BitmapFont font;
|
||||
// Stage ui;
|
||||
// Label fps;
|
||||
// BitmapFont font;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
|
||||
// Gdx.graphics.setContinuousRendering(false);
|
||||
Gdx.graphics.setContinuousRendering(false);
|
||||
|
||||
if (Log.logger == null)
|
||||
Log.logger = new GdxLog();
|
||||
@ -58,17 +50,17 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
|
||||
// TileSource tileSource = new OSciMap2TileSource();
|
||||
// tileSource.setOption("url",
|
||||
// "http://city.informatik.uni-bremen.de/osci/map-live");
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
tileSource.setOption("url", "http://city.informatik.uni-bremen.de/osci/testing");
|
||||
TileSource tileSource = new OSciMap2TileSource();
|
||||
tileSource.setOption("url",
|
||||
"http://city.informatik.uni-bremen.de/osci/map-live");
|
||||
//TileSource tileSource = new OSciMap4TileSource();
|
||||
//tileSource.setOption("url", "http://city.informatik.uni-bremen.de/osci/testing");
|
||||
|
||||
MapTileLayer l = mMapView.setBaseMap(tileSource);
|
||||
l.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||
|
||||
// mMapView.getLayerManager().add(new GenericOverlay(mMapView, new
|
||||
// GridRenderLayer(mMapView)));
|
||||
//mMapView.getLayerManager().add(new GenericOverlay(mMapView, new
|
||||
// GridRenderLayer(mMapView)));
|
||||
|
||||
mMapView.getMapViewPosition().setViewport(w, h);
|
||||
|
||||
@ -77,21 +69,21 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
|
||||
Gdx.input.setInputProcessor(new TouchHandler());
|
||||
|
||||
ui = new Stage(w, h, false);
|
||||
|
||||
font = new BitmapFont(false);
|
||||
|
||||
fps = new Label("fps: 0", new Label.LabelStyle(font, Color.WHITE));
|
||||
fps.setPosition(10, 30);
|
||||
fps.setColor(0, 1, 0, 1);
|
||||
ui.addActor(fps);
|
||||
// ui = new Stage(w, h, false);
|
||||
// font = new BitmapFont(false);
|
||||
// fps = new Label("fps: 0", new Label.LabelStyle(font, Color.WHITE));
|
||||
// fps.setPosition(10, 30);
|
||||
// fps.setColor(0, 1, 0, 1);
|
||||
// ui.addActor(fps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
|
||||
private int fpsCnt = 0;
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
// GLState.enableVertexArrays(-1, -1);
|
||||
@ -101,14 +93,14 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
mMapRenderer.onDrawFrame();
|
||||
|
||||
// Gdx.gl20.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// Gdx.gl20.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
int f = Gdx.graphics.getFramesPerSecond();
|
||||
if (f != fpsCnt){
|
||||
Log.d("fps", ">" +f);
|
||||
fpsCnt = f;
|
||||
}
|
||||
// int f = Gdx.graphics.getFramesPerSecond();
|
||||
// if (f != fpsCnt) {
|
||||
// Log.d("fps", ">" + f);
|
||||
// fpsCnt = f;
|
||||
// }
|
||||
|
||||
// fps.setText("fps: " + Gdx.graphics.getFramesPerSecond());
|
||||
// ui.draw();
|
||||
}
|
||||
@ -137,16 +129,17 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
* also render frame FIXME (does nothing atm)
|
||||
*/
|
||||
void redrawMapInternal(boolean forceRedraw) {
|
||||
|
||||
if (forceRedraw && !mClearMap)
|
||||
Gdx.graphics.requestRendering();
|
||||
GLState.blend(false);
|
||||
GLState.test(false, false);
|
||||
//if (forceRedraw && !mClearMap)
|
||||
// Gdx.graphics.requestRendering();
|
||||
|
||||
mMapView.updateLayers();
|
||||
|
||||
if (mClearMap) {
|
||||
Gdx.graphics.requestRendering();
|
||||
mClearMap = false;
|
||||
}
|
||||
//if (mClearMap) {
|
||||
Gdx.graphics.requestRendering();
|
||||
mClearMap = false;
|
||||
//}
|
||||
}
|
||||
|
||||
private boolean mClearMap;
|
||||
@ -349,7 +342,7 @@ public class GdxMap implements ApplicationListener, MapRenderCallback {
|
||||
}
|
||||
|
||||
if (changed)
|
||||
updateMap(false);
|
||||
updateMap(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -600,10 +600,17 @@ class TextRenderLayer extends BasicRenderLayer {
|
||||
return true;
|
||||
}
|
||||
|
||||
long lastDraw = 0;
|
||||
|
||||
@Override
|
||||
public synchronized void update(MapPosition pos, boolean changed,
|
||||
Matrices matrices) {
|
||||
|
||||
if (System.currentTimeMillis() - lastDraw > 1000){
|
||||
updateLabels();
|
||||
lastDraw = System.currentTimeMillis();
|
||||
|
||||
}
|
||||
if (mNextLayer.ready) {
|
||||
// exchange current with next layers
|
||||
TextureLayers tmp = mCurLayer;
|
||||
@ -626,6 +633,7 @@ class TextRenderLayer extends BasicRenderLayer {
|
||||
this.newData = true;
|
||||
}
|
||||
|
||||
|
||||
//if (!mHolding)
|
||||
// postLabelTask((mLastRun + MAX_RELABEL_DELAY) - System.currentTimeMillis());
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ public class TileRenderer {
|
||||
mProjMatrix.setValue(14, 0);
|
||||
mProjMatrix.multiplyRhs(m.view);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
|
||||
//GL.glDepthMask(true);
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
GL.glDepthFunc(GL20.GL_LESS);
|
||||
|
@ -71,7 +71,7 @@ public class GridRenderLayer extends BasicRenderLayer {
|
||||
|
||||
mTextLayer = layers.addTextLayer(new TextLayer());
|
||||
mLineLayer = layers.addLineLayer(0,
|
||||
new Line(Color.BLUE, 1.5f, Cap.BUTT));
|
||||
new Line(Color.BLUE, 1.5f, Cap.BUTT));
|
||||
}
|
||||
|
||||
private void addLabels(int x, int y, int z) {
|
||||
@ -83,11 +83,14 @@ public class GridRenderLayer extends BasicRenderLayer {
|
||||
for (int yy = -2; yy < 2; yy++) {
|
||||
for (int xx = -2; xx < 2; xx++) {
|
||||
|
||||
String label = String.format(
|
||||
Locale.ROOT, TILE_FORMAT,
|
||||
Integer.valueOf(x + xx),
|
||||
Integer.valueOf(y + yy),
|
||||
Integer.valueOf(z));
|
||||
// String label = String.format(
|
||||
// Locale.ROOT, TILE_FORMAT,
|
||||
// Integer.valueOf(x + xx),
|
||||
// Integer.valueOf(y + yy),
|
||||
// Integer.valueOf(z));
|
||||
String label = Integer.valueOf(x + xx) + "/" +
|
||||
Integer.valueOf(y + yy) + "/" +
|
||||
Integer.valueOf(z);
|
||||
|
||||
TextItem ti = TextItem.pool.get();
|
||||
ti.set(s * xx + s / 2, s * yy + s / 2, label, mText);
|
||||
|
@ -88,15 +88,16 @@ public final class LineRenderer {
|
||||
GL20.GL_NEAREST, GL20.GL_NEAREST,
|
||||
GL20.GL_MIRRORED_REPEAT, GL20.GL_MIRRORED_REPEAT);
|
||||
|
||||
Log.d(TAG, "Line Texture >>>>>>>>> " + mTexID);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void beginLines() {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, mTexID);
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, mTexID);
|
||||
}
|
||||
|
||||
public static void endLines() {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
public static Layer draw(Layers layers, Layer curLayer, MapPosition pos,
|
||||
@ -280,8 +281,10 @@ public final class LineRenderer {
|
||||
//+ " len = abs(v_st.s);"
|
||||
//+ " else"
|
||||
//+ " len = texture2D(tex, v_st).a;"
|
||||
//+ " len = u_mode * length(v_st);"
|
||||
// this avoids branching, need to check performance
|
||||
+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);"
|
||||
//+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);"
|
||||
+ " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * length(v_st));"
|
||||
// interpolate alpha between: 0.0 < 1.0 - len < u_wscale
|
||||
// where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2)
|
||||
//+ " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);"
|
||||
@ -304,8 +307,8 @@ public final class LineRenderer {
|
||||
+ " len = abs(v_st.s);"
|
||||
+ " fuzz = fwidth(v_st.s);"
|
||||
+ " } else {"
|
||||
+ " len = texture2D(tex, v_st).a;"
|
||||
//+ " len = length(v_st);"
|
||||
//+ " len = texture2D(tex, v_st).a;"
|
||||
+ " len = length(v_st);"
|
||||
+ " vec2 st_width = fwidth(v_st);"
|
||||
+ " fuzz = max(st_width.s, st_width.t);"
|
||||
+ " }"
|
||||
|
@ -129,9 +129,9 @@ public final class TextLayer extends TextureLayer {
|
||||
yy = y + height - it.text.fontDescent; // - mFontPadY;
|
||||
|
||||
if (it.text.stroke != null)
|
||||
mCanvas.drawText(it.string, x + it.width / 2, yy, it.text.stroke);
|
||||
mCanvas.drawText(it.string, x, yy, it.text.stroke);
|
||||
|
||||
mCanvas.drawText(it.string, x + it.width / 2, yy, it.text.paint);
|
||||
mCanvas.drawText(it.string, x, yy, it.text.paint);
|
||||
|
||||
// FIXME !!!
|
||||
if (width > TEXTURE_WIDTH)
|
||||
|
@ -81,6 +81,7 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
*/
|
||||
public synchronized static TextureItem get(boolean initBitmap) {
|
||||
TextureItem ti = pool.get();
|
||||
Log.d(TAG, "get texture item " + ti.id);
|
||||
if (initBitmap) {
|
||||
ti.bitmap = getBitmap();
|
||||
ti.bitmap.eraseColor(Color.TRANSPARENT);
|
||||
@ -171,8 +172,11 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
int[] tmp = new int[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
tmp[i] = mTextures.get(i).intValue();
|
||||
|
||||
mTextures.clear();
|
||||
GlUtils.glDeleteTextures(size, tmp);
|
||||
|
||||
mTexCnt -= size;
|
||||
}
|
||||
|
||||
if (to.id < 0) {
|
||||
@ -180,9 +184,9 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
int[] textureIds = GlUtils.glGenTextures(1);
|
||||
to.id = textureIds[0];
|
||||
initTexture(to.id);
|
||||
if (TextureRenderer.debug)
|
||||
Log.d(TAG, pool.getCount() + " " + pool.getFill()
|
||||
+ " " + mTexCnt + " new texture " + to.id);
|
||||
//if (TextureRenderer.debug)
|
||||
Log.d(TAG, "poolCnt:" + pool.getCount() + " poolFill:" + pool.getFill()
|
||||
+ " texCnt:" + mTexCnt + " new texture " + to.id);
|
||||
}
|
||||
|
||||
uploadTexture(to, to.bitmap, mBitmapFormat, mBitmapType,
|
||||
@ -203,8 +207,9 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
Log.d(TAG, "no texture!");
|
||||
return;
|
||||
}
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, to.id);
|
||||
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, to.id);
|
||||
Log.d(TAG, "upload " + to.id);
|
||||
if (to.ownBitmap) {
|
||||
bitmap.uploadToTexture(false);
|
||||
//GLUtils.texImage2D(GL20.GL_TEXTURE_2D, 0, bitmap, 0);
|
||||
|
@ -82,6 +82,7 @@ public final class TextureRenderer {
|
||||
for (TextureItem ti = tl.textures; ti != null; ti = ti.next) {
|
||||
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, ti.id);
|
||||
|
||||
int maxVertices = GLRenderer.maxQuads * INDICES_PER_SPRITE;
|
||||
|
||||
GL.glUniform2f(hTextureSize,
|
||||
@ -110,6 +111,8 @@ public final class TextureRenderer {
|
||||
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
|
||||
return layer.next;
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,6 @@
|
||||
*/
|
||||
package org.oscim.theme.renderinstruction;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.theme.IRenderCallback;
|
||||
@ -27,7 +24,7 @@ import org.xml.sax.Attributes;
|
||||
* Represents a polyline on the map.
|
||||
*/
|
||||
public final class Line extends RenderInstruction {
|
||||
private static final Pattern SPLIT_PATTERN = Pattern.compile(",");
|
||||
//private static final Pattern SPLIT_PATTERN = Pattern.compile(",");
|
||||
|
||||
/**
|
||||
* @param line
|
||||
@ -92,7 +89,7 @@ public final class Line extends RenderInstruction {
|
||||
} else if ("width".equals(name)) {
|
||||
width = Float.parseFloat(value);
|
||||
} else if ("cap".equals(name)) {
|
||||
cap = Cap.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
cap = Cap.valueOf(value.toUpperCase());
|
||||
} else if ("fix".equals(name)) {
|
||||
fixed = Boolean.parseBoolean(value);
|
||||
} else if ("stipple".equals(name)) {
|
||||
@ -136,14 +133,14 @@ public final class Line extends RenderInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
static float[] parseFloatArray(String dashString) {
|
||||
String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
float[] dashIntervals = new float[dashEntries.length];
|
||||
for (int i = 0; i < dashEntries.length; ++i) {
|
||||
dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
}
|
||||
return dashIntervals;
|
||||
}
|
||||
// static float[] parseFloatArray(String dashString) {
|
||||
// String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
// float[] dashIntervals = new float[dashEntries.length];
|
||||
// for (int i = 0; i < dashEntries.length; ++i) {
|
||||
// dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
// }
|
||||
// return dashIntervals;
|
||||
// }
|
||||
|
||||
private final int level;
|
||||
|
||||
|
@ -63,9 +63,9 @@ public final class Text extends RenderInstruction {
|
||||
else if ("k".equals(name)) {
|
||||
textKey = value.intern();
|
||||
} else if ("font-family".equals(name)) {
|
||||
fontFamily = FontFamily.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
fontFamily = FontFamily.valueOf(value.toUpperCase());
|
||||
} else if ("font-style".equals(name)) {
|
||||
fontStyle = FontStyle.valueOf(value.toUpperCase(Locale.ENGLISH));
|
||||
fontStyle = FontStyle.valueOf(value.toUpperCase());
|
||||
} else if ("font-size".equals(name)) {
|
||||
fontSize = Float.parseFloat(value);
|
||||
} else if ("fill".equals(name)) {
|
||||
|
@ -18,10 +18,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.theme.RenderThemeHandler;
|
||||
@ -31,7 +29,7 @@ import org.xml.sax.Attributes;
|
||||
public abstract class Rule {
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_KEY = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_VALUE = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|");
|
||||
//private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|");
|
||||
private static final String STRING_NEGATION = "~";
|
||||
private static final String STRING_EXCLUSIVE = "-";
|
||||
private static final String STRING_WILDCARD = "*";
|
||||
@ -52,7 +50,8 @@ public abstract class Rule {
|
||||
if (values == null) {
|
||||
valueMatcher = AnyMatcher.getInstance();
|
||||
} else {
|
||||
valueList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(values)));
|
||||
//valueList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(values)));
|
||||
valueList = new ArrayList<String>(Arrays.asList(values.split("\\|")));
|
||||
if (valueList.remove(STRING_NEGATION))
|
||||
negativeRule = true;
|
||||
else if (valueList.remove(STRING_EXCLUSIVE))
|
||||
@ -69,7 +68,8 @@ public abstract class Rule {
|
||||
}
|
||||
keyMatcher = AnyMatcher.getInstance();
|
||||
} else {
|
||||
keyList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(keys)));
|
||||
//keyList = new ArrayList<String>(Arrays.asList(SPLIT_PATTERN.split(keys)));
|
||||
keyList = new ArrayList<String>(Arrays.asList(keys.split("\\|")));
|
||||
keyMatcher = getKeyMatcher(keyList);
|
||||
|
||||
if ((keyMatcher instanceof AnyMatcher) && (negativeRule || exclusionRule)) {
|
||||
@ -150,7 +150,7 @@ public abstract class Rule {
|
||||
String value = attributes.getValue(i);
|
||||
|
||||
if ("e".equals(name)) {
|
||||
String val = value.toUpperCase(Locale.ENGLISH);
|
||||
String val = value.toUpperCase();
|
||||
if ("WAY".equals(val))
|
||||
element = Element.WAY;
|
||||
else if ("NODE".equals(val))
|
||||
@ -160,7 +160,7 @@ public abstract class Rule {
|
||||
} else if ("v".equals(name)) {
|
||||
values = value;
|
||||
} else if ("closed".equals(name)) {
|
||||
String val = value.toUpperCase(Locale.ENGLISH);
|
||||
String val = value.toUpperCase();
|
||||
if ("YES".equals(val))
|
||||
closed = Closed.YES;
|
||||
else if ("NO".equals(val))
|
||||
|
@ -326,6 +326,8 @@ public class GlUtils {
|
||||
|
||||
public static int[] glGenBuffers(int num) {
|
||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
GL.glGenBuffers(num, buf);
|
||||
int[] ret = new int[num];
|
||||
buf.position(0);
|
||||
@ -343,6 +345,8 @@ public class GlUtils {
|
||||
|
||||
public static int[] glGenTextures(int num) {
|
||||
IntBuffer buf = GLRenderer.getIntBuffer(num);
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
GL.glGenTextures(num, buf);
|
||||
int[] ret = new int[num];
|
||||
buf.position(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user