Version updates!

Started by EgonOlsen, March 28, 2010, 09:47:50 PM

Previous topic - Next topic

Polomease

Quote from: EgonOlsen on February 18, 2011, 10:57:19 AM
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:
Quote from: EgonOlsen on February 15, 2011, 10:44:07 PM
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

Thomas.

Quote from: EgonOlsen on February 18, 2011, 04:58:58 PM
Quote from: EgonOlsen on February 17, 2011, 09:35:04 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


fb.blit(renderTarget, 0, 0, 0, 256, 256, 256, 256, -256, -1, false, null);


instead of


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

EgonOlsen

Quote from: Polomease on February 18, 2011, 08:00:31 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.

Thomas.

Quote from: Polomease on February 18, 2011, 03:01:36 AM
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

EgonOlsen

Most likely a driver issue then...or Polomease's version isn't the latest by accident.

Polomease


I got it to work correctly.

First I set the Config setting you suggested.

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.

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.


EgonOlsen

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.

Polomease

Quote from: EgonOlsen on February 19, 2011, 08:37:04 PM
It seems to be poorly implemented in the drivers.

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


Thomas.

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


EgonOlsen

#204
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?

Thomas.

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

EgonOlsen

Very strange. I'll investigate this but most likely not today.

rschwemm

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

EgonOlsen

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

gl.glFlush();
gl.glFinish();

right before the call to fb.display()?

Thomas.