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

Author Topic: Maybe a issue in rendering with SFML mixed with OpenGL.  (Read 841 times)

0 Members and 1 Guest are viewing this topic.

gonrogon

  • Newbie
  • *
  • Posts: 1
    • View Profile
Maybe a issue in rendering with SFML mixed with OpenGL.
« on: June 14, 2012, 05:32:39 pm »
Hi,

In recent days, I've been trying to mix SFML with me graphic engine and I have found a possible bug. The point is that when I active the face culling the SFML text disappears.

Here is a test code:
int main(int argc, char** argv)
{
    sf::RenderWindow window(sf::VideoMode(640, 480, 32), "Test window");
    sf::Text         text;
    // Setup the text.
    text.SetString  ("Test text!");
    text.SetPosition(10.0f, 10.0f);
    // Main loop.
    while (window.IsOpen())
    {
        sf::Event event;
        // Events.
        while (window.PollEvent(event))
        {
            if (event.Type == sf::Event::Closed)
            {
                window.Close();
            }
        }
        // This causes the problem.
        glEnable(GL_CULL_FACE);
        glCullFace(GL_BACK);
        // Projection.
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(-5.0f, 5.0f, -5.0f, 5.0f, -1.0f, 1.0f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        // Only a point.
        glPointSize(4.0f);
        glBegin(GL_POINTS);
        glVertex2f(0.0f, 0.0f);
        glEnd();
        // SFML rendering.
        window.PushGLStates();
        window.Draw(text);
        window.PopGLStates();
        window.Display();
    }
   
    return EXIT_SUCCESS;
}
 

I looked at the source code of SFML and the problem may be in the method ResetGLStates() in the class RenderTarget. I think this method should disable the face culling or set its own culling parameters.

Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Maybe a issue in rendering with SFML mixed with OpenGL.
« Reply #1 on: June 14, 2012, 06:03:46 pm »
Thanks! It's fixed :)
Laurent Gomila - SFML developer

 

anything