proposal com.jme.renderer.lwjgl.LWJGLRenderer split displayBackBuffer()

Hello All,



Don't know if this is the correct way to submit a  proposal for code change. If this

is not the correct way, please let me know,



Thanks, the shoe



I am working embedding jme in swt, using the swtlwjgl bindings.

All the functionality of LWJGLRenderer is the same except the buffer swap.


The DisplayBackBuffer currently has 2 responsiblities

    1) renders items in the queue
    2) swap buffer

I would like to propose that we split these responsibilites between 2 functions.
I do this in a local copy, and it allows me to over ride the new function.

Note: this is the only function that I need to override for a SwtLWJGLRenderer



current function
    /**
    * <code>displayBackBuffer</code> renders any queued items then flips the
    * rendered buffer (back) with the currently displayed buffer.
    *
    * @see com.jme.renderer.Renderer#displayBackBuffer()
    */
    public void displayBackBuffer() {
        renderQueue();

        prevColor = prevNorms = prevVerts = null;
        Arrays.fill(prevTex, null);

        GL11.glFlush();
        if (!headless)
            Display.update();
    }

  Proposed Split functionality


    /**
    * <code>displayBackBuffer</code> renders any queued items then flips the
    * rendered buffer (back) with the currently displayed buffer.
    *
    * @see com.jme.renderer.Renderer#displayBackBuffer()
    */
    public void displayBackBuffer() {
        renderQueue();

        prevColor = prevNorms = prevVerts = null;
        Arrays.fill(prevTex, null);

     

        GL11.glFlush();
        if (!headless){
              swapBackBuffer();
        }
    }

    public void swapBackBuffer(){
        Display.update() ;
    }

That sounds more than reasonable. Feel free to make the needed changes in your local copy, they can go in with the rest of your work (assuming you plan to release that). Which bindings are you using for your work?

llama said:

That sounds more than reasonable. Feel free to make the needed changes in your local copy, they can go in with the rest of your work (assuming you plan to release that). Which bindings are you using for your work?



Thank you very much, I will proceed with the local changes. I am using the binding from
reality interactive.

http://www.realityinteractive.com/software/oss/index.html#SWTOGL

It is a proof of concept now.  We should be able to contribute the bindings if we can get clean packaging.

Thanks again,
the shoe

MonkeyWorld3D also uses this. http://www.jmonkeyengine.com/jmeforum/index.php?topic=1985.0

They're also about to release their code. Dunno how they've done it, but I'd like to see a soltution like com.jme.util.awt included in jME for SWT.



The problem is dependencies. The reality interactive stuff isn't included in jME or LWJGL (as far as I know). It also doesn't work for the Mac as far as I know, though for me that's not an issue :slight_smile: Maybe we should think about including it.

llama said:

MonkeyWorld3D also uses this. http://www.jmonkeyengine.com/jmeforum/index.php?topic=1985.0
They're also about to release their code. Dunno how they've done it, but I'd like to see a soltution like com.jme.util.awt included in jME for SWT.

The problem is dependencies. The reality interactive stuff isn't included in jME or LWJGL (as far as I know). It also doesn't work for the Mac as far as I know, though for me that's not an issue :) Maybe we should think about including it.


I was thinking along similar lines.  I am treating it as an external package, similar to physics.  If someone needs it, they could download the extra package.  I would not propose including it the base release.

It is nice to have base LWJGL,  awt, and swt using the same code base.  It should improve the dependency/responsiblity model of JME. 

The design/implementation of JME is pretty clean, and this has made this effort relatively painless.  Thanks
for all the great work on JME.

llama said:

MonkeyWorld3D also uses this. http://www.jmonkeyengine.com/jmeforum/index.php?topic=1985.0
They're also about to release their code. Dunno how they've done it, but I'd like to see a soltution like com.jme.util.awt included in jME for SWT.

The problem is dependencies. The reality interactive stuff isn't included in jME or LWJGL (as far as I know). It also doesn't work for the Mac as far as I know, though for me that's not an issue :) Maybe we should think about including it.


I forgot to thank you for the link to the message thread.  I look forward to the release of their code.  This could save us some work.
llama said:

MonkeyWorld3D also uses this. http://www.jmonkeyengine.com/jmeforum/index.php?topic=1985.0
They're also about to release their code. Dunno how they've done it, but I'd like to see a soltution like com.jme.util.awt included in jME for SWT.

... deleted text


I looked at their code and they take a similar approach with Renderer, so they will also be able to benifit from this change.  I will modify their renderer and offer it to them.

Thank you very much

I put this into the base line and it's in CVS now.