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

Author Topic: PushGLstates not working correctly  (Read 799 times)

0 Members and 1 Guest are viewing this topic.

tom_burman

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
PushGLstates not working correctly
« on: April 21, 2013, 04:10:44 pm »
Hi guys, im trying to make a gui for my game using SFML so have been advised to use glpush and pop states. and enter my commands to draw the gui in between the push and pop. So this is what i have :

void Engine::run()
{
        while (App.isOpen())
        {
                while (c_FPSClock.getElapsedTime().asSeconds() < 1.f/60)
                {
                }


               

                // Set the active window before using OpenGL commands
                // It's useless here because active window is always the same,
                // but don't forget it if you use multiple windows or controls
                App.setActive();
               
               

                App.pushGLStates();
        App.draw(text);
        App.popGLStates();

                // Clear color and depth buffer
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                glMatrixMode(GL_MODELVIEW);
                glLoadIdentity();

               

                getInput();
                update();
                render();

                App.display();
        }
}

But this is making my game mess up pretty bad:
  • The input isn't working like before at all
  • The player is rendering below the map

all i want to do is draw some text to display health and a rectangle at the bottom of the screen! haha.

I am also getting these errors in the console

Quote
An internal OpenGL call failed in RenderTarget.cpp <255> : GL_INVALID_OPPERATION,the specified opertaion is not allowed in the current state.

The game is built with C++ OpenGL and SFML to render the window and gui

Any help will be appreciated thanks
« Last Edit: April 21, 2013, 04:16:01 pm by tom_burman »

 

anything