Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Der_Therion

Member Since 14 Nov 2007
Offline Last Active Nov 21 2012 05:28 AM
-----

Topics I've Started

Atrix / Problem with Textures

03 April 2012 - 02:33 AM

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 :)

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.");

	   }

  

   }

SpaceGame Background Stars via Skybox/Dome?

12 June 2011 - 02:27 AM

Hello @all,

i am work on some ideas for an 3d space game..at this point its about the stars background.

(its not a problem to create a starfield jpg with gimp2), more the problem is.. the background

is dynamicly created when entering the system/orbit of an planet.. but how to

handle the background in 3d..




at moment i create 6 face in FBO Textures with view angle of 90 (rendered each with same scenario,but different view angels)

and put them in a skybox

and i always still see the edges of the skybox..is there any other method i can use?




do you have a hint/link for an good page about rendering planets/athomsperic effects etc?

(at the end the planets surfaces/clouds is created dynamicly..to get a giant amount a different planets)




anybody remember StarGilder2 in the 1988 :)




much thanks :)














Vector back to glrotate question

29 May 2011 - 05:45 AM

Hello @ All,

i got an working 3 Vector rotation system (X;Y;Z) for an space sim game,

but now i want to set the rotation in opengl for the objects(and later the camera)

orientate the object to the z orientation vector is very easy with this formula:


//vx,vy,vz holds the Z vector

float wi_r1=get_winkel(vx,vz); //get angle of vx,vz)
float wi_r2=get_winkel( get_entf_2d(vx,vz),vy ); //get angle of distance (vx,vz)/vy

gl.glRotatef(wi_r1, 0, 1, 0);
gl.glRotatef(wi_r2+90, 1, 0, 0);

this is working absolutly perfect


but my problem is the roll
gl.glRotatef(roll, 0, 0, 1);


how do i calculate an float value from the Vx/Vy/Vz vectors the setup for the opengl



**UPDATE**




the glulookat function set up my camera 100% correct (even with roll by giving the up vector)

now i only need the same thing to the painted objects

//camera

gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();

glu.gluPerspective( pvi, asp, near,far );
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();


gl.glTranslatef(0,0,camera_distance);

glu.gluLookAt(vector[0],vector[1],vector[2], // origin the Z Vector
0,0,0, //targeting the zero origin
vector[6],vector[7],vector[8]); //up vector (Y)

...




and here i need the same like the glulookat do...

gl.glPushMatrix();
texture[9].bind();

// rotate to vetctors
gl.glCallList(2005);
gl.glPopMatrix();


much greetings




Posted Image

PARTNERS