I'm trying to use SDL + OpenGL but I don't believe hardware acceleration is working because the framerate for around 18000 polys is about 24fps on a quad core machine but is a hopeless 1-2fps on an Intel Atom. Even the quad core starts to struggle when the poly count rises above this.

I've checked my code over but I'm clearly missing something obvious. I've changed my SDL initialisation code to use the same code as in the SDL OpenGL test. It reports that SDL_GL_ACCELERATED_VISUAL is 1 but that hw_available in SDL_VideoInfo is 0

Also the vendor is reported correctly as Nvidia on both machines and accelerated apps such as Compiz and glxgears work fine.

Any ideas of what to try?



1 Answer 1


If you are using glBegin()/glEnd() in your code, especially if setting textures and states redundantly between frames (i.e., draw with texture 1, then 2, then 1, then 2, as opposed to 1,1,2,2), you probably are incurring driver overhead. Especially this is the case if you are noticing that a slow processor is chugging while it still has a good card. Using glDrawArrays or similar usually has much better performance.

Without a full code listing, though, there really isn't a way to know for sure. SDL is a pretty thin wrapper, so unless you are doing something really weird I wouldn't expect an error. Also, what cards are being used?

  • \$\begingroup\$ The card on this machine is a nVidia Corporation GT218 [ION]. I understand it's going to be a little slow before I optimise but not this slow. I'm binding 1 texture and using it to draw a simple heightfield admittedly of 1 triangle at a time. So a pretty awful way to do things but even so, slower than expected. \$\endgroup\$ Commented Apr 22, 2011 at 6:56
  • 1
    \$\begingroup\$ Just taken the glBegin()/glEnd() calls outside the loop and tweaked the draw routine accordingly and framerate is up to 30fps. So I've leant what a drastic effect those calls make when used unwisely :) Thanks! \$\endgroup\$ Commented Apr 22, 2011 at 7:17
  • \$\begingroup\$ No problem. Glad I could help. \$\endgroup\$
    – ChrisE
    Commented Apr 22, 2011 at 15:31
  • \$\begingroup\$ @ChrisE What do you mean "SDL is a pretty thin wrapper"? \$\endgroup\$
    – Chris
    Commented Mar 30, 2012 at 5:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .