Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  lwjgl 2.8.3 and kwin (also compix) fullscreen  (Read 409 times)
0 Members and 2 Guests are viewing this topic.
Offline lesto

JGO n00b
*

Posts: 26



« on: 2012-01-31 19:08:59 »

Hi
I can't understand why if i set Display.setFullscreen to true, it doesn't go fullscreen but it's like a big window (with button, border, title bar)

lwjgl say that this as been fixe3c since lwjgl 2.5.... maybe I have to use other class instead of Display?

here the initialization code of the Display:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
public void setDisplayMode(int width, int height, boolean fullscreen) {
      System.out.println("DisplayMode: " + Display.getDisplayMode());
      /*
       * // return if requested DisplayMode is already set if
       * ((Display.getDisplayMode().getWidth() == width) &&
       * (Display.getDisplayMode().getHeight() == height) &&
       * (Display.isFullscreen() == fullscreen)) { return; }
       */


      try {
         DisplayMode targetDisplayMode = null;

         if (fullscreen) {
            DisplayMode[] modes = Display.getAvailableDisplayModes();
            int freq = 0;

            for (int i = 0; i < modes.length; i++) {
               DisplayMode current = modes[i];

               if ((current.getWidth() == width)
                     && (current.getHeight() == height)) {
                  if ((targetDisplayMode == null)
                        || (current.getFrequency() >= freq)) {
                     if ((targetDisplayMode == null)
                           || (current.getBitsPerPixel() > targetDisplayMode
                                 .getBitsPerPixel())) {
                        targetDisplayMode = current;
                        freq = targetDisplayMode.getFrequency();
                     }
                  }

                  // if we've found a match for bpp and frequence against
                 // the
                 // original display mode then it's probably best to go
                 // for this one
                 // since it's most likely compatible with the monitor
                 if ((current.getBitsPerPixel() == Display
                        .getDesktopDisplayMode().getBitsPerPixel())
                        && (current.getFrequency() == Display
                              .getDesktopDisplayMode().getFrequency())) {
                     targetDisplayMode = current;
                     break;
                  }
               }
            }
         } else {
            targetDisplayMode = new DisplayMode(width, height);
         }

         if (targetDisplayMode == null) {
            System.out.println("Failed to find value mode: " + width + "x"
                  + height + " fs=" + fullscreen);
            return;
         }

         Display.setDisplayMode(targetDisplayMode);
         Display.setFullscreen(fullscreen);

      } catch (LWJGLException e) {
         System.out.println("Unable to setup mode " + width + "x" + height
               + " fullscreen=" + fullscreen + e);
      }
   }
Online ra4king

JGO Kernel
*****

Posts: 3158
Medals: 196


I'm the King!


« Reply #1 on: 2012-01-31 20:38:28 »

How about:
1  
2  
Display.setDisplayMode(Display.getDesktopDisplayMode());
Display.setFullScreen(true);

Offline lesto

JGO n00b
*

Posts: 26



« Reply #2 on: 2012-02-01 14:23:01 »

not enought  Grin

edit: worked out not all resolution support fullscreen, you have to check
Games published by our own members! Go get 'em!
Offline jojoh

JGO Ninja
***

Posts: 554
Medals: 6


games4j.com


« Reply #3 on: 2012-02-02 07:36:50 »

I have experienced a similar thing since 2.8.2, using libgdx and on win7. Used to work pre 2.8.2, but I wasn't sure if it was related to libgdx or lwjgl. Seems like lwjgl is the common denominator here.

I am guessing that I am using what ra4king is suggesting, only with libgdx syntax:

1  
2  
3  
4  
5  
         LwjglApplicationConfiguration lwjglAppCfg = new LwjglApplicationConfiguration();
         DisplayMode dispMode = LwjglApplicationConfiguration.getDesktopDisplayMode();
         lwjglAppCfg.setFromDisplayMode(dispMode);
         lwjglAppCfg.fullscreen = true;
         new LwjglApplication(new MyGame(), lwjglAppCfg);


It really should work with the native resolution. Anything else would be really annoying.

Works fine on OS X though. Could have something to do with screen res are different.

Offline lesto

JGO n00b
*

Posts: 26



« Reply #4 on: 2012-02-07 18:10:31 »

also seems that sync() in compix give some problem, so my friend used sleep(), maybe is not so accurate, but it's good enough
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.101 seconds with 19 queries.