Author Topic: GraphicsEnvironment.getLocalGraphicsEnvironment().get.isDisplayChangeSupported()  (Read 3829 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
I'm printing out FrameBuffer's list of compatible video modes, and using one of them. But the test device.isDisplayChangeSupported() comes back false every time. I'm confused, because display changes are supported (just about every game makes them).

Code: [Select]
      VideoMode[] videoModes = FrameBuffer.getVideoModes(IRenderer.RENDERER_OPENGL);
for (int i = 0; i < videoModes.length; i++)
System.out.println(videoModes[i]);
      buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
      if (engineData.fullScreen) {
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
System.out.println("Width: "+engineData.width +" Height: "+engineData.height);//COMPATIBLE VALUES
if (!device.isDisplayChangeSupported()) {
     System.err.println("No support for current mode!");return;}//RETURNS EVERY TIME
this.setUndecorated(true);
this.setIgnoreRepaint(true);
device.setFullScreenWindow(this);
device.setDisplayMode(new java.awt.DisplayMode(engineData.width, engineData.height, 32, java.awt.DisplayMode.REFRESH_RATE_UNKNOWN));
      }
« Last Edit: January 11, 2012, 07:51:36 pm by AGP »

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Update: switching the order to
Code: [Select]
      if (engineData.fullScreen) {
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
this.setUndecorated(true);
this.setIgnoreRepaint(true);
device.setFullScreenWindow(this);
if (!device.isDisplayChangeSupported()){
     System.err.println("No support for current mode!");return;}
device.setDisplayMode(new java.awt.DisplayMode(engineData.width, engineData.height, 32, java.awt.DisplayMode.REFRESH_RATE_UNKNOWN));
      }
has worked.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
It's no longer getting stuck on that test, but it's producing a black screen with the hardware renderer. Also, BufferStrategy is being used for software full screen. Why?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Which test? I've no idea why it creates a black screen in hardware mode. Could be everything...do you have the log output avialable? BufferStrategy is usually used to get proper, double buffered fullscreen support.

BTW: The list that FrameBuffer returns is based on what the OpenGL driver reports. It has nothing to do with Java2D.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
I've never used BufferStrategy. I double-buffer manually for 2d, but never double-buffered at all in 3d. What's the benefit (the screen already doesn't flicker)?

It's not black in hardware windowed, just hardware full screen. It doesn't complain (no log output) and runs as if all is well (I know I can play it by its sounds). The display is done by calling buffer.displayGLOnly() and awtCanvas.repaint();

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
So you are using the hardware renderer in form of an AWTGLRenderer? Not the "native" one?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Yes. Originally the game was going to be windowed-only. Why?

And what's the benefit of double-buffering in 3D if the screen already doesn't flicker?
« Last Edit: January 11, 2012, 09:56:39 pm by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
There's no benefit. Maybe it's not needed...i don't really know. I can't remember if i've seen the AWTGLRenderer working in a fullscreen AWT frame...maybe that's a combination that just doesn't work. But that's an LWJGL/AWT issue, not a jPCT one, so i really can't comment much on it. If possible, i would go for the native GL renderer all the time.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
But AWT is so much nicer. Plus, I always use the software renderer as an alternative to the hardware one.

Should I post on the lwjgl boards? Would you (I think they'd take you more seriously)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
They don't even take the AWT support of LWJGL serious. They already wanted to remove it and just stopped because some people (including me) interfered because it's the only may to make LWJGL render into different frames at a time.
I'll try to create myself a test case to see what actually happens if you combine these two things...

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Thanks a lot. Please let me know.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
So...the render thread (which is the AWT event dispatch thread in this case) actually runs and the paint-method gets called. You just can't see any output and i'm not sure if it's even possible to achieve this in fullscreen mode. You might want to ask in the LWJGL forum if this is even possible, but i doubt that anybody can/will tell this.
   
What's the point in using AWT for this anyway? In which way is it nicer?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
For one thing, it's nice to have the same frame (and code) for both the hardware and the software renderers. That's why they created the AWTGLCanvas (and why you created your KeyMapper) in the first place, after all. And as a habit, maybe it's a bad habit, I don't know, my main classes usually extend AWT frames, rather than instantiate them.