Author Topic: Strange behaviour with static Texture background  (Read 5306 times)

Offline livingcode

  • byte
  • *
  • Posts: 5
    • View Profile
Strange behaviour with static Texture background
« on: December 18, 2010, 05:42:32 pm »
Hello!
I want to make a static background (from picture) and to show a simple cube infront of it. I have modified the Hello World example - instead of using color for background, I used 512*512 big Texture. But when I rotate cube, something strange happens:

(when I load it and don't touch it)




(the more I touch/rotate it, the more it fades!)

Code modifications:
I load my texture into TextureManager from onCreate()
Code: [Select]
TextureManager.getInstance().addTexture("textureBG", new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.garden)), 512, 512)));

And then in the onDrawFrame(GL10 gl)
Code: [Select]
fb.blit(TextureManager.getInstance().getTexture("textureBG"), 512, 512, 0, 0, 512, 512, false);
world.renderScene(fb);
world.draw(fb);
fb.display();

What am I doing wrong? How can I fix it?
Thank You!

Offline Nick

  • byte
  • *
  • Posts: 8
    • View Profile
Re: Strange behaviour with static Texture background
« Reply #1 on: December 18, 2010, 06:09:17 pm »
Looks like the same problem as I have, there are some possibilities. You can look at the post I started a few days ago:

http://www.jpct.net/forum2/index.php/topic,1847.0.html

Hope it helps for you, it didn't that good for my project. It did only help for me a little bit when trying to edit the triangles.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Strange behaviour with static Texture background
« Reply #2 on: December 18, 2010, 06:44:02 pm »
Looks like as if you have removed the clear(), which prevents the zbuffer from being cleared. Try to add it back in and see if that helps.

BTW: I can't see the images in the post directly!?

Offline livingcode

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Strange behaviour with static Texture background
« Reply #3 on: December 18, 2010, 07:27:35 pm »
Omg, it works :) fb.clear() solves the problem. Thank You!

(I guess http://imageshare.web.id has some problems with displaying thumbs. It works ok, if you click on 'broken icon' :) )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Strange behaviour with static Texture background
« Reply #4 on: December 18, 2010, 08:29:55 pm »
If you think that not clearing the color buffer might be an option instead (there is a method called clearZBufferOnly() for this), you are actually right...but i don't recommend that either, because some phones with Qualcomm chips are having problems then and start to render minimized versions of the geometry multiple times per screen. Looks pretty funny though...

Edit: Firefox doesn't show a "broken icon"... ;)

Offline livingcode

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Strange behaviour with static Texture background
« Reply #5 on: December 18, 2010, 10:06:07 pm »
Heh if it works on my i7500, than it works anywhere ;) Heh (Google Chrome shows broken icon ;))

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Strange behaviour with static Texture background
« Reply #6 on: December 18, 2010, 10:08:54 pm »
jPCT-AE's development platform is an i7500... ;D

Offline livingcode

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Strange behaviour with static Texture background
« Reply #7 on: December 19, 2010, 03:47:29 pm »
Yes, I know ;)
Offtopic: I've seen here (http://www.jpct.net/forum2/index.php/topic,1853.0.html) that You still have 1.5 on Your Galaxy. Did You know that 2.2.1 is already possible on i7500? Works great, fast (as fast as i7500 can :D), only down side is that bluetooth doesn't work (im not sure about that, because I dont use it anyways..) Link: http://code.google.com/p/gaosp/

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Strange behaviour with static Texture background
« Reply #8 on: December 19, 2010, 11:05:15 pm »
Yes, i know...but i'm somehow no friend of unofficial versions. Can't really say why, because it doesn't match my usual habbits. Might be because i want to use something that "real" people are using for development to be sure that it works for most "normal" phones. After all, the i7500 was pretty helpful (being the upper low end, incompatible device that it is) for optimizing things that might have remained untouched otherwise because current phones are fast enough anyway.

Offline livingcode

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Strange behaviour with static Texture background
« Reply #9 on: December 20, 2010, 05:48:32 pm »
That's true :) + I can be sure JPCT-AE works well on my i7500 :) Thank You!