* Replaced all usages of ByteBuffer.allocateDirect() with BufferUtils.create***Buffer() so that memory can be tracked

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7845 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 7b93faa8e1
commit a24becee32
  1. 226
      engine/nbproject/project.properties
  2. 5
      engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java
  3. 3
      engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java
  4. 3
      engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java
  5. 5
      engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java
  6. 6
      engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java
  7. 2
      engine/src/core-data/Common/MatDefs/Misc/Sky.frag
  8. 1
      engine/src/core/com/jme3/light/PointLight.java
  9. 19
      engine/src/core/com/jme3/util/TempVars.java
  10. 7
      engine/src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java
  11. 3
      engine/src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java
  12. 6
      engine/src/terrain/com/jme3/terrain/GeoMap.java

@ -1,114 +1,114 @@
annotation.processing.enabled=false annotation.processing.enabled=false
annotation.processing.enabled.in.editor=false annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true annotation.processing.run.all.processors=true
ant.customtasks.libs=JWSAntTasks ant.customtasks.libs=JWSAntTasks
application.homepage=http://www.jmonkeyengine.com/ application.homepage=http://www.jmonkeyengine.com/
application.title=jMonkeyEngine 3.0 application.title=jMonkeyEngine 3.0
application.vendor=jMonkeyEngine application.vendor=jMonkeyEngine
build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
build.dir=build build.dir=build
build.generated.dir=${build.dir}/generated build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here: # Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport: # Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket #debug.transport=dt_socket
debug.classpath=\ debug.classpath=\
${run.classpath} ${run.classpath}
debug.test.classpath=\ debug.test.classpath=\
${run.test.classpath} ${run.test.classpath}
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
dist.dir=dist dist.dir=dist
dist.jar=${dist.dir}/jMonkeyEngine3.jar dist.jar=${dist.dir}/jMonkeyEngine3.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
excludes= excludes=
file.reference.src-test-data=src/test-data file.reference.src-test-data=src/test-data
includes=** includes=**
jar.archive.disabled=${jnlp.enabled} jar.archive.disabled=${jnlp.enabled}
jar.compress=true jar.compress=true
jar.index=${jnlp.enabled} jar.index=${jnlp.enabled}
javac.classpath=\ javac.classpath=\
${libs.jogg.classpath}:\ ${libs.jogg.classpath}:\
${libs.jbullet.classpath}:\ ${libs.jbullet.classpath}:\
${libs.bullet.classpath}:\ ${libs.bullet.classpath}:\
${libs.lwjgl.classpath}:\ ${libs.lwjgl.classpath}:\
${libs.jheora.classpath}:\ ${libs.jheora.classpath}:\
${libs.niftygui1.3.classpath}:\ ${libs.niftygui1.3.classpath}:\
${libs.jme3-test-data.classpath}:\ ${libs.jme3-test-data.classpath}:\
${libs.noise.classpath} ${libs.noise.classpath}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.deprecation=false javac.deprecation=false
javac.processorpath=\ javac.processorpath=\
${javac.classpath} ${javac.classpath}
javac.source=1.5 javac.source=1.5
javac.target=1.5 javac.target=1.5
javac.test.classpath=\ javac.test.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir}:\ ${build.classes.dir}:\
${libs.junit_4.classpath} ${libs.junit_4.classpath}
javadoc.additionalparam=-public javadoc.additionalparam=-public
javadoc.author=false javadoc.author=false
javadoc.encoding=${source.encoding} javadoc.encoding=${source.encoding}
javadoc.noindex=false javadoc.noindex=false
javadoc.nonavbar=false javadoc.nonavbar=false
javadoc.notree=false javadoc.notree=false
javadoc.private=false javadoc.private=false
javadoc.splitindex=true javadoc.splitindex=true
javadoc.use=true javadoc.use=true
javadoc.version=false javadoc.version=false
javadoc.windowtitle=jMonkeyEngine3 javadoc.windowtitle=jMonkeyEngine3
jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
jnlp.applet.class=jme3test.awt.AppHarness jnlp.applet.class=jme3test.awt.AppHarness
jnlp.applet.height=300 jnlp.applet.height=300
jnlp.applet.width=300 jnlp.applet.width=300
jnlp.codebase.type=user jnlp.codebase.type=user
jnlp.codebase.user=http://jmonkeyengine.com/javawebstart/ jnlp.codebase.user=http://jmonkeyengine.com/javawebstart/
jnlp.descriptor=application jnlp.descriptor=application
jnlp.enabled=false jnlp.enabled=false
jnlp.icon=/Users/normenhansen/Pictures/jme/icons/jme-logo48.png jnlp.icon=/Users/normenhansen/Pictures/jme/icons/jme-logo48.png
jnlp.mixed.code=default jnlp.mixed.code=default
jnlp.offline-allowed=true jnlp.offline-allowed=true
jnlp.signed=true jnlp.signed=true
jnlp.signing=generated jnlp.signing=generated
jnlp.signing.alias= jnlp.signing.alias=
jnlp.signing.keystore= jnlp.signing.keystore=
main.class=jme3test.TestChooser main.class=jme3test.TestChooser
manifest.file=MANIFEST.MF manifest.file=MANIFEST.MF
meta.inf.dir=${src.dir}/META-INF meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false mkdist.disabled=false
platform.active=default_platform platform.active=default_platform
run.classpath=\ run.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}
run.jvmargs=-Xms30m -Xmx30m -XX:MaxDirectMemorySize=256M run.jvmargs=-Xbatch -XX:CICompilerCount=1
run.test.classpath=\ run.test.classpath=\
${javac.test.classpath}:\ ${javac.test.classpath}:\
${build.test.classes.dir} ${build.test.classes.dir}
source.encoding=UTF-8 source.encoding=UTF-8
src.blender.dir=src/blender src.blender.dir=src/blender
src.core-data.dir=src/core-data src.core-data.dir=src/core-data
src.core-plugins.dir=src/core-plugins src.core-plugins.dir=src/core-plugins
src.core.dir=src/core src.core.dir=src/core
src.desktop-fx.dir=src/desktop-fx src.desktop-fx.dir=src/desktop-fx
src.desktop.dir=src/desktop src.desktop.dir=src/desktop
src.games.dir=src/games src.games.dir=src/games
src.jbullet.dir=src/jbullet src.jbullet.dir=src/jbullet
src.jheora.dir=src/jheora src.jheora.dir=src/jheora
src.jogg.dir=src/jogg src.jogg.dir=src/jogg
src.lwjgl-oal.dir=src/lwjgl-oal src.lwjgl-oal.dir=src/lwjgl-oal
src.lwjgl-ogl.dir=src/lwjgl-ogl src.lwjgl-ogl.dir=src/lwjgl-ogl
src.networking.dir=src\\networking src.networking.dir=src\\networking
src.niftygui.dir=src/niftygui src.niftygui.dir=src/niftygui
src.ogre.dir=src/ogre src.ogre.dir=src/ogre
src.pack.dir=src/pack src.pack.dir=src/pack
src.terrain.dir=src/terrain src.terrain.dir=src/terrain
src.test.dir=src/test src.test.dir=src/test
src.tools.dir=src/tools src.tools.dir=src/tools
src.xml.dir=src/xml src.xml.dir=src/xml
test.test.dir=test test.test.dir=test

@ -39,6 +39,7 @@ import com.jme3.export.InputCapsule;
import com.jme3.export.OutputCapsule; import com.jme3.export.OutputCapsule;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.mesh.IndexBuffer;
import com.jme3.util.BufferUtils;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -70,8 +71,8 @@ public class GImpactCollisionShape extends CollisionShape {
} }
private void createCollisionMesh(Mesh mesh) { private void createCollisionMesh(Mesh mesh) {
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
// triangleIndexBase = ByteBuffer.allocate(mesh.getTriangleCount() * 3 * 4); // triangleIndexBase = ByteBuffer.allocate(mesh.getTriangleCount() * 3 * 4);
// vertexBase = ByteBuffer.allocate(mesh.getVertexCount() * 3 * 4); // vertexBase = ByteBuffer.allocate(mesh.getVertexCount() * 3 * 4);
numVertices = mesh.getVertexCount(); numVertices = mesh.getVertexCount();

@ -11,6 +11,7 @@ import com.jme3.export.OutputCapsule;
import com.jme3.math.FastMath; import com.jme3.math.FastMath;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
import com.jme3.util.BufferUtils;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -94,7 +95,7 @@ public class HeightfieldCollisionShape extends CollisionShape {
} }
protected void createShape() { protected void createShape() {
bbuf = ByteBuffer.allocateDirect(heightfieldData.length * 4).order(ByteOrder.nativeOrder()); bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4);
// fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData); // fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData);
// fbuf.rewind(); // fbuf.rewind();
// fbuf.put(heightfieldData); // fbuf.put(heightfieldData);

@ -7,6 +7,7 @@ import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule; import com.jme3.export.OutputCapsule;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.util.BufferUtils;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -66,7 +67,7 @@ public class HullCollisionShape extends CollisionShape {
// objectId = new ConvexHullShape(pointList); // objectId = new ConvexHullShape(pointList);
// objectId.setLocalScaling(Converter.convert(getScale())); // objectId.setLocalScaling(Converter.convert(getScale()));
// objectId.setMargin(margin); // objectId.setMargin(margin);
ByteBuffer bbuf=ByteBuffer.allocateDirect(points.length * 4).order(ByteOrder.nativeOrder()); ByteBuffer bbuf=BufferUtils.createByteBuffer(points.length * 4);
// fbuf = bbuf.asFloatBuffer(); // fbuf = bbuf.asFloatBuffer();
// fbuf.rewind(); // fbuf.rewind();
// fbuf.put(points); // fbuf.put(points);

@ -39,6 +39,7 @@ import com.jme3.export.InputCapsule;
import com.jme3.export.OutputCapsule; import com.jme3.export.OutputCapsule;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.mesh.IndexBuffer;
import com.jme3.util.BufferUtils;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -68,8 +69,8 @@ public class MeshCollisionShape extends CollisionShape {
} }
private void createCollisionMesh(Mesh mesh) { private void createCollisionMesh(Mesh mesh) {
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
numVertices = mesh.getVertexCount(); numVertices = mesh.getVertexCount();
vertexStride = 12; //3 verts * 4 bytes per. vertexStride = 12; //3 verts * 4 bytes per.
numTriangles = mesh.getTriangleCount(); numTriangles = mesh.getTriangleCount();

@ -34,8 +34,8 @@ package com.jme3.bullet.util;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.mesh.IndexBuffer;
import com.jme3.util.BufferUtils;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
/** /**
@ -45,8 +45,8 @@ import java.nio.FloatBuffer;
public class NativeMeshUtil { public class NativeMeshUtil {
public static long getTriangleIndexVertexArray(Mesh mesh){ public static long getTriangleIndexVertexArray(Mesh mesh){
ByteBuffer triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); ByteBuffer triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
ByteBuffer vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); ByteBuffer vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
int numVertices = mesh.getVertexCount(); int numVertices = mesh.getVertexCount();
int vertexStride = 12; //3 verts * 4 bytes per. int vertexStride = 12; //3 verts * 4 bytes per.
int numTriangles = mesh.getTriangleCount(); int numTriangles = mesh.getTriangleCount();

@ -1,6 +1,6 @@
#import "Common/ShaderLib/Optics.glsllib" #import "Common/ShaderLib/Optics.glsllib"
uniform ENVMAP m_Texture; uniform ENVMAP m_Texture2;
varying vec3 direction; varying vec3 direction;

@ -61,6 +61,7 @@ public class PointLight extends Light {
if (owner.getWorldBound() != null){ if (owner.getWorldBound() != null){
BoundingVolume bv = owner.getWorldBound(); BoundingVolume bv = owner.getWorldBound();
lastDistance = bv.distanceSquaredTo(position); lastDistance = bv.distanceSquaredTo(position);
System.out.println(lastDistance + ", " + owner);
}else{ }else{
lastDistance = owner.getWorldTranslation().distanceSquared(position); lastDistance = owner.getWorldTranslation().distanceSquared(position);
} }

@ -82,6 +82,13 @@ public class TempVars {
return new TempVarsStack(); return new TempVarsStack();
} }
}; };
private static final ThreadLocal<TempVars> tempVars = new ThreadLocal<TempVars>(){
@Override
public TempVars initialValue() {
return new TempVars();
}
};
/** /**
* This instance of TempVars has been retrieved but not released yet. * This instance of TempVars has been retrieved but not released yet.
@ -91,6 +98,13 @@ public class TempVars {
private TempVars() { private TempVars() {
} }
public static TempVars get(){
return tempVars.get();
}
public void release(){
}
/** /**
* Acquire an instance of the TempVar class. * Acquire an instance of the TempVar class.
* You have to release the instance after use by calling the * You have to release the instance after use by calling the
@ -100,6 +114,7 @@ public class TempVars {
* *
* @return A TempVar instance * @return A TempVar instance
*/ */
/*
public static TempVars get() { public static TempVars get() {
TempVarsStack stack = varsLocal.get(); TempVarsStack stack = varsLocal.get();
@ -119,6 +134,7 @@ public class TempVars {
return instance; return instance;
} }
*/
/** /**
* Releases this instance of TempVars. * Releases this instance of TempVars.
@ -127,6 +143,7 @@ public class TempVars {
* e.g. Acquiring vars1, then acquiring vars2, vars2 MUST be released * e.g. Acquiring vars1, then acquiring vars2, vars2 MUST be released
* first otherwise an exception will be thrown. * first otherwise an exception will be thrown.
*/ */
/*
public void release() { public void release() {
if (!isUsed){ if (!isUsed){
throw new IllegalStateException("This instance of TempVars was already released!"); throw new IllegalStateException("This instance of TempVars was already released!");
@ -143,7 +160,7 @@ public class TempVars {
if (stack.tempVars[stack.index] != this){ if (stack.tempVars[stack.index] != this){
throw new IllegalStateException("An instance of TempVars has not been released in a called method!"); throw new IllegalStateException("An instance of TempVars has not been released in a called method!");
} }
} }*/
/** /**
* For interfacing with OpenGL in Renderer. * For interfacing with OpenGL in Renderer.

@ -45,6 +45,7 @@ import com.jme3.scene.Mesh;
import com.jme3.scene.Node; import com.jme3.scene.Node;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.util.BufferUtils;
import com.jme3.util.TempVars; import com.jme3.util.TempVars;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -176,8 +177,7 @@ public class DebugShapeFactory {
// The number of bytes needed is: (floats in a vertex) * (vertices in a triangle) * (# of triangles) * (size of float in bytes) // The number of bytes needed is: (floats in a vertex) * (vertices in a triangle) * (# of triangles) * (size of float in bytes)
final int numberOfFloats = 3 * 3 * numberOfTriangles; final int numberOfFloats = 3 * 3 * numberOfTriangles;
final int byteBufferSize = numberOfFloats * Float.SIZE; FloatBuffer vertices = BufferUtils.createFloatBuffer(numberOfFloats);
FloatBuffer vertices = ByteBuffer.allocateDirect(byteBufferSize).order(ByteOrder.nativeOrder()).asFloatBuffer();
// Force the limit, set the cap - most number of floats we will use the buffer for // Force the limit, set the cap - most number of floats we will use the buffer for
vertices.limit(numberOfFloats); vertices.limit(numberOfFloats);
@ -235,8 +235,7 @@ class BufferedTriangleCallback extends TriangleCallback {
public FloatBuffer getVertices() { public FloatBuffer getVertices() {
// There are 3 floats needed for each vertex (x,y,z) // There are 3 floats needed for each vertex (x,y,z)
final int numberOfFloats = vertices.size() * 3; final int numberOfFloats = vertices.size() * 3;
final int byteBufferSize = numberOfFloats * Float.SIZE; FloatBuffer verticesBuffer = BufferUtils.createFloatBuffer(numberOfFloats);
FloatBuffer verticesBuffer = ByteBuffer.allocateDirect(byteBufferSize).order(ByteOrder.nativeOrder()).asFloatBuffer();
// Force the limit, set the cap - most number of floats we will use the buffer for // Force the limit, set the cap - most number of floats we will use the buffer for
verticesBuffer.limit(numberOfFloats); verticesBuffer.limit(numberOfFloats);

@ -77,7 +77,7 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable {
private final static int MAX_NUM_CHANNELS = 64; private final static int MAX_NUM_CHANNELS = 64;
private IntBuffer ib = BufferUtils.createIntBuffer(1); private IntBuffer ib = BufferUtils.createIntBuffer(1);
private final FloatBuffer fb = BufferUtils.createVector3Buffer(2); private final FloatBuffer fb = BufferUtils.createVector3Buffer(2);
private final ByteBuffer nativeBuf = ByteBuffer.allocateDirect(BUFFER_SIZE); private final ByteBuffer nativeBuf = BufferUtils.createByteBuffer(BUFFER_SIZE);
private final byte[] arrayBuf = new byte[BUFFER_SIZE]; private final byte[] arrayBuf = new byte[BUFFER_SIZE];
private int[] channels; private int[] channels;
@ -100,7 +100,6 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable {
private final AtomicBoolean threadLock = new AtomicBoolean(false); private final AtomicBoolean threadLock = new AtomicBoolean(false);
public LwjglAudioRenderer(){ public LwjglAudioRenderer(){
nativeBuf.order(ByteOrder.nativeOrder());
} }
public void initialize(){ public void initialize(){

@ -68,7 +68,7 @@ public class GeoMap implements Savable {
} }
public GeoMap(int width, int height, int maxval) { public GeoMap(int width, int height, int maxval) {
this(ByteBuffer.allocateDirect(width*height*4).asFloatBuffer(),null,width,height,maxval); this(BufferUtils.createFloatBuffer(width*height), null, width,height,maxval);
} }
public FloatBuffer getHeightData(){ public FloatBuffer getHeightData(){
@ -187,7 +187,7 @@ public class GeoMap implements Savable {
* Copies a section of this geomap as a new geomap * Copies a section of this geomap as a new geomap
*/ */
public GeoMap copySubGeomap(int x, int y, int w, int h){ public GeoMap copySubGeomap(int x, int y, int w, int h){
FloatBuffer nhdata = ByteBuffer.allocateDirect(w*h*4).asFloatBuffer(); FloatBuffer nhdata = BufferUtils.createFloatBuffer(w * h);
hdata.position(y*width+x); hdata.position(y*width+x);
for (int cy = 0; cy < height; cy++){ for (int cy = 0; cy < height; cy++){
hdata.limit(hdata.position()+w); hdata.limit(hdata.position()+w);
@ -199,7 +199,7 @@ public class GeoMap implements Savable {
ByteBuffer nndata = null; ByteBuffer nndata = null;
if (ndata!=null){ if (ndata!=null){
nndata = ByteBuffer.allocateDirect(w*h*3); nndata = BufferUtils.createByteBuffer(w*h*3);
ndata.position( (y*width+x)*3 ); ndata.position( (y*width+x)*3 );
for (int cy = 0; cy < height; cy++){ for (int cy = 0; cy < height; cy++){
ndata.limit(ndata.position()+w*3); ndata.limit(ndata.position()+w*3);

Loading…
Cancel
Save