Multisampling bug since rev. 8025

Hey guys,



i saw that you’ve implemented PBuffers since revision 8025. If i run the application with AA set, the application doesn’t work anymore:



[java]SEVERE: Failed to initialize OpenGL context

org.lwjgl.LWJGLException: Failed to find ARB pixel format 1 0



at org.lwjgl.opengl.WindowsPbufferPeerInfo.nCreate(Native Method)

at org.lwjgl.opengl.WindowsPbufferPeerInfo.<init>(WindowsPbufferPeerInfo.java:47)

at org.lwjgl.opengl.WindowsDisplay.createPbuffer(WindowsDisplay.java:619)

at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234)

at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:219)

at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190)

at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:166)

at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:272)

at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:339)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:108)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)

at java.lang.Thread.run(Thread.java:662)

SEVERE: Failed to create display

java.lang.NullPointerException

at org.lwjgl.opengl.GL11.glGetString(GL11.java:1901)

at com.jme3.system.lwjgl.LwjglContext.printContextInitInfo(LwjglContext.java:84)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:109)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)

at java.lang.Thread.run(Thread.java:662)

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]

java.lang.IllegalStateException

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:142)

at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:199)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:218)

at java.lang.Thread.run(Thread.java:662)

[/java]



If i remove the line at which the sampling is set it works:



[java]public final AppSettings getSettings() {

AppSettings settings = new AppSettings(true);

// settings.setSamples(APPLICATION_ANTI_ALIASING);

settings.setFrameRate(FRAME_RATE);

settings.setVSync(V_SYNC);

settings.setUseJoysticks(true);

return settings;

}[/java]



Any ideas?



Regards

Moe

mhh strange, i have no problem with AA… how much is “APPLICATION_ANTI_ALIASING”?



On a side note, consider using the recently added FXAAFilter, it gives fine AA at low performance cost.

If i remember well you’re using the WaterFilter so using FXAA instead of hardware AA in your case should drastically increase performances.

Hi @nehon,



i tested it with 4x, 6x and 8x AA. Nothing works but the tests :frowning:



Yeah, you have a good memory :wink: I use all filters which are available using that simple dialog:





Ok, thanks for directing to the FXAAFilter. I didn’t noticed it before. I played a little bit with the parameters but i think it’s not comparable with hardware AA, unfortunately :frowning: If you are using texture maps and so on, the FXAAFilter is a great idea, but if you take simple lighting color materials there is a great difference between SW AA and HW AA.



PS.: In the FXAAFilter in the method getSubPixelShif() a ‘T’ is missing :wink:

Sorry for the double post but i isolated the problem a bit.

You can simply reproduce it using the TestCanvas. Navigate to method createCanvas(String appClass) and insert the following line after the settings were created:

[java]

AppSettings settings = new AppSettings(true);

settings.setWidth( Math.max(640, frame.getContentPane().getWidth()) );

settings.setHeight( Math.max(480, frame.getContentPane().getHeight()) );

settings.setSamples(4); // that line will crash the application

[/java]



Since i’m using jme3 in a canvas environment i always had problems with AA. Sometimes it works and sometimes not. In addition some filters don’t work with AA in the canvas (DepthOfField, Posterization).

oOMoeOo said:
PS.: In the FXAAFilter in the method getSubPixelShif() a 'T' is missing ;)

erf my bad i'll fix it

For DepthOfField and Posterization it makes sense they have no "multisample version". I guess it's another addition to my todo :p
Not sure i can resolve your issue, but I'll discuss it with Kirill.

@nehon: Are there any news about that “canvas multisampling bug”?

I’m afraid i need Kirill’s insight on this and he’s on holidays until September 1st.

Did it start happening only with the pbuffer? Does canvas with multisampling still work? It seems like the driver might not support multisampling on a 1x1 pbuffer even though it should …

Hey, hope your holidays were good :wink: Thank you for the fast reply.



It seems that it has something to do with the pBuffer stuff. We’re working with jme rev. 7970. In that revision anti aliasing works without problems.

Okay try now (some fix is in SVN). It might work for you but break for others, I hope it won’t though

Yeah, you definitly made my day :slight_smile: Thanks for fixing that.

AA works without errors. Now i just need a multisample version of the DepthInFieldFilter and then i’m completely happy :wink:



Regards

Moe

I’m sorry to say that but there seems to be a new problem.

If i close my frame containing the LWJGLCanvas i get the following exception:



[java]

java.lang.NullPointerException

at org.lwjgl.opengl.GL15.glDeleteBuffers(GL15.java:89)

at com.jme3.renderer.lwjgl.LwjglRenderer.deleteBuffer(LwjglRenderer.java:2078)

at com.jme3.scene.VertexBuffer.deleteObject(VertexBuffer.java:857)

at com.jme3.renderer.GLObjectManager.deleteUnused(GLObjectManager.java:100)

at com.jme3.renderer.lwjgl.LwjglRenderer.onFrame(LwjglRenderer.java:774)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:185)

at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:204)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)

at java.lang.Thread.run(Thread.java:662)

[/java]



It only occurs if water is enabled. Don’t now if there is a causality. After i got the exception i checked the TestCanvas and found that after exiting using X.



[java]

INFO GLCanvas 09:41:12 EDT: Notifying OGL that canvas is about to become invisible…

INFO LwjglCanvas 09:41:12 OGL: Received destroy request! Complying…

INFO LwjglCanvas 09:41:12 OGL: Canvas will become invisible! Destroying …

INFO GLCanvas 09:41:12 EDT: Acknowledged receipt of canvas death

SCHWERWIEGEND Application 09:41:12 Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,main]

java.lang.NullPointerException

at org.lwjgl.opengl.EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.java:198)

at com.jme3.renderer.lwjgl.LwjglRenderer.setFrameBuffer(LwjglRenderer.java:1490)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1103)

at com.jme3.water.WaterFilter.preFrame(WaterFilter.java:195)

at com.jme3.post.FilterPostProcessor.preFrame(FilterPostProcessor.java:328)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1099)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1167)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:263)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)

at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:204)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)

at java.lang.Thread.run(Thread.java:662)

[/java]