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

Author Topic: OpenGL and SFML weird thing  (Read 1966 times)

0 Members and 1 Guest are viewing this topic.

led

  • Newbie
  • *
  • Posts: 28
    • View Profile
OpenGL and SFML weird thing
« on: December 20, 2009, 11:22:03 pm »
Hey,
my window freezes, and me and my professor can't figure out what it is
Code: [Select]
#include <GL/GLee.h>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

using namespace sf;

int main()
{
RenderWindow Window(sf::VideoMode(800,600,32),"GL SandBox");
//Window.PreserveOpenGLStates(true);
//glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
//glOrtho(0,800,0,600,-1,1);
//glMatrixMode(GL_MODELVIEW);
/*Vector2f Vertices[4] =
{
Vector2f(350,250), //Canto superior esquerdo
Vector2f(450,250), //Canto superior direito
Vector2f(450,350), //Canto inferior direito
Vector2f(350,350) //Canto inferior esquerdo
};*/
while (Window.IsOpened())
{
Window.Clear();
//glEnableClientState(GL_VERTEX_ARRAY);
//glVertexPointer(2,GL_FLOAT,0,Vertices);
//glDrawArrays(GL_QUADS,0,4);
Window.Display();

}


return 0;
}


Please try runing in your pc if it works, i already tried using Window.hpp but no result either... :roll:
btw, Win XP SP3, VS2008 SP1
while (!idle)
{
   DoSomething();
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL and SFML weird thing
« Reply #1 on: December 20, 2009, 11:45:52 pm »
If you don't call Window.GetEvent, then SFML will never let the window proceed its events and then it just stops responding.
Laurent Gomila - SFML developer

led

  • Newbie
  • *
  • Posts: 28
    • View Profile
OpenGL and SFML weird thing
« Reply #2 on: December 21, 2009, 12:31:45 am »
Thanks for the help, it solved the problem. :D
while (!idle)
{
   DoSomething();
}