Author Topic: resizing FrameBuffer and shadows  (Read 4829 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
resizing FrameBuffer and shadows
« on: March 12, 2013, 09:05:44 pm »
I faced another weird situation. if I resize FrameBuffer when shadows are on, size change isn't reflected. FrameBuffer.getWidth/Height returns the correct values but buffer is rendered as initial size.

this is what I get by resizing 800x600 to 1024x768


reverse is also true. this is what I get by a resizing a higher resolution to 800x600


If I disable shadows and resize screen again, everything seems ok. but after enabling shadows and resizing I end up with initial size.

I've updated my driver twice and even made a bios  update.

and this is the sequence of rendering:

Code: [Select]
skyBox render / draw
clearZBuffer
world render/draw
shadowHelper.updateShadowMap
shadowHelper.drawScene
buffer update/display

really weird ???

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #1 on: March 12, 2013, 09:08:11 pm »
and this happens all the time in the same way. not undeterministic

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #2 on: March 12, 2013, 10:41:39 pm »
I see...i think i found the reason for this, i just can't figure out why the code does what it does...give me some minutes...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #3 on: March 12, 2013, 10:54:15 pm »

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #4 on: March 12, 2013, 11:30:47 pm »
thanks, yes resizing is fixed now :)

however I have another weird problem. please see the video below. sometimes happens after resizing when shadows are enabled.

http://aptalkarga.com/tmp/weird-1.avi

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #5 on: March 13, 2013, 07:17:55 am »
Looks like some threading issue...i anything (logic, rendering, input processing...) done in another thread. Is Config.useMultipleThreads enabled?

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #6 on: March 13, 2013, 07:26:37 am »
Is Config.useMultipleThreads enabled?

not exclusively. it is left as default which is false I suppose (not in javadocs)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #7 on: March 13, 2013, 07:38:10 am »
Yes, default is false.

Why are you actually doing this:

Code: [Select]
world render/draw
shadowHelper.updateShadowMap
shadowHelper.drawScene

? The shadowHelper.drawScene replaces the world render/draw calls. Try to remove that world render/draw part and see if that helps.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #8 on: March 13, 2013, 07:52:16 am »
Why are you actually doing this:
because of being a shadows newbie I suppose. and not very clear in docs ???

Try to remove that world render/draw part and see if that helps.
yes, seems as it helped. problem was undeterministic but never happened in last trials. thanks :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #9 on: March 13, 2013, 07:56:26 am »
...and not very clear in docs ???
I agree. I'll make this more clear.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #10 on: March 14, 2013, 10:15:40 pm »
Try to remove that world render/draw part and see if that helps.
yes, seems as it helped. problem was undeterministic but never happened in last trials. thanks :)

although very seldom, I still have this issue. possibly driver problem or?



Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #11 on: March 14, 2013, 11:39:15 pm »
I'm not sure...i looked like as if the scene was rendered using a wrong camera/camera matrix. Are you by any chance doing something in another thread that modifies jPCT related instances like moving the camera in an event listener or something like that?

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: resizing FrameBuffer and shadows
« Reply #12 on: March 15, 2013, 12:08:43 am »
I guess no, I double checked it. GUI is based on TWL so all GUI events are handled in GL thread.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: resizing FrameBuffer and shadows
« Reply #13 on: March 17, 2013, 01:51:43 pm »
I've no idea what else might be the reason... ???