www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: raft on March 12, 2013, 09:05:44 pm

Title: resizing FrameBuffer and shadows
Post by: raft 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
(http://s11.postimage.org/pivdovn9v/size_1.jpg)

reverse is also true. this is what I get by a resizing a higher resolution to 800x600
(http://s12.postimage.org/6zje01qn1/size_2.jpg)

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 ???
Title: Re: resizing FrameBuffer and shadows
Post by: raft on March 12, 2013, 09:08:11 pm
and this happens all the time in the same way. not undeterministic
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen 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...
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen on March 12, 2013, 10:54:15 pm
Please try this jar: http://jpct.de/download/beta/jpct.jar (http://jpct.de/download/beta/jpct.jar)
Title: Re: resizing FrameBuffer and shadows
Post by: raft 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 (http://aptalkarga.com/tmp/weird-1.avi)
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen 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?
Title: Re: resizing FrameBuffer and shadows
Post by: raft 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)
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen 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.
Title: Re: resizing FrameBuffer and shadows
Post by: raft 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 :)
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen on March 13, 2013, 07:56:26 am
...and not very clear in docs ???
I agree. I'll make this more clear.
Title: Re: resizing FrameBuffer and shadows
Post by: raft 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?


Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen 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?
Title: Re: resizing FrameBuffer and shadows
Post by: raft 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.
Title: Re: resizing FrameBuffer and shadows
Post by: EgonOlsen on March 17, 2013, 01:51:43 pm
I've no idea what else might be the reason... ???