- Added an AppSetting param for gamma correction, defaulted to true.

- Added a filed in the Setting dialog to toggle gamma correction on and off
experimental
Nehon 11 years ago
parent 0967f39b83
commit a23038430c
  1. 16
      jme3-core/src/main/java/com/jme3/system/AppSettings.java
  2. 23
      jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java
  3. 1
      jme3-desktop/src/main/resources/com/jme3/app/SettingsDialog.properties

@ -143,6 +143,7 @@ public final class AppSettings extends HashMap<String, Object> {
defaults.put("SettingsDialogImage", "/com/jme3/app/Monkey.png");
defaults.put("MinHeight", 0);
defaults.put("MinWidth", 0);
defaults.put("GammaCorrection", true);
// defaults.put("Icons", null);
}
@ -745,6 +746,17 @@ public final class AppSettings extends HashMap<String, Object> {
public void setSettingsDialogImage(String path) {
putString("SettingsDialogImage", path);
}
/**
* Enables Gamma Correction
* This requires that the GPU supports GL_ARB_framebuffer_sRGB and will
* disabled otherwise.
* @param gammaCorrection
* (Default : true)
*/
public void setGammaCorrection(boolean gammaCorrection) {
putBoolean("GammaCorrection", gammaCorrection);
}
/**
* Get the framerate.
@ -914,4 +926,8 @@ public final class AppSettings extends HashMap<String, Object> {
public String getSettingsDialogImage() {
return getString("SettingsDialogImage");
}
public boolean getGammaCorrection() {
return getBoolean("GammaCorrection");
}
}

@ -90,6 +90,7 @@ public final class SettingsDialog extends JFrame {
// UI components
private JCheckBox vsyncBox = null;
private JCheckBox gammaBox = null;
private JCheckBox fullscreenBox = null;
private JComboBox displayResCombo = null;
private JComboBox colorDepthCombo = null;
@ -355,7 +356,10 @@ public final class SettingsDialog extends JFrame {
});
vsyncBox = new JCheckBox(resourceBundle.getString("checkbox.vsync"));
vsyncBox.setSelected(source.isVSync());
gammaBox = new JCheckBox(resourceBundle.getString("checkbox.gamma"));
gammaBox.setSelected(source.getGammaCorrection());
gbc = new GridBagConstraints();
gbc.weightx = 0.5;
gbc.gridx = 0;
@ -365,12 +369,19 @@ public final class SettingsDialog extends JFrame {
mainPanel.add(fullscreenBox, gbc);
gbc = new GridBagConstraints();
gbc.weightx = 0.5;
gbc.insets = new Insets(4, 16, 0, 4);
// gbc.insets = new Insets(4, 16, 0, 4);
gbc.gridx = 2;
gbc.gridwidth = 2;
// gbc.gridwidth = 2;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.anchor = GridBagConstraints.EAST;
mainPanel.add(vsyncBox, gbc);
gbc = new GridBagConstraints();
gbc.weightx = 0.5;
gbc.gridx = 3;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
mainPanel.add(gammaBox, gbc);
gbc = new GridBagConstraints();
gbc.insets = new Insets(4, 4, 4, 4);
@ -420,7 +431,7 @@ public final class SettingsDialog extends JFrame {
gbc.gridy = 3;
gbc.anchor = GridBagConstraints.WEST;
mainPanel.add(antialiasCombo, gbc);
// Set the button action listeners. Cancel disposes without saving, OK
// saves.
ok.addActionListener(new ActionListener() {
@ -517,6 +528,7 @@ public final class SettingsDialog extends JFrame {
String display = (String) displayResCombo.getSelectedItem();
boolean fullscreen = fullscreenBox.isSelected();
boolean vsync = vsyncBox.isSelected();
boolean gamma = gammaBox.isSelected();
int width = Integer.parseInt(display.substring(0, display.indexOf(" x ")));
display = display.substring(display.indexOf(" x ") + 3);
@ -576,6 +588,7 @@ public final class SettingsDialog extends JFrame {
source.setFrequency(freq);
source.setFullscreen(fullscreen);
source.setVSync(vsync);
source.setGammaCorrection(gamma);
//source.setRenderer(renderer);
source.setSamples(multisample);

@ -5,6 +5,7 @@ button.cancel=Cancel
checkbox.fullscreen=Fullscreen?
checkbox.vsync=Vsync?
checkbox.gamma=Gamma correction
label.resolutions=Screen Resolution
label.colordepth=Color Depth

Loading…
Cancel
Save