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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Caribou

Pages: [1]
1
General discussions / Origin at bottom left (SFML2!?)
« on: October 04, 2011, 02:47:58 pm »
Quote from: "Laurent"
Quote
Thanks for your answers guys

... which you clearly didn't understand :lol:


Baaahhh, it thought it was kinda moving the axes. What my piece of code is doing then ?

Quote
Forget about mirroring, you can't find a solution that can be applied globally. You must adjust the origin of each entity separately.

Code: [Select]
myChar.SetOrigin(myChar.Getsize());
 
I'm gonna need it but their positions are still relatives to the top left corner, how do i change this behaviour !?

2
General discussions / Origin at bottom left (SFML2!?)
« on: October 04, 2011, 02:14:03 pm »
Thanks for your answers guys.

I'm trying to translate again then, here is my piece of code :

Code: [Select]
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML origin");
    sf::Texture texture;
    texture.LoadFromFile("char.png");
    sf::Sprite myChar;
    myChar.SetTexture(texture);

    while (window.IsOpened())
    {
        window.Clear(sf::Color::White);

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glScalef(1.0f, -1.0f, 1.0f);

        window.Draw(myChar);
        window.Display();
    }
}


and my character is not visible anymore.

That's the case in the sample project, but on my project i'm actually seeing some sort of zooming... but still, that's not working.

What did i miss ?

3
General discussions / Origin at bottom left (SFML2!?)
« on: October 03, 2011, 08:03:46 pm »
Hello,

I know this isn't a feature of SFML2 but since there are some changes in the way sfml works i was wondering if there's an easy/not-ugly way to do it.
I've read most of the topics here and googling about that but nothing seems to work as i would, knowing that i'm really beginning with openGL...

A subject on Stack Overflow talks about that : http://stackoverflow.com/questions/6561604/mirroring-the-y-axis-in-sfml (note that i don't actually need mirroring, i just want to change the origin)

Here is the snippet:
Code: [Select]
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glScalef(1.0f, -1.0f, 1.0f);


And it doesn't seem to work here. Then Zagabar from the irc channel helped me with this code:

Code: [Select]
glMatrixMode(GL_PROJECTION);
glViewport(0, 0, w, h);
glLoadIdentity();
gluOrtho2D(0.0f, (float)w, 0.0f, (float)h); // set origin to bottom left corner
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();


But that's mirroring everything, so i have to flip each of my sprites, that's ok since i'm subclassing sf::Sprite but then the text is mirrored as well and i can't find a way to reset the projection.

So basically my question is, how would you change the origin to the bottom left corner without having to break everything ?

Pages: [1]