when the my game initializes i set fullscreen mode and the resolution i want. this works fine when i don’t enable opengl. but when i do, it won’t permit any change of resolution (even if i try to set the resolution to the current resolution, it tells me that that display mode isn’t available). i change resolution like so:
public void SetResolution(int PWidth,int PHeight,int PDepth)
{
if (!gd.isDisplayChangeSupported())
{
System.out.println(“Display mode changing not supported”);
return;
}
boolean available=false;
DisplayMode[] modes = gd.getDisplayModes(); // modes list
for(int i = 0; i < modes.length; i++) {
if ( width == modes[i].getWidth() &&
height == modes[i].getHeight() &&
bitDepth == modes[i].getBitDepth() )
{
available=true;
}
}
if (!available) {
System.out.println(“Display mode (” + PWidth + “,” +
PHeight + “,” + PDepth + “) not available”);
return;
}
DisplayMode dm = new DisplayMode(PWidth, PHeight, PDepth,
DisplayMode.REFRESH_RATE_UNKNOWN); // any refresh rate
try {
gd.setDisplayMode(dm);
System.out.println(“Display mode set to: (” +
PWidth + “,” +
PHeight + “,” + PDepth + “)”);
}
catch (IllegalArgumentException e)
{ System.out.println(“Error setting Display mode (” +
PWidth + “,” +
PHeight + “,” + PDepth + “)”+e.toString()); }
}