Author Topic: Changing Near plane leads to weird "reproject" results  (Read 3537 times)

Offline atreyu64

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Changing Near plane leads to weird "reproject" results
« Reply #15 on: March 25, 2016, 11:07:38 am »
Ok thanks a lot !
I don't use any shadows so it should be ok.

Cheers,

Sylvain

Offline atreyu64

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Changing Near plane leads to weird "reproject" results
« Reply #16 on: March 29, 2016, 11:46:51 pm »
Sorry to bother you again, but it seems like setting Config.glIgnoreNearPlane to false does not work properly on Android.

Have you ever noticed anything wrong with it ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: Changing Near plane leads to weird "reproject" results
« Reply #17 on: March 30, 2016, 08:47:53 am »
I'm not aware of any problems. I'll look into it. What does 'not properly' mean in this context?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: Changing Near plane leads to weird "reproject" results
« Reply #18 on: March 30, 2016, 10:22:42 am »
I had a look and did some tests with it...I can't find an issue. It looks fine to me. Can you describe your problem in a little more detail? Do you have a test case?

Offline atreyu64

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Changing Near plane leads to weird "reproject" results
« Reply #19 on: March 30, 2016, 10:27:39 am »
Well actually it's like if glIgnoreNearPlane was not taken into account, but sometimes the display is ok, only when I don't call the renderScene method, which happens here  when "displayNeedsUpdate" is set to false :

Code: [Select]
if(displayNeedsUpdate) {
cameraChanged();
displayNeedsUpdate = false;

world.renderScene(fb);
world2.renderScene(fb);
}

world.draw(fb);
world2.draw(fb);

blitting();

fb.display();

I'm doing this to avoid rendering again the scene when nothing has changed in the scene.
If I try to call renderScene evry time, it is like glIgnoreNearPlane was ignored.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: Changing Near plane leads to weird "reproject" results
« Reply #20 on: March 30, 2016, 10:40:25 am »
If anything, I would have expected it to be the other way round. If you omit the renderScene()-call, the draw()-call actually triggers some additional calculations that had to be done per frame but are usually done in renderScene(). These calculations were done too early to take a modified plane into account. However, I'm not sure why this should explain the behaviour that you are describing.
Anyway, I've updated the beta-jar of jPCT-AE. Please give it a try and see if that helps. If it doesn't (or makes things worse), can you please provide me with a test case?

Offline atreyu64

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Changing Near plane leads to weird "reproject" results
« Reply #21 on: March 30, 2016, 10:54:17 am »
Ok I'll give it a try tonight, thanks a lot Helge.

So what you're saying is that I should move the renderScene calls out of the "if" block ? Like this :

Code: [Select]
if(displayNeedsUpdate) {
cameraChanged();
displayNeedsUpdate = false;
}

world.renderScene(fb);
world2.renderScene(fb);

world.draw(fb);
world2.draw(fb);

blitting();

fb.display();

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: Changing Near plane leads to weird "reproject" results
« Reply #22 on: March 30, 2016, 10:59:07 am »
Not necessarily. But from your description, it worked when you omit them but not if you are actually calling them...which puzzles me. Anyway, please give the modified jar a try and see if that helps. If not, try to move them out of this block and see if that helps. If that doesn't help either, I need a test case.

Offline atreyu64

  • byte
  • *
  • Posts: 44
    • View Profile
Re: Changing Near plane leads to weird "reproject" results
« Reply #23 on: March 30, 2016, 10:16:05 pm »
The new beta jar did not change anything, that said I have found the solution.
Actually I use a skybox, and I was calling the skybox.render() method after world.renderScene().
After switching this call order, everything works fine.

Thanks again and sorry for bothering you, cheers !

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: Changing Near plane leads to weird "reproject" results
« Reply #24 on: March 30, 2016, 10:19:22 pm »
No problem. The order in the draw()-method was wrong anyway. Even if it wasn't a problem in your case, it's better to have it fixed.