I just started playing around with LWJGL (very cool stuff) and have some performance questions. After running some test code, my fps never went above 60. For example, rendering just a point, around 60 fps. Rendering 16000 triangles, around 60 fps. Rendering 100000, around 20 fps.
Some info...
AMD 2600+
1gb ram
OpenGL Vendor : NVIDIA Corporation
OpenGL Renderer : GeForce2 MX/AGP/SSE/3DNOW!
OpenGL Version : 1.4.0
Java 1.4.2
LWJGL 0.7
When just rendering one pixel (around 60 fps), -Xprof outputs:
Interpreted + native Method
93.6% 0 + 690 org.lwjgl.opengl.Window.swapBuffers
When rendering the 28800 triangles (around 60 fps), -Xprof outputs:
Interpreted + native Method
19.3% 1 + 1200 org.lwjgl.opengl.CoreGL11.glDrawArrays
1.0% 0 + 63 org.lwjgl.opengl.Window.swapBuffers
Stub + native Method
76.5% 0 + 4769 org.lwjgl.opengl.CoreGL11.glDrawArrays
Does this make any sense? Why is so much time spent in the swapping the buffers when nothings is going on? I am just going crazy (I haven't used OpenGL in a long time and this is my first experiment with LWJGL)?
Thanks!
If you're using Windows, you have either:
1. An explicit glSwapIntervalEXT call in your code that enables vertical refresh sync.
or
2. Have vertical sync enabled in the NVIDIA control panel.
You can always try your app in windowed mode. AFAIK, windows will never sync to vertical refresh.
- elias
And don't forget: never disable vsync in the Windows control panel unless you're actually doing code profiling, because although 600fps sounds cool, it looks awful and wastes CPU cycles. Think of the environmental benefits!
:twisted:
Cas :)
This (http://www.openglforums.com/forums/viewtopic.php?t=3431) might interest you :)
Once I switched vertical sync to "Off by Default", my framerate shot way up. Thanks for the information. Obviously, 60 fps is enough for a game; like you mentioned, having the vertical sync off will be useful for profiling.
thanks again