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

Author Topic: Using sf::View as camera when mixing opengl and SFML  (Read 1355 times)

0 Members and 1 Guest are viewing this topic.

sun

  • Newbie
  • *
  • Posts: 9
    • View Profile
Using sf::View as camera when mixing opengl and SFML
« on: September 29, 2014, 11:48:41 pm »
Hi,
I'm having some trouble with using an sf::VIew as a camera when mixing raw opengl calls with SFML. For example, here in my code I'm mixing opengl calls with SFML: https://github.com/SundeepK/Clone/blob/wip/add_splittable_enviroment/src/Game.cpp#L58. Everything drawn by SFML is correct but the textures drawn manually using opengl calls follow the camera, rather than staying put. Here's an example image: http://i.imgur.com/umME791.png?1 . When I move, you can see that the wooden texture follows rather than staying where it's supposed to be.

What would be the general way of handling a camera in this scenario?

sun

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Using sf::View as camera when mixing opengl and SFML
« Reply #1 on: October 10, 2014, 05:42:17 pm »
Ended up fixing this problem a while ago but forgot to update this question. I ended up creating a Camera class which handles sf::View and then translates anything drawn by opengl by how much the sf::view has moved as well (almost like having 2 separate cameras).