Author Topic: Version updates!  (Read 79193 times)

Offline Polomease

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Version updates!
« Reply #195 on: February 18, 2011, 08:00:31 pm »
Which version of jPCT-AE is that? The latest that i've posted in this thread?
Yes, I just downloaded from the link again to make sure I was using the correct one and the problem is still there.

I got the link from this post:
Another update. This version improves performance for some collision detection methods and should fix render targets on phones where they didn't work before (like mine): http://www.jpct.net/jpct-ae/download/alpha/jpct_ae.jar

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #196 on: February 18, 2011, 08:02:10 pm »
]Yes. As said above, it's caused by the way how OpenGL maps the frame buffer to the texture.
BTW: You can flip a blit by doing something like

Code: [Select]
fb.blit(renderTarget, 0, 0, 0, 256, 256, 256, 256, -256, -1, false, null);

instead of

Code: [Select]
fb.blit(renderTarget, 0, 0, 0, 0, 256, 256, 256, 256, -1, false, null);

It's not an official feature but it works due to the way blitting is implemented.



Thanks  :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #197 on: February 18, 2011, 09:56:33 pm »
Yes, I just downloaded from the link again to make sure I was using the correct one and the problem is still there.
Should be the latest version then. You can try to set Config.renderTargetsAsSubImages=false; but i don't expect much from that.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #198 on: February 18, 2011, 10:01:21 pm »
I have a Samsung Galaxy S (model: SAMSUNG-SGH-I897) with Android 2.1.
I have galaxy s, too ... but with 2.2.1 and texture is correct

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #199 on: February 18, 2011, 10:06:19 pm »
Most likely a driver issue then...or Polomease's version isn't the latest by accident.

Offline Polomease

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Version updates!
« Reply #200 on: February 19, 2011, 03:19:55 am »

I got it to work correctly.

First I set the Config setting you suggested.
Code: [Select]
Config.renderTargetsAsSubImages = false;

That got the rendering of the texture correct but the rendered texture was flipped.
I then used the code you provided for flipping the texture.
Code: [Select]
fb.blit(renderTarget, 0, 0, 0, 256, 256, 256, 256, -256, -1, false, null);

After those changes I got the example code to work like the does in the emulator.

It might be a good idea to add the flipping of textures as a feature to the library.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #201 on: February 19, 2011, 08:37:04 pm »
I thought that you were already doing something like the blitting trick...or why is the texture correctly oriented in your emulator screen shot....confusing. Anyway, i suggest to not rely on render to texture for your application. Use it as an optional effect but don't base the application on it. It seems to be poorly implemented in the drivers.

Offline Polomease

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Version updates!
« Reply #202 on: February 19, 2011, 10:39:12 pm »
It seems to be poorly implemented in the drivers.

I understand what you mean, but it's still a bummer.  :(


Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #203 on: February 21, 2011, 01:46:52 pm »
I want to replace texture in HelloWorld example by rendered texture, but after this code are all boxs black... and if I try only fb.clear(RGBColor.red) without fb.blit(...), red are only two boxs and two others are black...
Code: [Select]
Texture tex = new Texture(64, 64);
fb.setRenderTarget(tex);
fb.clear();
fb.blit(tm.getTexture("texture"), 0, 0, 0, 0, 64, 64, false);
fb.display();
fb.removeRenderTarget();
tm.replaceTexture("texture", tex);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #204 on: February 21, 2011, 02:23:50 pm »
The red/black issue comes from your combination of ambient and additional color. Ambient in this example is black (0,0,0). If your texture is red and the object's additional color is blue, the result is still black. Try to increase ambient color. I'm not sure about the other issue. Have to tried if it works with that replaceTexture()-part?
« Last Edit: February 21, 2011, 02:25:36 pm by EgonOlsen »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #205 on: February 21, 2011, 03:02:00 pm »
I set world.setAmbientLight(255, 255, 255) ... tm.replaceTexture(...) works correctly... ok, I fond where is problem...
this code return every what in set in fb.clear(), after this clear command can be whatever... so if I use fb.clear(RGBColor.RED) texture will be red,...
Code: [Select]
tex = new Texture(64, 64);
fb.setRenderTarget(tex);
fb.clear();
fb.blit(tm.getTexture("texture2"), 0, 0, 0, 0, 64, 64, false);
fb.display();
fb.removeRenderTarget();
tm.replaceTexture("texture", tex);
but this works fine... fb.clear() is not used
Code: [Select]
tex = new Texture(64, 64);
fb.setRenderTarget(tex);
fb.blit(tm.getTexture("texture2"), 0, 0, 0, 0, 64, 64, false);
fb.display();
fb.removeRenderTarget();
tm.replaceTexture("texture", tex);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #206 on: February 21, 2011, 03:34:06 pm »
Very strange. I'll investigate this but most likely not today.

Offline rschwemm

  • byte
  • *
  • Posts: 18
    • View Profile
Re: Version updates!
« Reply #207 on: February 21, 2011, 03:49:04 pm »
No idea if it's related, but lwjgl changed the default glClearColor's alpha in v2.7:
http://lwjgl.org/forum/index.php?topic=3741

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #208 on: February 21, 2011, 04:59:48 pm »
Not related. This is Android only, it has nothing to do with LWJGL.

@Thomas.: Could you please try what happens if you add clear() back in and do
Code: [Select]
gl.glFlush();
gl.glFinish();
right before the call to fb.display()?
 

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #209 on: February 21, 2011, 06:41:40 pm »
no changes