Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  need LWJGL/JOGL/WinApi guru's help: Display.update() (nSwapBuffers) slows down  (Read 2304 times)
0 Members and 1 Guest are viewing this topic.
Offline deliriumtrip

Junior Newbie





« Posted 2011-09-09 09:20:56 »

The problem:
LWJGL's Display.update() (specifically nSwapBuffers) for simplest possible program periodically (every ~5sec) executes ~320  times  slower than usual even with no rendering at all.
It creates visible gitter effect every 5 sec. while  sprite/shape moving.
 I also tried almost similar code with JOGL (through libgdx) and got the same results except FPS, which was almost twice lower (not sure why, I did not investigate)
And no matter which library I use on top of LWJGL/JOGL (slick 2d or libgdx) the same problem exists.


Test Environment:
Java6, Win 7 x64 Ultimate, ICore7-2600, NVidia 570 GTX, latest drivers (280.26 ).


Here is the sample simplified program that produces the effect:
(The render and update methods are left for visualization and could be removed- they do not have any effect on anything.)
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  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.input.Keyboard;

public class SimplifiedGameLoop
{
    static float x;
    static float velocity = 0.3f;
    static long deltaPreviousJump = Sys.getTime();
    static int deltaIterationsJump;

    public static void main(String args[]) throws LWJGLException
    {
        SimplifiedGameLoop.run();
    }
    private static void init() throws LWJGLException
    {
        Display.setDisplayMode(new DisplayMode(800, 600));
//        Display.setVSyncEnabled(true);
       Display.create();
        glOrtho(0.0, Display.getDisplayMode().getWidth(), 0.0, Display.getDisplayMode().getHeight(), -1.0, 1.0);
    }
    public static void run() throws LWJGLException
    {
        init();
        long delta = 0;
        while (true)
        {
            // measure start time
           long start = Sys.getTime();

            Display.processMessages();

            // loop
           if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
            {
                break;
            }
            update(delta);
            render();
            Display.update(false);

            // measure end time and check for delta jump
           delta = Sys.getTime() - start;
            deltaIterationsJump++;
            if (delta > 20)
            {
                long now = Sys.getTime();
                System.out.println(Sys.getTime() +":"+
                        " Delta jumped! delta=" + delta +
                        //" LWJGLDelta=" + Display.getDelta() +
                       " interval=" + (now - deltaPreviousJump) +
                        " iterations=" +deltaIterationsJump);
                deltaPreviousJump = now;
                deltaIterationsJump = 0;
            }
        }
        Display.destroy();
    }
    private static void update(float delta)
    {
        x += velocity * delta;
        if (x > 700 || x < 0)
        {
            velocity = -velocity;
            if (x > 700)
            {
                x = 700;
            }
            else
            {
                x = 0;
            }
        }
    }
    private static void render()
    {
        glClear(GL_COLOR_BUFFER_BIT);
        glBegin(GL_QUADS);
        glVertex2i((int) x, 10);
        glVertex2i((int) x + 100, 10);
        glVertex2i((int) x + 100, 100);
        glVertex2i((int) x, 100);
        glEnd();
    }
}


Running the above program gives me a following log. (delta= appr. time in millis the last Display.update took (usually it takes ~0.09),  interval= effect period, iterations= the number of "usual" quick time game loop iterations between effect takes place)
Quote
95603743: Delta jumped! delta=36 LWJGLDelta=0 interval=330 iterations=668
95604632: Delta jumped! delta=29 LWJGLDelta=0 interval=889 iterations=9341
95605426: Delta jumped! delta=32 LWJGLDelta=0 interval=794 iterations=8271
95610475: Delta jumped! delta=29 LWJGLDelta=0 interval=5049 iterations=55527
95615524: Delta jumped! delta=28 LWJGLDelta=0 interval=5049 iterations=55557
95620574: Delta jumped! delta=29 LWJGLDelta=0 interval=5050 iterations=55554
95625624: Delta jumped! delta=29 LWJGLDelta=0 interval=5050 iterations=55549
95630674: Delta jumped! delta=28 LWJGLDelta=0 interval=5050 iterations=55288
.....

Background:
I searched several similar threads, but none of them seems to give me a reason or working solution
http://lwjgl.org/forum/topics/jogl-performance/3956/view.html
http://lwjgl.org/forum/topics/wait-for-vsync/3359/view.html
http://lwjgl.org/forum/topics/opinions-on-enhancement/3563/view.html

What I have discovered so far:
1) If I comment out Display.processMessages() (essentually nUpdate() call), the jitters dissapear.
2) Shortly before a jitter, WinApi sends a message with type 13 (WM_GETTEXT - http://msdn.microsoft.com/en-us/library/ms632627%28v=vs.85%29.aspx). And after some 22-24 iterations and apprx. 2 millis. the jitter occurs. I have added a log in WindowsDisplay to trace these calls and here is a log
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
95490352: WM_GETTEXT 13,wParam=520,lParam=37540896,millis=0 result=0
95490357: WM_GETTEXT 13,wParam=520,lParam=37540896,millis=0 result=0
95490357: WM_GETTEXT 13,wParam=520,lParam=37543344,millis=0 result=0
95494071: WM_GETTEXT 13,wParam=520,lParam=37542880,millis=95490676 result=4
95494101: Delta jumped! delta=27 LWJGLDelta=0 interval=3834 iterations=37939
95499123: WM_GETTEXT 13,wParam=520,lParam=37542880,millis=95490676 result=4
95499168: Delta jumped! delta=43 LWJGLDelta=0 interval=5067 iterations=54262
95504196: WM_GETTEXT 13,wParam=520,lParam=37542880,millis=95490676 result=4
95504232: Delta jumped! delta=34 LWJGLDelta=0 interval=5064 iterations=54291
95509255: WM_GETTEXT 13,wParam=520,lParam=37542880,millis=95490676 result=4
95509299: Delta jumped! delta=41 LWJGLDelta=0 interval=5067 iterations=54318
95514319: WM_GETTEXT 13,wParam=520,lParam=37542880,millis=95490676 result=4
95514349: Delta jumped! delta=28 LWJGLDelta=0 interval=5050 iterations=54316

3) Interesting part about latter log, is that it seems the same message delivered over and over again (millis parameter (message creation time since last reboot) is the same). However if I move the mouse over the screen it creates another message and starts to deliver it again in the same manner (every 5 sec.)

I dont know maybe it's some stupid question but I can not fugure out what the problem is...
Any guess would be greatly appreciated..
Offline Spasi
« Reply #1 - Posted 2011-09-09 10:13:55 »

Using your test, I don't see this issue on my setup (Win7 x64, Q6600, Radeon 5870).

It would be interesting to see what that WM_GETTEXT message returns exactly. On my setup, it pops 7 times at startup then I don't see it anymore. Could you please add the following code in org.lwjgl.opengl.WindowsDisplay and report the results?

Anywhere in WindowsDisplay:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
private static final Unsafe unsafe = getUnsafeInstance();

private static Unsafe getUnsafeInstance() {
   final Field[] fields = Unsafe.class.getDeclaredFields();

   for ( Field field : fields ) {
      if ( !field.getType().equals(Unsafe.class) )
         continue;

      final int modifiers = field.getModifiers();
      if ( !(Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) )
         continue;

      field.setAccessible(true);
      try {
         return (Unsafe)field.get(null);
      } catch (IllegalAccessException e) {
         // ignore
     }
      break;
   }

   throw new UnsupportedOperationException();
}


Inside the switch statement of the doHandleMessage method:

1  
2  
3  
4  
5  
6  
7  
8  
case 0x000D: // WM_GETTEXT
  int len = (int)wParam - 1;
   final StringBuilder text = new StringBuilder(len);
   for ( int i = 0; i < len; i++ ) {
      text.append(unsafe.getByte(lParam + i));
   }
   System.out.println("WM_GETTEXT = " + text);
   return defWindowProc(hwnd, msg, wParam, lParam);
Offline deliriumtrip

Junior Newbie





« Reply #2 - Posted 2011-09-09 11:12:17 »

Spasi, thanks a lot for your reply..
Here is the results (with space prepended between bytes- text.append(unsafe.getByte(lParam + i)).append(" "); )
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
WM_GETTEXT = -80 -107 42 0 0 0 0 0 -120 -112 42 0 0 0 0 0 48 -108 42 0 0 0 0 0 -112 -114 42 0 0 0 0 0 80 -104 52 0 0 0 0 0 -128 -112 42 0 0 0 0 0 16 84 -119 119 0 0 0 0 0 0 0 0 0 0 0 0 80 0 0 0 0 0 0 0 0 0 42 0 0 0 0 0 64 0 0 0 0 0 0 0 64 0 0 0 0 0 0 0 -56 2 42 0 0 0 0 0 -114 89 125 119 0 0 0 0 0 0 0 0 0 0 0 0 64 0 0 0 0 0 0 0 0 0 -1 -1 7 0 0 0 -128 -110 42 0 0 0 0 0 16 75 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -14 -76 -93 -3 -2 7 0 0 0 0 0 0 0 0 0 0 16 75 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 80 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 16 75 49 0 0 0 0 0 -47 -127 86 119 0 0 0 0 16 75 49 0 0 0 0 0 16 75 49 0 0 0 0 0 -40 -42 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -32 103 51 0 0 0 0 0 0 106 -48 -63 0 0 0 0 0 0 0 0 0 0 0 0 115 0 -17 -65 0 0 0 0 0 106 -48 -63 0 0 0 0 -14 -76 -93 -3 -2 7 0 0 -40 -42 85 2 0 0 0 0 0 0 0 0 0 0 0 0 0 67 52 0 0 0 0 0 1 0 0 0 0 0 0 0 32 -115 52 0 0 0 0 0 0 67 52 0 0 0 0 0 -80 -115 52 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -14 -76 -93 -3 -2 7 0 0 115 0 -17 -65 0 0 0 0 -128 -104 52 0 0 0 0 0 0 0 0 0 0 0 0 0 115 0 -17 -65 0 0 0 0 115 0 -17 -65 0 0 0 0 115 0 -17 -65 0 0 0 0 0 67 52 0 0 0 0 0 115 0 -17 -65 0 0 0 0 0 0 0 0 0 0 0 0 -14 -76 -93 -3 -2 7 0 0 2 0 0 0 0 0 0 0 80 -104 52 0 0 0 0 0 80 -104 52 0 0 0 0 0 -65 -114 -43 105 0 0 0 0 -32 103 51 0 0 0 0 
WM_GETTEXT = 0 0 0 0 0 0 0 0 -127 2 0 0 0 0 0 0 -104 -41 85 2 0 0 0 0 48 -56 93 0 0 0 0 0 0 -64 93 0 0 0 0 0 0 0 0 0 0 0 0 0 -104 -41 85 2 0 0 0 0 -121 -99 -89 109 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -64 93 0 0 0 0 0 -104 -41 85 2 0 0 0 0 -96 -6 86 2 0 0 0 0 56 -60 93 0 0 0 0 0 9 0 0 0 0 0 0 0 0 -64 93 0 0 0 0 0 0 -64 93 0 0 0 0 0 64 -30 54 6 0 0 0 0 -112 122 85 -69 0 0 0 0 0 0 0 0 0 0 0 0 -32 -29 85 2 0 0 0 0 57 19 87 2 0 0 0 0 80 -28 85 2 0 0 0 0 -104 -41 85 2 0 0 0 0 56 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 -64 93 0 0 0 0 0 -80 121 93 0 0 0 0 0 -80 -57 93 0 0 0 0 0 64 -56 93 0 0 0 0 0 -104 -53 93 0 0 0 0 0 56 -25 85 2 0 0 0 0 96 -85 102 119 0 0 0 0 126 -18 23 0 0 0 0 0 -56 -41 85 2 0 0 0 0 0 -64 93 0 0 0 0 0 -127 2 0 0 0 0 0 0 -104 -41 85 2 0 0 0 0 -48 -63 93 0 0 0 0 0 32 121 93 0 0 0 0 0 -43 -54 -52 20 0 0 0 0 -64 -104 -89 109 0 0 0 0 66 -90 -71 109 0 0 0 0 -8 -41 85 2 0 0 0 0 0 0 0 0 0 0 0 0 112 -42 85 2 0 0 0 0 10 0 0 0 72 14 2 2 48 -56 93 0 0 0 0 0 37 -98 -89 109 0 0 0 0 0 0 0 0 0 0 0 0 87 5 -101 109 0 0 0 0 0 0 0 0 0 0 0 0 29 71 87 119 0 0 0 0 0 -64 93 0 0 0 0 0 2 0 0 0 0 0 0 0 80 -108 -20 -3 -2 7 0 0 -36 13 -101 109 0 0 0 0 25 0 2 0 0 0 0 0 48 -56 93 0 0 0 0 0 32 121 93 0 0 0 0 0 -48 -63 93 0 0 0 0 0 32 121 93 0 0 0 0 0 -64 -61 93 0 0 0 0 0 48 -60 93 0 0 0 0
WM_GETTEXT = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 0 0 0 17 0 0 0 -12 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 -112 1 0 0 0 0 0 1 0 0 0 0 83 0 101 0 103 0 111 0 101 0 32 0 85 0 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19 0 0 0 19 0 0 0 -12 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 -112 1 0 0 0 0 0 1 0 0 0 0 83 0 101 0 103 0 111 0 101 0 32 0 85 0 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 -112 1 0 0 0 0 0 1 0 0 0 0 83 0 101 0 103 0 111 0 101 0 32 0 85 0 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 -112 1 0 0 0 0 0 1 0 0 0 0 83 0 101 0 103 0 111 0 101 0 32 0 85 0 73 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 81 66 -29 -5 -2 7 0 0 47 21 10 -55 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -50 69 -29 -5 -2 7 0 0 -40 -32 35 8 0 0 0 0 -88 -27 35 8 0 0 0 0 16 0 0 0 0 0 0 0 12 -31 35 8 0 0 0 0 48 2 0 0 -16 0 0 0 86 5 0 0 9 1 0 0 0 0 0 0 0 0 0 0 -122 61 -29 -5 -2 7 0 0 -64 -28 35 8 0 0 0 0 -40 -32 35 8 0 0 0 0 -96 -32 35 8 0 0 0
WM_GETTEXT = 0 0 0 0 0 0 0 0 30 111 -104 -1 -2 7 0 0 -27 29 1 38 0 0 0 0 0 0 0 0 0 0 4 0 16 -36 85 2 0 0 0 0 -80 43 -104 -1 -2 7 0 0 16 0 0 0 0 0 -13 0 -80 43 -104 -1 -2 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 -36 85 2 0 0 0 0 -80 -37 85 2 0 0 0 0 2 0 0 0 0 0 0 0 -64 -37 85 2 0 0 0 0 80 27 53 -1 -2 7 0 0 0 0 0 0 0 0 0 0 -27 29 1 38 0 0 0 0 1 0 0 0 0 0 0 0 32 0 0 0 0 0 0 0 11 0 -120 1 0 0 0 0 0 0 0 0 0 0 0 0 30 111 -104 -1 -2 7 0 0 -27 29 1 38 0 0 0 0 0 0 0 0 -2 7 0 0 -80 -36 85 2 0 0 0 0 -27 29 1 38 0 0 0 0 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 0 0 0 0 0 0 0 80 27 53 -1 -2 7 0 0 16 1 2 11 0 0 0 0 0 0 0 0 -2 7 0 0 -128 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 16 1 2 11 0 0 0 0 0 0 0 0 0 0 0 0 -128 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 -32 4 41 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 -2 7 0 0 1 0 0 0 0 0 0 0 -113 -32 -102 -1 -2 7 0 0 -27 29 1 38 0 0 0 0 80 27 53 -1 -2 7 0 0 0 12 1 94 0 0 0 0 -116 121 105 119 0 0 0 0 0 0 0 0 0 0 0 0 106 -33 -102 -1 -2 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -92 10 1 114 0 0 0 0 -32 4 41 0 0 0 0 0 -92 10 1 114 0 0 0 0 50 34 -104 -1 -2 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 30 5 102 0 0 0 0 61 42 -104 -1 -2 7 0 0 0 0 0 0 0 0 0
103481658: Delta jumped! delta=41 LWJGLDelta=0 interval=593 iterations=2837
WM_GETTEXT = 32 0 0 0 0 0 0 0 11 0 -120 1 0 0 0 0 -120 -17 85 2 0 0 0 0 -128 -17 85 2 0 0 0 0 120 -17 85 2 0 0 0 0 112 -17 85 2 0 0 0 0 88 -17 85 2 0 0 0 0 80 -17 85 2 0 0 0 0 72 -17 85 2 0 0 0 0 64 -17 85 2 0 0 0 0 56 -17 85 2 0 0 0 0 48 -17 85 2 0 0 0 0 40 -17 85 2 0 0 0 0 32 -17 85 2 0 0 0 0 24 -17 85 2 0 0 0 0 16 -17 85 2 0 0 0 0 -80 -19 85 2 0 0 0 0 -64 -19 85 2 0 0 0 0 -48 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -16 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 16 -18 85 2 0 0 0 0 32 -18 85 2 0 0 0 0 56 -16 85 2 0 0 0 0 48 -16 85 2 0 0 0 0 40 -16 85 2 0 0 0 0 32 -16 85 2 0 0 0 0 8 -16 85 2 0 0 0 0 0 -16 85 2 0 0 0 0 -8 -17 85 2 0 0 0 0 -16 -17 85 2 0 0 0 0 -24 -17 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -40 -17 85 2 0 0 0 0 -48 -17 85 2 0 0 0 0 -104 -16 85 2 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 -128 -16 85 2 0 0 0 0 104 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 88 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -40 -16 85 2 0 0 0 0 -48 -16 85 2 0 0 0 0 -56 -16 85 2 0 0 0 0 -64 -16 85 2 0 0 0 0 -88 -16 85 2 0 0 0 0 -96 -16 85 2 0 0 0 0 -104 -16 85 2 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 120 -16 85 2 0 0 0 0 112 -16 85 2 0 0 0 0 56 -15 85 2 0 0 0 0 48 -15 85 2 0 0 0 0 40 -15 85 2 0 0 0 0 32 -15 85 2 0 0 0 0 8 -15 85 2 0 0 0 0 0 -15 85 2 0 0 0 0 -8 -16 85 2 0 0 0 0 -16 -16 85 2 0 0 0 0 -24 -16 85 2 0 0 0
103486724: Delta jumped! delta=39 LWJGLDelta=0 interval=5066 iterations=53805
WM_GETTEXT = 71 97 109 101 0 0 0 0 11 0 -120 1 0 0 0 0 -120 -17 85 2 0 0 0 0 -128 -17 85 2 0 0 0 0 120 -17 85 2 0 0 0 0 112 -17 85 2 0 0 0 0 88 -17 85 2 0 0 0 0 80 -17 85 2 0 0 0 0 72 -17 85 2 0 0 0 0 64 -17 85 2 0 0 0 0 56 -17 85 2 0 0 0 0 48 -17 85 2 0 0 0 0 40 -17 85 2 0 0 0 0 32 -17 85 2 0 0 0 0 24 -17 85 2 0 0 0 0 16 -17 85 2 0 0 0 0 -80 -19 85 2 0 0 0 0 -64 -19 85 2 0 0 0 0 -48 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -16 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 16 -18 85 2 0 0 0 0 32 -18 85 2 0 0 0 0 56 -16 85 2 0 0 0 0 48 -16 85 2 0 0 0 0 40 -16 85 2 0 0 0 0 32 -16 85 2 0 0 0 0 8 -16 85 2 0 0 0 0 0 -16 85 2 0 0 0 0 -8 -17 85 2 0 0 0 0 -16 -17 85 2 0 0 0 0 -24 -17 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -40 -17 85 2 0 0 0 0 -48 -17 85 2 0 0 0 0 -104 -16 85 2 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 -128 -16 85 2 0 0 0 0 104 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 88 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -40 -16 85 2 0 0 0 0 -48 -16 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -64 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -96 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 120 -16 85 2 0 0 0 0 112 -16 85 2 0 0 0 0 56 -15 85 2 0 0 0 0 48 -15 85 2 0 0 0 0 40 -15 85 2 0 0 0 0 32 -15 85 2 0 0 0 0 8 -15 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -8 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
103491794: Delta jumped! delta=43 LWJGLDelta=0 interval=5070 iterations=54438
WM_GETTEXT = 71 97 109 101 0 0 0 0 11 0 -120 1 0 0 0 0 -120 -17 85 2 0 0 0 0 -128 -17 85 2 0 0 0 0 120 -17 85 2 0 0 0 0 112 -17 85 2 0 0 0 0 88 -17 85 2 0 0 0 0 80 -17 85 2 0 0 0 0 72 -17 85 2 0 0 0 0 64 -17 85 2 0 0 0 0 56 -17 85 2 0 0 0 0 48 -17 85 2 0 0 0 0 40 -17 85 2 0 0 0 0 32 -17 85 2 0 0 0 0 24 -17 85 2 0 0 0 0 16 -17 85 2 0 0 0 0 -80 -19 85 2 0 0 0 0 -64 -19 85 2 0 0 0 0 -48 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -16 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 16 -18 85 2 0 0 0 0 32 -18 85 2 0 0 0 0 56 -16 85 2 0 0 0 0 48 -16 85 2 0 0 0 0 40 -16 85 2 0 0 0 0 32 -16 85 2 0 0 0 0 8 -16 85 2 0 0 0 0 0 -16 85 2 0 0 0 0 -8 -17 85 2 0 0 0 0 -16 -17 85 2 0 0 0 0 -24 -17 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -40 -17 85 2 0 0 0 0 -48 -17 85 2 0 0 0 0 -104 -16 85 2 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 -128 -16 85 2 0 0 0 0 104 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 88 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -40 -16 85 2 0 0 0 0 -48 -16 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -64 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -96 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 120 -16 85 2 0 0 0 0 112 -16 85 2 0 0 0 0 56 -15 85 2 0 0 0 0 48 -15 85 2 0 0 0 0 40 -15 85 2 0 0 0 0 32 -15 85 2 0 0 0 0 8 -15 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -8 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
103496856: Delta jumped! delta=32 LWJGLDelta=0 interval=5062 iterations=54299
WM_GETTEXT = 71 97 109 101 0 0 0 0 11 0 -120 1 0 0 0 0 -120 -17 85 2 0 0 0 0 -128 -17 85 2 0 0 0 0 120 -17 85 2 0 0 0 0 112 -17 85 2 0 0 0 0 88 -17 85 2 0 0 0 0 80 -17 85 2 0 0 0 0 72 -17 85 2 0 0 0 0 64 -17 85 2 0 0 0 0 56 -17 85 2 0 0 0 0 48 -17 85 2 0 0 0 0 40 -17 85 2 0 0 0 0 32 -17 85 2 0 0 0 0 24 -17 85 2 0 0 0 0 16 -17 85 2 0 0 0 0 -80 -19 85 2 0 0 0 0 -64 -19 85 2 0 0 0 0 -48 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -16 -19 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 16 -18 85 2 0 0 0 0 32 -18 85 2 0 0 0 0 56 -16 85 2 0 0 0 0 48 -16 85 2 0 0 0 0 40 -16 85 2 0 0 0 0 32 -16 85 2 0 0 0 0 8 -16 85 2 0 0 0 0 0 -16 85 2 0 0 0 0 -8 -17 85 2 0 0 0 0 -16 -17 85 2 0 0 0 0 -24 -17 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -40 -17 85 2 0 0 0 0 -48 -17 85 2 0 0 0 0 -104 -16 85 2 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 -128 -16 85 2 0 0 0 0 104 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 88 -16 85 2 0 0 0 0 -73 53 -106 109 0 0 0 0 -40 -16 85 2 0 0 0 0 -48 -16 85 2 0 0 0 0 112 48 108 -69 0 0 0 0 -64 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -96 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -112 -16 85 2 0 0 0 0 -120 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 120 -16 85 2 0 0 0 0 112 -16 85 2 0 0 0 0 56 -15 85 2 0 0 0 0 48 -15 85 2 0 0 0 0 40 -15 85 2 0 0 0 0 32 -15 85 2 0 0 0 0 8 -15 85 2 0 0 0 0 0 0 0 0 0 0 0 0 -8 -16 85 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
103501907: Delta jumped! delta=26 LWJGLDelta=0 interval=5051 iterations=54336


without a space

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
WM_GETTEXT = -80-1079800000-120-112980000048-1089800000-112-114980000080-10410800000-128-11298000001684-119119000000000000800000000009800000640000000640000000-5629800000-1148912511900000000000064000000000-1-17000-128-11098000001675105000000000000000000000-14-76-93-3-270000000000167510500000000000000000000080000000080000000167510500000-47-127861190000167510500000167510500000-40-42792000000000000-3210310700000-128105-48-630000000000001150-17-650000-128105-48-630000-14-76-93-3-2700-40-42792000000000000067108000001000000032-1151080000006710800000-80-115108000002000000000000000-14-76-93-3-27001150-17-650000-128-10410800000000000001150-17-6500001150-17-6500001150-17-650000067108000001150-17-65000000000000-14-76-93-3-27002000000080-1041080000080-10410800000-65-114-431050000-321031070000
WM_GETTEXT = 00000000-1272000000-104-41792000048-5650000000-64500000000000000-104-417920000-121-99-89109000000000000000000000-645000000-104-417920000-96-6802000056-605000000900000000-6450000000-64500000064-303660000-12812285-69000000000000-32-2979200005719812000080-287920000-104-417920000561600000000000000400000000-645000000-801215000000-80-57500000064-565000000-104-53500000056-25792000096-851021190000126-182300000-56-4179200000-645000000-1272000000-104-417920000-48-635000000321215000000-43-54-52200000-64-104-89109000066-90-711090000-8-41792000000000000112-4279200001000072142248-56500000037-98-89109000000000000875-10110900000000000029718711900000-6450000002000000080-108-20-3-2700-3613-101109000025020000048-565000000321215000000-48-635000000321215000000-64-61500000048-60500000
WM_GETTEXT = 000000000000000000001700017000-12-1-1-1000000000000-1121000001000083010101030111010103208507300000000000000000000000000000000000000000000000001900019000-12-1-1-1000000000000-112100000100008301010103011101010320850730000000000000000000000000000000000000000000000000-12-1-1-1000000000000-112100000100008301010103011101010320850730000000000000000000000000000000000000000000000000-12-1-1-1000000000000-112100000100008301010103011101010320850730000000000000000000008166-29-5-27001072810108000000000000000000000000000000000000-5069-29-5-2700-40-323980000-88-27398000016000000012-31398000048200-1600086500910000000000-12261-29-5-2700-64-283980000-40-323980000-96-32398000
WM_GETTEXT = 0000000030111-104-1-2700-762713500000000004016-367920000-8043-104-1-27001600000-130-8043-104-1-270000000000000000008-367920000-80-37792000020000000-64-377920000802753-1-270000000000-7627135000010000000320000000110-120100000000000030111-104-1-2700-762713500000000-2700-80-367920000-76271350000320000000000000000000000000000000320000000802753-1-2700161-87900000000-2700-12800000004800000001000000000000000000016000161-879000000000000-1280001600000000000-32459000004800000000000-270010000000-113-32-102-1-2700-76271350000802753-1-2700-5291890000-116121105119000000000000106-33-102-1-27000000000000000000-104291-98-1-1-1-1-3245900000-104291-98-1-1-1-15034-104-1-27000000000000000000-5621511400006142-104-1-27000000000
102768481: Delta jumped! delta=29 LWJGLDelta=0 interval=439 iterations=1609
WM_GETTEXT = 320000000110-12010000-120-177920000-128-177920000120-177920000112-17792000088-17792000080-17792000072-17792000064-17792000056-17792000048-17792000040-17792000032-17792000024-17792000016-177920000-80-197920000-64-197920000-48-197920000-7353-1061090000-16-197920000-7353-106109000016-18792000032-18792000056-16792000048-16792000040-16792000032-1679200008-1679200000-167920000-8-177920000-16-177920000-24-177920000-7353-1061090000-40-177920000-48-177920000-104-167920000-112-167920000-120-167920000-128-167920000104-16792000096-16792000088-167920000-7353-106109000072-16792000064-167920000-24-167920000-32-167920000-40-167920000-48-167920000-72-167920000-80-167920000-88-167920000-7353-1061090000-104-167920000-112-16792000056-15792000048-15792000040-15792000032-1579200008-1579200000-157920000-8-167920000-16-167920000-24-16792000
102773530: Delta jumped! delta=26 LWJGLDelta=0 interval=5049 iterations=52539
WM_GETTEXT = 71971091010000110-12010000-120-177920000-128-177920000120-177920000112-17792000088-17792000080-17792000072-17792000064-17792000056-17792000048-17792000040-17792000032-17792000024-17792000016-177920000-80-197920000-64-197920000-48-197920000-7353-1061090000-16-197920000-7353-106109000016-18792000032-18792000056-16792000048-16792000040-16792000032-1679200008-1679200000-167920000-8-177920000-16-177920000-24-177920000-5646108-690000-40-177920000-48-177920000-104-167920000-112-167920000-120-167920000-128-167920000104-16792000096-16792000088-167920000-7353-106109000072-16792000064-167920000-5646108-690000-32-16792000000000000-48-16792000000000000-80-167920000-88-16792000000000000-104-167920000-112-16792000056-15792000048-15792000040-15792000032-1579200008-15792000000000000-8-167920000000000000000000
102778596: Delta jumped! delta=38 LWJGLDelta=0 interval=5066 iterations=53211
WM_GETTEXT = 71971091010000110-12010000-120-177920000-128-177920000120-177920000112-17792000088-17792000080-17792000072-17792000064-17792000056-17792000048-17792000040-17792000032-17792000024-17792000016-177920000-80-197920000-64-197920000-48-197920000-7353-1061090000-16-197920000-7353-106109000016-18792000032-18792000056-16792000048-16792000040-16792000032-1679200008-1679200000-167920000-8-177920000-16-177920000-24-177920000-5646108-690000-40-177920000-48-177920000-104-167920000-112-167920000-120-167920000-128-167920000104-16792000096-16792000088-167920000-7353-106109000072-16792000064-167920000-5646108-690000-32-16792000000000000-48-16792000000000000-80-167920000-88-16792000000000000-104-167920000-112-16792000056-15792000048-15792000040-15792000032-1579200008-15792000000000000-8-167920000000000000000000
102783645: Delta jumped! delta=25 LWJGLDelta=0 interval=5049 iterations=52866
WM_GETTEXT = 71971091010000110-12010000-120-177920000-128-177920000120-177920000112-17792000088-17792000080-17792000072-17792000064-17792000056-17792000048-17792000040-17792000032-17792000024-17792000016-177920000-80-197920000-64-197920000-48-197920000-7353-1061090000-16-197920000-7353-106109000016-18792000032-18792000056-16792000048-16792000040-16792000032-1679200008-1679200000-167920000-8-177920000-16-177920000-24-177920000-5646108-690000-40-177920000-48-177920000-104-167920000-112-167920000-120-167920000-128-167920000104-16792000096-16792000088-167920000-7353-106109000072-16792000064-167920000-5646108-690000-32-16792000000000000-48-16792000000000000-80-167920000-88-16792000000000000-104-167920000-112-16792000056-15792000048-15792000040-15792000032-1579200008-15792000000000000-8-167920000000000000000000
102788713: Delta jumped! delta=38 LWJGLDelta=0 interval=5068 iterations=52797


Quote
On my setup, it pops 7 times at startup then I don't see it anymore
I keep getting these messages every 5 sec even if I remove the focus or minimize the window.. The "delta jumped" period get bigger, however it does seem to keep rough multiplicity directly connected to these messages, e.g. after 11 gettext messages it could print something like
1  
102970849: Delta jumped! delta=42 LWJGLDelta=0 interval=52705 iterations=21497292
(52705~=5000*11)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Spasi
« Reply #3 - Posted 2011-09-09 16:06:11 »

Try this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
case 0x000D: // WM_GETTEXT
  int len = (int)wParam;
   StringBuilder text = new StringBuilder(len);

   int result = defWindowProc(hwnd, msg, wParam, lParam);

   System.out.println("\nWM_GETTEXT (CHARS) = " + result);
   for ( int i = 0; i < len; i++ ) {
      char c = (char)(unsafe.getByte(lParam + i) & 0xFF);
      if ( c == 0 )
         break;
      text.append(c);
   }
   System.out.println("WM_GETTEXT (ANSI) = " + text);

   for ( int i = 0; i < len; i += 2 ) {
      char c = unsafe.getChar(lParam + i);
      if ( c == 0 )
         break;
      text.append(c);
   }
   System.out.println("WM_GETTEXT (UTF16) = " + text);

   return result;


If that doesn't print anything useful, try this:

1  
2  
case 0x000D: // WM_GETTEXT
  return 0;


See if that does anything for the jitter.
Offline deliriumtrip

Junior Newbie





« Reply #4 - Posted 2011-09-09 18:52:52 »

Spasi, thanks

Quote
Try this:
I got this
1  
2  
3  
4  
WM_GETTEXT (CHARS) = 4
WM_GETTEXT (ANSI) = Game
WM_GETTEXT (UTF16) = Game慇敭
129795515: Delta jumped! delta=33 LWJGLDelta=0 interval=5055 iterations=51047

Jitters still occur

1  
If that doesn't print anything useful, try this:

I already tried it before- no effect


I managed to found out something new:
I dont know is it a reason or just a consequence, but then I disable Win7 aero scheme, jitters disappear (GETTEXT messages still arrive)..
I wonder if Windows aero is able to lock GPU resources so badly by some reason?
I did a quick search on google and it does not seem like a common problem...
Did you have Win 7 aero enabled on our PC while running the example?
I will try to run some games with benchmarking enabled tomorrow (never actually noticed any problem before)
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2011-09-09 23:20:44 »

Happens with my games too (try them on your rig - I think you'll experience odd jitter instead of glassy smooth gameplay)

Cas Smiley

Offline Spasi
« Reply #6 - Posted 2011-09-10 08:50:53 »

I tried with aero enabled, no jitter and no WM_GETTEXT messages again. I believe princec is on NV hardware too, so it might be something specific to that. Random thought: try disabling threaded optimization in the NV driver settings.
Offline deliriumtrip

Junior Newbie





« Reply #7 - Posted 2011-09-11 18:25:52 »

there is no jittering at fullscreen. So it happens only in windowed mode.. And it turned out to be that games I tested jitter without aero as well just a little bit less frequently.. So it seems aero is not the root of the problem.. I have no other clue and will probably have to live with it..

Spasi, no effect unfortunately...

princec, RoT does not jitter or at least I can not notice it.. Droid Assault seems to jitter sometimes but I can not confirm it for sure without debug messages..
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2011-09-11 21:16:17 »

Ah no I know what this problem is. Basically the Aero compositor does not play very nicely with OpenGL for some reason and refreshes the screen at a slightly different rate to the game. Your game will probably log that it is running at a glassy smooth 60fps but the display sometimes randomly skips a frame or three.

At least, that's what happened to me. In fullscreen mode the compositor is totally bypassed and it works perfectly smoothly. Disabling Aero compositing also worked for me, ISTR. The busier your game is the more likely the display is to lag slightly like this.

Cas Smiley

Offline deliriumtrip

Junior Newbie





« Reply #9 - Posted 2011-09-12 08:01:09 »

Cas, yes, maybe it's the case, but the facts, that
1) Spasi ran my simple test without lags with aero enabled
2) The slick2d game I ran (totalmeltdown.comuv.com) does lag sometimes at the same place(i.e. at nSwapBuffers) even with aero disabled .. less frequently but nevetheless..
makes me think that aero is not the root of this particular problem...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2011-09-12 09:35:28 »

I think then it's most likely Nvidia drivers that are to blame then.

Cas Smiley

Offline gouessej
« Reply #11 - Posted 2011-09-12 13:53:07 »

Hi

Maybe my suggestion won't help you but do you set noddraw to true?
1  
sun.java2d.noddraw=true


Do you disable Direct3D?
1  
sun.java2d.d3d=false


Do you enable OpenGL?
1  
sun.java2d.opengl=true


Which version of JOGL do you use?

Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2011-09-12 17:05:41 »

It's LWJGL's native display.

Cas Smiley

Offline deliriumtrip

Junior Newbie





« Reply #13 - Posted 2011-09-13 08:57:14 »

gouessej, I just tried it with JOGL- no effect, same jitters. JOGL version 1.1.1
Offline gouessej
« Reply #14 - Posted 2011-09-13 08:59:38 »

gouessej, I just tried it with JOGL- no effect, same jitters. JOGL version 1.1.1
Do you reproduce the same jitters with JOGL 2.0 and its native windowing toolkit (NEWT)?

Offline cylab

JGO Ninja


Medals: 45



« Reply #15 - Posted 2011-09-13 09:07:45 »

I think then it's most likely Nvidia drivers that are to blame then.

Cas Smiley
Yeah, I get Jitter in all non-vsynched apps on my 480GTX, just because 60Hz is not 60Hz for NVidia so there are frame-drops every now and then.

Mathias - I Know What [you] Did Last Summer!
Offline msiggy

Senior Newbie





« Reply #16 - Posted 2012-01-11 18:27:44 »

I get the same exact jittering using JOGL 2.0 and NEWT. Is this an unsolvable side effect of running in windowed mode? I also see the same jitters in Minecraft while running in windowed mode.
Offline theagentd
« Reply #17 - Posted 2012-01-11 18:52:27 »

Not this again... I will stay completely silent this time.

Myomyomyo.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #18 - Posted 2012-01-11 20:40:14 »

OpenGL drivers on Windows are either not quite as diligent or as able as DirectX drivers to sync exactly with the desktop compositor.  If the compositor is a little out of sync for whatever reason, it just drops frames.  Known problem, no solution other than running full-screen.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (32 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!