Page 1 of 1

Offscreen rendering cuts off sometimes

Posted: Fri 1. Oct 2010, 18:04
by STRESS
I think there is a bug in the JOGL offscreen render when it offscreen aspect ratio differs suspentially to the on screen one. For example my onscreen dimension is 486x1033 and my offscreen dimensions are 783x559. When I look at the offscreen image it is clealy cut off on the left and right border compared to the onscreen image. Is that supposed to be?

Also I had a quick look at the offscreen render code I think some things are clearly wrong implemented to the intention it tries to achieve. My guess is it tries to tile up the image in 512x512 blocks and render each block individually? But actually it does not do that correctly in the case of 783x559 offscreen image because it only has one tile which is 783x559 which is okay since PBuffer on all modern cards should be able to be non-power-of-two.

Btw. why not use FBOs?

Re: Offscreen rendering cuts off sometimes

Posted: Tue 5. Oct 2010, 14:55
by steffen
I am not able to reproduce the problem - do you render via the menu or from code? Can you post a minimal example that demonstrates the problem?
Btw. why not use FBOs?
Good question, I think this is also a point we should keep in mind for improving the jogl backend. BTW: Are you interested in helping us to improve the jogl-backend? I think there are several parts in the renderer that should be done in a more modern way (no more display lists etc. ...). I think your knowledge about OpenGL programming would be very helpful!

Re: Offscreen rendering cuts off sometimes

Posted: Tue 5. Oct 2010, 17:32
by gunn
If the dimensions of the offscreen render are different from the onscreen picture, then the dimensions of the offscreen render will determine what is seen and what not. If your offscreen is thin and tall and the onscreen wide and fat, then naturally the offscreen will be cut off on left and right. Basically the offscreen renderer has no idea that there is an "onscreen" image, nor do I think it should ...

As far as the other question, it is indeed true that the JOGL offscreen renderer forces the images it produces to be rounded to multiples of 4 or 8 pixels (I can't remember right now). That's due to the bookkeeping required to handle the other cases, and also to uncertainty about how to handle the pbuffer read/write when single pixels are involved. Not good reasons, perhaps, but that's how it is. If you use the menu to invoke the offscreen render, then the resulting image will be rescaled to achieve the desired anti-aliasing factor (the JOGL backend computes un-antialiased images proportionally larger), and the output images should have exactly the specified dimensions. There may be a bit of distortion involved due to the rounding in the offscreen renderer ... but I use it alot and haven't noticed anything.

Re: Offscreen rendering cuts off sometimes

Posted: Wed 6. Oct 2010, 15:19
by STRESS
steffen wrote:
Btw. why not use FBOs?
Good question, I think this is also a point we should keep in mind for improving the jogl backend. BTW: Are you interested in helping us to improve the jogl-backend? I think there are several parts in the renderer that should be done in a more modern way (no more display lists etc. ...). I think your knowledge about OpenGL programming would be very helpful!
Thank you! Yes sure I am interested! I just don't know how much time my supervisors will allow me to spend time to help working on this.

There might be a couple of things I additionally can bring onto the table or I would like eventually see merged into as at the moment my codebase has diverted quite a bit to yours. For example I brought the native SWT/JOGL implementation back to life (since we need native SWT for RCP projects can't use Swing-SWT-bridge it turned out being too unstable). I made some changes in the JOGL texture handling (added a few additional formats) since we needed them and also changed the GLSL shader managing, plus over bits and bobs.

Potentialy there has been thoughts for even replacing the software backend to being fully SWT compatible at my side.

Re: Offscreen rendering cuts off sometimes

Posted: Wed 6. Oct 2010, 15:23
by STRESS
gunn wrote:If the dimensions of the offscreen render are different from the onscreen picture, then the dimensions of the offscreen render will determine what is seen and what not. If your offscreen is thin and tall and the onscreen wide and fat, then naturally the offscreen will be cut off on left and right. Basically the offscreen renderer has no idea that there is an "onscreen" image, nor do I think it should ...
I understand your point the problem is that I use the export to go to a printer and the printer objects returns different dimensions / aspect ratio then the screen one. Which made it being clipped. So I have a slightly different use-case scenario to the original intended one I guess. But I fixed it on my site by now.

Re: Offscreen rendering cuts off sometimes

Posted: Wed 6. Oct 2010, 17:50
by steffen
STRESS wrote:Thank you! Yes sure I am interested! I just don't know how much time my supervisors will allow me to spend time to help working on this.

There might be a couple of things I additionally can bring onto the table or I would like eventually see merged into as at the moment my codebase has diverted quite a bit to yours. For example I brought the native SWT/JOGL implementation back to life (since we need native SWT for RCP projects can't use Swing-SWT-bridge it turned out being too unstable). I made some changes in the JOGL texture handling (added a few additional formats) since we needed them and also changed the GLSL shader managing, plus over bits and bobs.
I think that we should start with a discussion on what parts of the backend should be changed and how they should be implemented. Your extensions to texture handling sound very interesting: do you also support compressed formats? I think it would be very useful if jreality could handle compressed textures (png/jpg). It would also be great if we could integrate the SWT backend into the repository.
STRESS wrote:Potentialy there has been thoughts for even replacing the software backend to being fully SWT compatible at my side.
Actually I have similar plans, i.e. removing all awt dependencies (the aim is to develop an android backend). A self-contained software backend (neither AWT nor SWT) would be a good starting point. From this we can derive awt/swt/android/... viewers.

Here our central SVN repository makes life difficult (both sharing/merging your codebase as well as starting fundamental changes to the project). As I have written in http://www3.math.tu-berlin.de/jreality/ ... ?f=4&t=513 I am looking into distributed version control systems. I hope jreality will move to another VCS before I start with fundamental changes to the codebase.

Can you send me your contact information via email? I am also curious to hear what you are actually doing with jreality?