Sign in to follow this  
Der_Therion

Atrix / Problem with Textures

Recommended Posts

Hello @ All,

i am working on a SpaceSim with Android (later porting to IOS) ,
3 Weeks ago i ported the Engine from Open GL ES 1.0 to 2.0. (Android Level 10. (2.3)

Everything works fine while testing on all devices i can get .... till i tested on a Motorola Atrix / Mobile and Tablet.

It seems that the Tegra Chip eating up my Textures...researching in google shows me only
that this chipset got a different compressions... but i dont know what to do with this information.

Some of the Textures looks like stranges lines , an some are working perfekt
(the "Schrift.png" is a 512x512png is working perfekt (its my GUI and Fonts))
the planet textures are disturbed (Only on this Device)
the effect mostly hit the mimapped larger textures (all are power of 2 and largest is 1024x512)

The geometry of the objects seems all to be working good, depth buffers,position of objekts...


Maybe an error in my GL ES 2.0 texture loading Code:

Can anybody help me?

Greetings Theri :)

[source]GLES20.glGenTextures(max_textures_loading, textures, 0);
public void loadtextur(int textur_id,Context context)
{

int resource=R.drawable.icon;

if (textur_id==0) resource=R.drawable.schrift;
if (textur_id==2) resource=R.drawable.planet_1;
if (textur_id==2) resource=R.drawable.raster;

if (textur_id==3) resource=R.drawable.verlauf;

if (textur_id==5) resource=R.drawable.sun;
if (textur_id==6) resource=R.drawable.shadow;
if (textur_id==7) resource=R.drawable.sterne_1;
if (textur_id==8) resource=R.drawable.sterne_2;
if (textur_id==9) resource=R.drawable.sterne_3;
if (textur_id==10) resource=R.drawable.sterne_4;
if (textur_id==11) resource=R.drawable.sterne_5;
if (textur_id==12) resource=R.drawable.sterne_6;

if (textur_id==13) resource=R.drawable.nebel_1;
if (textur_id==14) resource=R.drawable.nebel_2;
if (textur_id==15) resource=R.drawable.nebel_3;
if (textur_id==16) resource=R.drawable.nebel_4;
if (textur_id==17) resource=R.drawable.nebel_5;
if (textur_id==18) resource=R.drawable.nebel_6;

if (textur_id==19) resource=R.drawable.hintergrund;


if (textur_id==20) resource=R.drawable.wolken;
if (textur_id==21) resource=R.drawable.planet_1;
if (textur_id==23) resource=R.drawable.planet_3;
if (textur_id==24) resource=R.drawable.planet_4;



//NEU
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
bitmapOptions.inScaled = false;

bitmap = BitmapFactory.decodeResource(context.getResources(), resource, bitmapOptions);
bitmap = Bitmap.createBitmap(bitmap, 0, 0,bitmap.getWidth(), bitmap.getHeight());





boolean mipmap_ok=true;

if (textur_id==0) mipmap_ok=false;


GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[textur_id]);

// Only a try/test
// GLES20.glPixelStorei(GLES20.GL_PACK_ALIGNMENT, 4);
//GLES20.glPixelStorei(GLES20.GL_PACK_ALIGNMENT, 1);



// MipMap Linear als Standart
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST); //_MIPMAP_NEAREST

if (mipmap_ok==false)
{
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
}





// Wrap Repeat als Standart
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);

GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);


if (mipmap_ok==true)
{
GLES20.glHint(GLES20.GL_GENERATE_MIPMAP_HINT, GLES20.GL_NICEST);
GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
}



// Erzeuge MipMaps
// GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE);




bitmap.recycle();

if (textures[textur_id] == 0)
{
throw new RuntimeException("Error loading texture.");
}

} [/source]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this