Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML2+VBO problem  (Read 2562 times)

0 Members and 2 Guests are viewing this topic.

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
SFML2+VBO problem
« on: March 19, 2012, 10:33:29 am »
Hi, I decided to try and update my project to use SFML 2, from 1.6. I've gone and converted everything to the SFML2 API and everything seems to work fine, except that whenever something to do with VBOs happens in my code (glGenBuffers in this case), the program completely locks up.

Normally I'd think it was a problem with how I'm doing things, but it worked perfectly fine with SFML 1.6. Has anything changed between 1.6 and 2 that could be causing this?

The only major thing I had to change was to add GL state push/pops around any SFML drawing code (I'm only using it for text rendering currently), where in 1.6 I only needed to call PreserveOpenGLStates() on each RenderWindow.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML2+VBO problem
« Reply #1 on: March 19, 2012, 10:50:56 am »
Is the problem really on glGenBuffers? There's a known bug which can happen when you draw a vertex buffer, but none that would cause glGenBuffers to freeze or crash.
Laurent Gomila - SFML developer

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
SFML2+VBO problem
« Reply #2 on: March 19, 2012, 11:22:27 am »
Hmm, well using log messages pointed me towards the glGenBuffers line, but that seems to be unreliable, since it happens there sometimes but not always. Unfortunately the debugger gives no useful information, except that the crash happens somewhere in the video driver.

Disabling VBOs completely and using immediate mode instead is the only thing I've found so far that fixes the problem, but of course that isn't really a satisfactory solution.

Testing on my laptop with an intel chipset instead of nvidia like my pc, in release build it locks up, but in debug mode it works but with lots of graphical artifacts on the things drawn using VBOs. Is there some kind of VBO-related state that SFML 2 is setting?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML2+VBO problem
« Reply #3 on: March 19, 2012, 11:27:30 am »
Quote
Is there some kind of VBO-related state that SFML 2 is setting?

Absolutely. It enables position, color and texcoords components (glEnableClientState), so if your own buffers don't use one of them, you must disable it.
Laurent Gomila - SFML developer

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
SFML2+VBO problem
« Reply #4 on: March 19, 2012, 11:53:23 am »
Ok that was the problem, explicitly disabling those components (except what I was using, obviously) before drawing my VBOs fixed things.

Thanks for the help :)

 

anything