I am new to this and I took my first steps on OpenGL. I have written a small test program (basically hacked an OpenGL example) that uses SDL2 to get a OpenGL context and to draw a rotating cube (basically took this code and made it compile on SDL2: https://www.libsdl.org/release/SDL-1.2.15/docs/html/guidevideoopengl.html). I don’t really understand the CPU-Load and the framerate that I see when running it on Linux on a Atom D525 with ION2 (in relation to VSync). I think there might be something wrong with my setup (maybe related to graphics driver or Xorg?).
WITH VSync the framerate gets limited to 60 fps and causes a CPU load of about 2 % (fine so far). But when I disable VSync I get a framerate of around 480 fps but a CPU load of 100 %. 100 % CPU means that the program is CPU-bound, right? So the framerate could be increased with a faster CPU I think.
I have the feeling that the CPU-Load of 100 % is not ok (or the framerate should be higher). Is it expected that a framerate of 60 fps (vsync) causes 2% CPU but a framerate of 480 fps (non-vsync) causes 100% CPU? Its 50 times the CPU-Load (2% -> 100%) but only 8 times the framerate (60fps -> 480fps).
I have read that sometimes you get 100% CPU WITH VSync since waiting for vsync is sometimes implemented as a busy loop but in my case it is exactly the other way round.
And is it expected that a program like that is CPU-bound? It does not do much on the CPU and is only drawing on the GPU, no?
These are my system specs:
- Shuttle XS35GTv2 (Intel Atom D525 with ION2)
- Lubuntu 16.04 LTS
- Graphics-Driver: Nvidia 340.96
This is the output of glxinfo: http://pastebin.com/ztqEBsrm
This is my Xorg.log: http://pastebin.com/VvsxnAvd
If any information is missing I will happily provide more
So if you have any idea how my numbers (fps <-> cpu) make sense or what could be wrong about my setup, then I would be very thankful!
Actual code: http://pastebin.com/AquDYf9Q