Revision 05403bba
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedTexture.java | ||
---|---|---|
82 | 82 |
{ |
83 | 83 |
//android.util.Log.e("Texture", "creating "+mID); |
84 | 84 |
|
85 |
if( mTextureDataH[0]==0 ) GLES20.glGenTextures(1, mTextureDataH, 0); |
|
86 |
|
|
87 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
|
88 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR ); |
|
89 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR ); |
|
90 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE ); |
|
91 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE ); |
|
85 |
if( mTextureDataH[0]==0 ) |
|
86 |
{ |
|
87 |
GLES20.glGenTextures(1, mTextureDataH, 0); |
|
88 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
|
89 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR ); |
|
90 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR ); |
|
91 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE ); |
|
92 |
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE ); |
|
93 |
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, flipBitmap(mBmp), 0); |
|
94 |
} |
|
95 |
else |
|
96 |
{ |
|
97 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
|
98 |
GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0,0,0,flipBitmap(mBmp)); |
|
99 |
} |
|
92 | 100 |
|
93 |
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, flipBitmap(mBmp), 0); |
|
94 | 101 |
mBmp = null; |
95 | 102 |
} |
96 | 103 |
} |
... | ... | |
254 | 261 |
/** |
255 | 262 |
* Returns the depth of the Texture. |
256 | 263 |
* <p> |
257 |
* Admittedly quite a strange method. Why do we need to pass a Grid to it? Because one cannot determine
|
|
258 |
* 'depth' of a texture when rendered based only on the texture itself, that depends on the Grid it is
|
|
264 |
* Admittedly quite a strange method. Why do we need to pass a Mesh to it? Because one cannot determine
|
|
265 |
* 'depth' of a texture when rendered based only on the texture itself, that depends on the Mesh it is
|
|
259 | 266 |
* rendered with. |
260 | 267 |
* |
261 | 268 |
* @return depth of the Object, in pixels. |
262 | 269 |
*/ |
263 |
public int getDepth(MeshObject grid)
|
|
270 |
public int getDepth(MeshObject mesh)
|
|
264 | 271 |
{ |
265 |
return grid==null ? 0 : (int)(mSizeX*grid.zFactor);
|
|
272 |
return mesh==null ? 0 : (int)(mSizeX*mesh.zFactor);
|
|
266 | 273 |
} |
267 | 274 |
} |
Also available in: Unified diff
rename all the 'grid' variables to 'mesh'.