Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ public int TextureParameterValue_ClampToEdge() {
return GLES20.GL_CLAMP_TO_EDGE;
}

@Override
public int TextureParameterValue_Repeat() {
return GLES20.GL_REPEAT;
}


@Override
public int Alignment_Pack() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.glob3.mobile.generated.Color;
import org.glob3.mobile.generated.DirectMesh;
import org.glob3.mobile.generated.ElevationDataProvider;
import org.glob3.mobile.generated.EllipsoidalPlanet;
import org.glob3.mobile.generated.FloatBufferBuilderFromColor;
import org.glob3.mobile.generated.FloatBufferBuilderFromGeodetic;
import org.glob3.mobile.generated.G3MContext;
Expand All @@ -26,7 +27,6 @@
import org.glob3.mobile.generated.LayerSet;
import org.glob3.mobile.generated.MapBoxLayer;
import org.glob3.mobile.generated.MeshRenderer;
import org.glob3.mobile.generated.Planet;
import org.glob3.mobile.generated.Quality;
import org.glob3.mobile.generated.Sector;
import org.glob3.mobile.generated.SingleBilElevationDataProvider;
Expand All @@ -42,12 +42,12 @@


public class PointCloudActivity
extends
Activity {
extends
Activity {

private final class PointsCloudParser
extends
GAsyncTask {
extends
GAsyncTask {

private final IByteBuffer _buffer;
private DirectMesh _mesh;
Expand Down Expand Up @@ -121,8 +121,8 @@ public void onPostExecute(final G3MContext context) {
}

private final class PointsCloudDownloader
extends
IBufferDownloadListener {
extends
IBufferDownloadListener {

private final IThreadUtils _threadUtils;

Expand Down Expand Up @@ -185,7 +185,7 @@ protected void onCreate(final Bundle savedInstanceState) {
UPPER LEFT Y=46.3566926359
LOWER RIGHT X=7.1737468920
LOWER RIGHT Y=46.3427207284
*/
*/

// final Geodetic2D lower = new Geodetic2D( //
// Angle.fromDegrees(46.3427207284), //
Expand Down Expand Up @@ -232,7 +232,7 @@ protected void onCreate(final Bundle savedInstanceState) {

_builder = new G3MBuilder_Android(this);
// _builder.setPlanet(Planet.createSphericalEarth());
_builder.setPlanet(Planet.createEarth());
_builder.setPlanet(EllipsoidalPlanet.createEarth());
_builder.getPlanetRendererBuilder().setLayerSet(layerSet);


Expand All @@ -250,7 +250,7 @@ protected void onCreate(final Bundle savedInstanceState) {
_builder.getPlanetRendererBuilder().setElevationDataProvider(dem);
_builder.getPlanetRendererBuilder().setQuality(Quality.QUALITY_HIGH);

//
//
// final ElevationDataProvider dem = new SingleBillElevationDataProvider(new URL("file:///full-earth-2048x1024.bil", false),
// Sector.fullSphere(), new Vector2I(2048, 1024), -1700);
// _builder.getPlanetRendererBuilder().setElevationDataProvider(dem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private boolean initMesh(G3MRenderContext rc)
{
TextureIDReference texId = null;

texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), "BusyQuadRenderer-Texture", false);
texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), "BusyQuadRenderer-Texture", false, GLTextureParameterValue.clampToEdge());

if (texId == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static LeveledTexturedMesh createMesh(Tile tile, Mesh tessellatorMesh, V
if (!fallbackSolved && backgroundTileImage != null)
{
LazyTextureMapping mapping = new LazyTextureMapping(new DTT_LTMInitializer(tileMeshResolution, tile, tile, tessellator), true, false);
final TextureIDReference glTextureId = texturesHandler.getTextureIDReference(backgroundTileImage, GLFormat.rgba(), backgroundTileImageName, generateMipmap);
final TextureIDReference glTextureId = texturesHandler.getTextureIDReference(backgroundTileImage, GLFormat.rgba(), backgroundTileImageName, generateMipmap, GLTextureParameterValue.clampToEdge());
mapping.setGLTextureId(glTextureId); //Mandatory to active mapping

mappings.add(mapping);
Expand Down Expand Up @@ -143,7 +143,7 @@ public void dispose()
public final boolean uploadTexture(IImage image, String imageId)
{

final TextureIDReference glTextureId = _texturesHandler.getTextureIDReference(image, GLFormat.rgba(), imageId, _generateMipmap);
final TextureIDReference glTextureId = _texturesHandler.getTextureIDReference(image, GLFormat.rgba(), imageId, _generateMipmap, GLTextureParameterValue.clampToEdge());
if (glTextureId == null)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc)
return null;
}

_texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false);
_texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false, GLTextureParameterValue.clampToEdge());

if (_textureImage != null)
_textureImage.dispose();
Expand Down
7 changes: 3 additions & 4 deletions Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GL.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public final int getError()
return _nativeGL.getError();
}

public final IGLTextureId uploadTexture(IImage image, int format, boolean generateMipmap)
public final IGLTextureId uploadTexture(IImage image, int format, boolean generateMipmap, int wrapMode)
{

// if (_verbose) {
Expand Down Expand Up @@ -218,9 +218,8 @@ public final IGLTextureId uploadTexture(IImage image, int format, boolean genera

_nativeGL.texParameteri(texture2D, GLTextureParameter.magFilter(), linear);

final int clampToEdge = GLTextureParameterValue.clampToEdge();
_nativeGL.texParameteri(texture2D, GLTextureParameter.wrapS(), clampToEdge);
_nativeGL.texParameteri(texture2D, GLTextureParameter.wrapT(), clampToEdge);
_nativeGL.texParameteri(texture2D, GLTextureParameter.wrapS(), wrapMode);
_nativeGL.texParameteri(texture2D, GLTextureParameter.wrapT(), wrapMode);

_nativeGL.texImage2D(image, format);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class GLTextureParameterValue
private static int _linearMipmapLinear = 0;

private static int _clampToEdge = 0;
private static int _repeat = 0;


public static int nearest()
Expand Down Expand Up @@ -40,6 +41,10 @@ public static int clampToEdge()
{
return _clampToEdge;
}
public static int repeat()
{
return _repeat;
}

public static void init(INativeGL ngl)
{
Expand All @@ -51,5 +56,6 @@ public static void init(INativeGL ngl)
_linearMipmapLinear = ngl.TextureParameterValue_LinearMipmapLinear();

_clampToEdge = ngl.TextureParameterValue_ClampToEdge();
_repeat = ngl.TextureParameterValue_Repeat();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private Mesh createMesh(G3MRenderContext rc)
final IStringUtils su = IStringUtils.instance();
final String textureName = "HUDImageRenderer" + su.toString(_instanceID) + "/" + su.toString(_changeCounter++);

final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), textureName, false);
final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), textureName, false, GLTextureParameterValue.clampToEdge());

_image = null;
_image = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Mesh createMesh(G3MRenderContext rc)

TexturesHandler texturesHandler = rc.getTexturesHandler();

final TextureIDReference textureID = texturesHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false);
final TextureIDReference textureID = texturesHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false, GLTextureParameterValue.clampToEdge());
if (textureID == null)
{
rc.getLogger().logError("Can't upload texture to GPU");
Expand All @@ -86,7 +86,7 @@ private Mesh createMesh(G3MRenderContext rc)
TextureIDReference backgroundTextureID = null;
if (hasBackground)
{
backgroundTextureID = texturesHandler.getTextureIDReference(_backgroundImage, GLFormat.rgba(), _backgroundImageName, false);
backgroundTextureID = texturesHandler.getTextureIDReference(_backgroundImage, GLFormat.rgba(), _backgroundImageName, false, GLTextureParameterValue.clampToEdge());

if (backgroundTextureID == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public void dispose()
public abstract int TextureParameterValue_LinearMipmapLinear();

public abstract int TextureParameterValue_ClampToEdge();
public abstract int TextureParameterValue_Repeat();

public abstract int Alignment_Pack();
public abstract int Alignment_Unpack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ public final void render(G3MRenderContext rc, MutableVector3D cameraPosition, do
{
if ((_textureId == null) && (_textureImage != null))
{
_textureId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _imageID, false);
_textureId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _imageID, false, GLTextureParameterValue.clampToEdge());

_textureImage = null;
_textureImage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void prepareWidget(IImage image, String imageName)
texCoords.add(0.0f, 0.0f); // vertex 3
texCoords.add(1.0f, 0.0f); // vertex 4

final TextureIDReference textureID = _texHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false);
final TextureIDReference textureID = _texHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false, GLTextureParameterValue.clampToEdge());

// #warning TODO: share unit texCoords
if (_textureMapping != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ private Mesh createMesh(G3MRenderContext rc)
return null;
}

final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image1, GLFormat.rgba(), _imageURL1._path, false);
final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image1, GLFormat.rgba(), _imageURL1._path, false, GLTextureParameterValue.clampToEdge());

if (texId == null)
{
rc.getLogger().logError("Can't upload texture to GPU");
return null;
}

final TextureIDReference texId2 = rc.getTexturesHandler().getTextureIDReference(_image2, GLFormat.rgba(), _imageURL2._path, false);
final TextureIDReference texId2 = rc.getTexturesHandler().getTextureIDReference(_image2, GLFormat.rgba(), _imageURL2._path, false, GLTextureParameterValue.clampToEdge());

if (texId2 == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc)
return null;
}

final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false);
final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false, GLTextureParameterValue.clampToEdge());

_textureImage = null;
_textureImage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc)
if (_downloadedImage != null)
{
final boolean generateMipmap = false;
_textureId = rc.getTexturesHandler().getTextureIDReference(_downloadedImage, GLFormat.rgba(), getURL()._path, generateMipmap);
_textureId = rc.getTexturesHandler().getTextureIDReference(_downloadedImage, GLFormat.rgba(), getURL()._path, generateMipmap, GLTextureParameterValue.clampToEdge());

_downloadedImage = null;
_downloadedImage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class TextureSpec
private final int _width;
private final int _height;
private final boolean _generateMipmap;
private final int _wrapMode;

//C++ TO JAVA CONVERTER TODO TASK: The implementation of the following method could not be found:
// TextureSpec operator =(TextureSpec that);
Expand All @@ -41,6 +42,17 @@ public TextureSpec(String id, int width, int height, boolean generateMipmap)
_width = width;
_height = height;
_generateMipmap = generateMipmap;
_wrapMode = GLTextureParameterValue.clampToEdge();

}

public TextureSpec(String id, int width, int height, boolean generateMipmap, int wrapMode)
{
_id = id;
_width = width;
_height = height;
_generateMipmap = generateMipmap;
_wrapMode = wrapMode;

}

Expand All @@ -50,6 +62,7 @@ public TextureSpec()
_width = 0;
_height = 0;
_generateMipmap = false;
_wrapMode = GLTextureParameterValue.clampToEdge();
}

public TextureSpec(TextureSpec that)
Expand All @@ -58,6 +71,7 @@ public TextureSpec(TextureSpec that)
_width = that._width;
_height = that._height;
_generateMipmap = that._generateMipmap;
_wrapMode = that._wrapMode;

}

Expand All @@ -76,9 +90,14 @@ public final int getHeight()
return _height;
}

public final int getWrapMode()
{
return _wrapMode;
}

public final boolean equalsTo(TextureSpec that)
{
return ((_id.compareTo(that._id) == 0) && (_width == that._width) && (_height == that._height));
return ((_id.compareTo(that._id) == 0) && (_width == that._width) && (_height == that._height) && (_wrapMode == that._wrapMode));
}

public final boolean lowerThan(TextureSpec that)
Expand Down Expand Up @@ -132,6 +151,7 @@ public int hashCode() {
result = prime * result + _height;
result = prime * result + ((_id == null) ? 0 : _id.hashCode());
result = prime * result + _width;
result = prime * result + _wrapMode;
return result;
}

Expand All @@ -153,6 +173,8 @@ public boolean equals(Object obj) {
return false;
if (_width != other._width)
return false;
if (_wrapMode != other._wrapMode)
return false;
return true;
}
}
Loading