Force no anti-aliasing setting?

Hey all,



I’m getting lots of reports from people getting crashes when setting anti-aliasing in the “graphics settings” window. Can I somehow disable that option from being changed, or at least immediately set it back to default if it is changed? Do I just do an AppSettings.setSamples(1); / .setSettings(…) on the start of simpleInitApp()?



Thanks!

Yup, that is exactly the process for hardcoding it.

@sbook said:
Yup, that is exactly the process for hardcoding it.


Will that overwrite any other settings, or does it pull current settings when I create a new AppSettings object?

EDIT: Ahh, just got to use AppSettings(false) -- thanks!

“AppSettings.setSamples(1);” is going to force 1 sampling. Instead, I think you can “Collection caps = renderer.getCaps();” to find out graphics card capabilities and then if any features (e.g. anti-aliasing) are not supported you can “AppSettings.setRenderer(AppSettings.LWJGL_OPENGL1);” to force them to be disabled.

1 Like

Creating a new AppSettings object sets things to the default indicated in the documentation… Btw, turning off AA would be setting it to 0 rather than 1

@sbook said:
Creating a new AppSettings object sets things to the default indicated in the documentation.. Btw, turning off AA would be setting it to 0 rather than 1


The default value says it is 1, so I assume that is what it should be set at?

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:appsettings

Hrm… this doesn’t appear to be working quick enough:



[java] @Override

public void simpleInitApp() {

AppSettings setSamps = new AppSettings(false);

setSamps.setSamples(1); // i’ve also tried 0 here

myApp.setSettings(setSamps);[/java]



… if I set samples to 2x (or more) with the GUI configuration thing, the game crashes with this error:



[java]Jan 12, 2012 10:01:03 AM com.jme3.system.lwjgl.LwjglDisplay createContext

INFO: Selected display mode: 800 x 600 x 0 @0Hz

Jan 12, 2012 10:01:04 AM com.jme3.app.Application handleError

SEVERE: Failed to create display

org.lwjgl.LWJGLException: Could not choose GLX13 config

at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method)

at org.lwjgl.opengl.LinuxDisplayPeerInfo.<init>(LinuxDisplayPeerInfo.java:61)

at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:782)

at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)

at org.lwjgl.opengl.Display.create(Display.java:871)

at org.lwjgl.opengl.Display.create(Display.java:782)

at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:140)

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

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

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

Jan 12, 2012 10:01:04 AM com.jme3.app.Application handleError

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

java.lang.IllegalStateException

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

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

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

at java.lang.Thread.run(Thread.java:679)[/java]

Hmm, which drivers are you using?

Nvidia NVS 4200M, latest NVIDIA Linux64 drivers, me thinks… lots of other people have this problem too, unfortunately :frowning: I really just want to force that setting to default, but I want all the other options to be changeable.

It’s entirely possible that the driver isn’t playing nice… Do you have a Windows or OS X partition you can test on? @Momoko_Fan?

I found a solution! Instead of calling myApp.start(); (myApp is a SimpleApplication), I do this:



[java] // show settings dialog

if (Main.myApp.isShowSettings()) {

if (!JmeSystem.showSettingsDialog(Main.myForm.loadedSettings, false)) {

return;

}

}

//re-setting settings they can have been merged from the registry.

Main.myForm.loadedSettings.setSamples(1);

Main.myApp.setSettings(Main.myForm.loadedSettings);

((Application)Main.myApp).start(JmeContext.Type.Display);[/java]



Basically, immediately after the settings dialog is shown, I set “setSamples” to 1, and then start the game. Works like a charm!



EDIT: Sidenote for those trying the above – I make sure Main.myForm.loadedSettings already has defaults loaded into it, just incase they decide to skip showing the settings.

You need to set the appsettings before you call start on the app object, that should fix the issue

@phr00t you are now setting samples to 1 no matter of the graphicscard capability.
You might want to use
Collection caps = renderer.getCaps();
to check for multisampling capabilities and then give those with a good graphicscard multisampling and those with a slow one no multisampling …

@emtonsit said: @phr00t you are now setting samples to 1 no matter of the graphicscard capability. You might want to use Collection caps = renderer.getCaps(); to check for multisampling capabilities and then give those with a good graphicscard multisampling and those with a slow one no multisampling ..

Is there a reason you are responding to a 2.5 year old post? Just wondering how it came up.

@pspeed just had the same Problem and was wondering if i could help anyone :stuck_out_tongue_winking_eye: -
didnt look at the dates