Hi,
I read a lot of forum (this one, JGO ...) and I cannot found clear example for offscreen rendering. The last I tried is what Sven said : https://github.com/demoscenepassivist/SocialCoding/blob/master/code_demos_jogamp/src/framework/base/BaseFrameBufferObjectRendererExecutor.java I choose a simple test first : I want to save a file of a resized a texture. Here is my code : RenderEngine.java Can you tell me what I'm doing wrong, what is useless and how to finally save the render. Thank you |
Administrator
|
Hi
Where is the rest of your source code? I only see the class extending GLEventListener.
Julien Gouesse | Personal blog | Website
|
There's no need for the rest of the source code : I will manage in the display the conditions for rendering. |
Administrator
|
In reply to this post by ElJojo
On 09/23/2012 12:42 PM, ElJojo [via jogamp] wrote:
> Hi, > I read a lot of forum (this one, JGO ...) and I cannot found clear example for > offscreen rendering. The last I tried is what Sven said : > https://github.com/demoscenepassivist/SocialCoding/blob/master/code_demos_jogamp/src/framework/base/BaseFrameBufferObjectRendererExecutor.java > Please check our (new) unit tests in regards of offscreen rendering (FBO, pbuffer, bitmap). You will find a lot in <http://jogamp.org/git/?p=jogl.git;a=tree;f=src/test/com/jogamp/opengl/test/junit/jogl/acore;hb=HEAD> with the name OffOnScreen etc, like: <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java;hb=HEAD> <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java;hb=HEAD> there are also FBO dedicated ones, you will find them .. > I choose a simple test first : I want to save a file of a resized a texture. Snapshots of resized offscreen drawables are taken in all those demos. > Here is my code : RenderEngine.java > <http://forum.jogamp.org/file/n4026246/RenderEngine.java> Dominik is the man for the above code .. haven't read his code in detail yet. However, our unit tests cover most if not all offscreen cases. ~Sven signature.asc (907 bytes) Download Attachment |
I tried to replace the pbuffer part in my constructor with :
final GLCapabilities reqGLCaps=getCaps(GLProfile.GL2); reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); final GLOffscreenAutoDrawable gl = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, project.getWidth(), project.getHeight(), null); But getCaps and GLOffscreenAutoDrawable don't exist : import javax.media.opengl.GLOffscreenAutoDrawable don't exist. I'm using Jogl2 (files dated at 07/26/12), JRE 7u7. |
Administrator
|
On 09/24/2012 09:18 AM, ElJojo [via jogamp] wrote:
> I tried to replace the pbuffer part in my constructor with : > final GLCapabilities reqGLCaps=getCaps(GLProfile.GL2); > reqGLCaps.setOnscreen(false); > reqGLCaps.setFBO(true); > final GLOffscreenAutoDrawable gl = > factory.createOffscreenAutoDrawable(null, reqGLCaps, null, project.getWidth(), > project.getHeight(), null); > > But getCaps and GLOffscreenAutoDrawable don't exist : import > javax.media.opengl.GLOffscreenAutoDrawable don't exist. > I'm using Jogl2 (files dated at 07/26/12), JRE 7u7. or better use latest source tip if possible. ~Sven signature.asc (907 bytes) Download Attachment |
I succeed to make it work using the readbuffer example
Thanks Sven. Also, I correct a stupid error : I forgot to put a gltranslate at the beginning to see the scene !?! As I read, future is FBO. My code actually work using a glwindow.setbuffer(true) ! Is there another "better" way to do a render-to-texture/file ? |
Administrator
|
On 09/28/2012 10:19 AM, ElJojo [via jogamp] wrote:
> I succeed to make it work using the readbuffer example > <http://jogamp.org/git/?p=jogl-demos.git;a=tree;f=src/demos/readbuffer;hb=9c637746e8061781d6002bb279193619857cda85> > Thanks Sven. > > Also, I correct a stupid error : I forgot to put a gltranslate at the > beginning to see the scene !?! > > As I read, future is FBO. My code actually work using a > glwindow.setbuffer(true) ! > Is there another "better" way to do a render-to-texture/file ? Using glReadPixels as shown in the unit tests works for all platforms, however .. you may optimize it via PBO and using double buffering (at least). I.e. if you want to stream some rendering to file, I would use 2-3 FBOs w/ PBO (dma transfer) if available. This has been discussed here for a while .. ~Sven signature.asc (907 bytes) Download Attachment |
In reply to this post by ElJojo
Hi ElJojo! I'm trying to resolve the same issue you had, I tried running your file but I do not know the parameters you pass to you program, Can you please illustrate how your program can be run (i.e. the parameters to pass to your program?
|
Free forum by Nabble | Edit this page |