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

Author Topic: Possible weird bug (or user error :D)  (Read 1732 times)

0 Members and 1 Guest are viewing this topic.

excrulon

  • Newbie
  • *
  • Posts: 12
    • View Profile
Possible weird bug (or user error :D)
« on: May 03, 2011, 10:32:59 am »
Hey all,

I'm using sfml along with box2d for a project I'm working on. I implemented box2d's DebugDraw class and try to use it but there's some weird caveat to it I'm not sure about. If I don't call sfml's Draw() method (eg the third line, _window->Draw()), nothing at all draws. I don't see the debug data drawn and I don't understand why. However, when I have that line there, the circle shape draws fine, along with the debug data on top of it. DrawDebugData uses raw opengl calls to draw everything. Is there something I'm not doing, like swapping the buffers or something? I thought that was essentially what Display() did.

Code: [Select]

_window->Clear(sf::Color::Black);
_world->DrawDebugData();
_window->Draw(circle);
_window->Display();


I mean, I'm pretty sure I'll always be drawing something along with the debug data. It'd just be nice to know why this is and what I'm doing wrong, if anything. My friend and I were sitting there for over an hour trying to figure out why the debug data wasn't drawing, and then I decided to draw a sf::Shape just to test it out and that made the debug data show up all of a sudden.

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Possible weird bug (or user error :D)
« Reply #1 on: May 03, 2011, 10:41:19 am »
You must call _window->PreserveOpenGLStates(true) (just once) if you mix OpenGL and SFML.
Laurent Gomila - SFML developer