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

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

0 Members and 1 Guest are viewing this topic.

charliesnike

  • Newbie
  • *
  • Posts: 10
    • View Profile
PushGLstates not working correctly
« on: November 24, 2014, 01:45:41 pm »
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
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: November 24, 2014, 02:10:18 pm by Laurent »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: PushGLstates not working correctly
« Reply #1 on: November 24, 2014, 02:19:23 pm »
As you're just beginning to use SFML, I think it's a really bad idea to mix it with OpenGL... Why not make your game working with SFML, and once you have that and are familiar with the library, you can still consider to delve into raw OpenGL? Although this usually only makes sense if you do stuff that SFML can't do, or you simply want to experiment.

Furthermore, read this thread, it helps you get more answers in the future.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: