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

Author Topic: 0,0 in top left  (Read 3558 times)

0 Members and 1 Guest are viewing this topic.

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
0,0 in top left
« on: January 02, 2011, 02:46:09 pm »
I know it was discused in feature request, but over 3 years ago... I was searching for bug in my pick ray function. It had problem with Y axis being flipped or something. Well after few hours I came down to core of my app where SFML is being used and I finnaly realized that no matter what I set in openGL I still get flipped image.

So was there impelemented some way to flip axis int openGL-like style(0,0 in bottom left and it's more like when you draw graph on paper) or is there any easy solution w/o rewriting whole code if I'm using only openGL calls to draw primitives?

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
0,0 in top left
« Reply #1 on: January 02, 2011, 02:53:07 pm »
Why not try and adapt your algorithm? Flpping the axis is simply math, either change the algorithm or flip the output.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
0,0 in top left
« Reply #2 on: January 02, 2011, 02:56:45 pm »
well it's strange looking write everywhere ScreenY - Y instead of Y...
aswell using function for flipping would be too much unncessary writing like flip(y).
Edit: I just realized that's not even possible I'm dealing with 3d not just 2d, and I don't know how will my coordinates map onto screen (well I know it but computing it would be just another rendering and then reading back), so I can't really flip anything in there..

and as for fliping output, I'm using App.Display() where App is sf::RenderWindow and I don't see method for fliping that, that's why I'm asking.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
0,0 in top left
« Reply #3 on: January 02, 2011, 03:23:42 pm »
There's no way, SFML works with 0 on top, there's nothing you can do against that.

In fact there's something you can test: setting up a view with top > bottom. I don't think you'll be happy with that (absolutely everything is upside down -- not even sure if it works properly) but you can try...
Laurent Gomila - SFML developer

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
0,0 in top left
« Reply #4 on: January 02, 2011, 05:54:19 pm »
If you meant that:

App.SetView(sf::View(sf::FloatRect(0,100,0,100)));

it's not working.. still openGL 0,0 being rendered up from 0,20.

I thought about it and only thing that came to my mind is to flip camera and render back of everything not front, but that's too overhelming and wouldn't ease anything I think

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
0,0 in top left
« Reply #5 on: January 02, 2011, 11:01:43 pm »
Hmm after some research on net I found quite simple solution, using glScalef(1.0f, -1.0f, 1.0f); on your projection matrix in openGL... I know this forum is more SFML related, but as you are basically creating SFML on top of glew, can you tell me if there is any good reason i should get used to 0,0 in top left? or is it just convention for those window systems (I read something about direct acces to framebuffer, that's why it was quite time ago used to be that way, but if there's any good nowadays). And second I can't imagine, but you maybe came across some problems with that kind of inverting space in oGL? Thanks anyway for your time :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
0,0 in top left
« Reply #6 on: January 02, 2011, 11:10:25 pm »
There's no technical limitation, the only reason is that I had to choose one or the other, and top-left is the most common choice in 2D graphics since that's what windowing systems use.
Laurent Gomila - SFML developer